re PR target/92908 (wrong code with -Og -fno-tree-fre -mavx512bw and vector compare)
authorJakub Jelinek <jakub@redhat.com>
Fri, 13 Dec 2019 10:12:55 +0000 (11:12 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 13 Dec 2019 10:12:55 +0000 (11:12 +0100)
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.

From-SVN: r279369

gcc/ChangeLog
gcc/simplify-rtx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/avx512bw-pr92908.c [new file with mode: 0644]

index 981b3ff422581f8795709b5004b8eddcd9a4068c..b3d8398ca5f4bd4c1e2ccff519c879e1847d7490 100644 (file)
@@ -1,3 +1,12 @@
+2019-12-13  Jakub Jelinek  <jakub@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.
+
 2019-12-13  Kewen Lin  <linkw@gcc.gnu.org>
 
        * config/rs6000/rs6000.c (adjust_vectorization_cost): New function.
index b2ba9222ce3980d695796f1bc3474d67ae6b97fb..d7046ed662d6af3ff3c3c573f7f8db91692f8148 100644 (file)
@@ -5037,6 +5037,15 @@ simplify_relational_operation (enum rtx_code code, machine_mode mode,
          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, int known_results)
 }
 
 /* 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.  */
index 021c2a0b7e163b7f48020525bf5792fe7bce6a55..66ed72003e4af403eae53c717843d2af59a4db6d 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/92908
+       * gcc.target/i386/avx512bw-pr92908.c: New test.
+
 2019-12-13  Andrew Pinski  <apinski@marvell.com>
 
        * gcc.c-torture/execute/pr86659-1.c: New test.
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr92908.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr92908.c
new file mode 100644 (file)
index 0000000..8827592
--- /dev/null
@@ -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 ();
+}