On December 13, 2019 12:54:08 AM GMT+01:00, Jakub Jelinek <ja...@redhat.com> wrote: >On Thu, Dec 12, 2019 at 04:59:40PM +0100, Richard Biener wrote: >> >If it starts being ambiguous somewhere, could we use some target >macro >> >or >> >target hook to decide? >> >> Ambiguous IL is bad :/ IL semantics dependent on a target hook, too. >Just look at SHIFT_COUNT_TRUNCATED... > >This is something I've also successfully bootstrapped/regtested on >x86_64-linux and i686-linux:
Works for me. I agree a rewrite isn't sth for stage 3/4 but we might want to revisit this during next stage 1. Richard. >2019-12-11 Jakub Jelinek <ja...@redhat.com> > > PR target/92908 > * simplify-rtx.c (simplify_relational_operation): Punt for vector > cmp_mode and scalar mode, if simplify_relational_operation returned > const_true_rtx. > (simplify_const_relational_operation): Change VOID_mode in function > comment to VOIDmode. > > * gcc.target/i386/avx512bw-pr92908.c: New test. > >--- gcc/simplify-rtx.c.jj 2019-11-19 22:27:02.000058742 +0100 >+++ gcc/simplify-rtx.c 2019-12-11 13:31:57.197809704 +0100 >@@ -5037,6 +5037,15 @@ simplify_relational_operation (enum rtx_ > return NULL_RTX; > #endif > } >+ /* For vector comparison with scalar int result, it is unknown >+ if the target means here a comparison into an integral bitmask, >+ or comparison where all comparisons true mean const_true_rtx >+ whole result, or where any comparisons true mean const_true_rtx >+ whole result. For const0_rtx all the cases are the same. */ >+ if (VECTOR_MODE_P (cmp_mode) >+ && SCALAR_INT_MODE_P (mode) >+ && tem == const_true_rtx) >+ return NULL_RTX; > > return tem; > } >@@ -5383,7 +5392,7 @@ comparison_result (enum rtx_code code, i > } > > /* Check if the given comparison (done in the given MODE) is actually >- a tautology or a contradiction. If the mode is VOID_mode, the >+ a tautology or a contradiction. If the mode is VOIDmode, the > comparison is done in "infinite precision". If no simplification > is possible, this function returns zero. Otherwise, it returns > either const_true_rtx or const0_rtx. */ >--- gcc/testsuite/gcc.target/i386/avx512bw-pr92908.c.jj 2019-12-11 >14:24:12.083418762 +0100 >+++ gcc/testsuite/gcc.target/i386/avx512bw-pr92908.c 2019-12-11 >14:23:56.071665326 +0100 >@@ -0,0 +1,21 @@ >+/* PR target/92908 */ >+/* { dg-do run } */ >+/* { dg-options "-Og -fno-tree-fre -mavx512bw" } */ >+/* { dg-require-effective-target avx512bw } */ >+ >+#define AVX512BW >+#include "avx512f-helper.h" >+ >+typedef unsigned short V __attribute__ ((__vector_size__ (64))); >+ >+V v; >+ >+void >+TEST (void) >+{ >+ int i; >+ v = (V) v == v; >+ for (i = 0; i < 32; i++) >+ if (v[i] != 0xffff) >+ abort (); >+} > > > Jakub