re PR rtl-optimization/87918 (ICE in simplify_binary_operation, at simplify-rtx.c...
authorJakub Jelinek <jakub@redhat.com>
Tue, 13 Nov 2018 09:45:50 +0000 (10:45 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 13 Nov 2018 09:45:50 +0000 (10:45 +0100)
PR rtl-optimization/87918
* simplify-rtx.c (simplify_merge_mask): For COMPARISON_P, use
simplify_gen_relational rather than simplify_gen_binary.

* gcc.target/i386/pr87918.c: New test.

From-SVN: r266062

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

index 29a216cd42dced880b6dec3473b763e2d9201370..14a310ef99f89bdadb0c3e3f4a933460bcafc453 100644 (file)
@@ -1,3 +1,9 @@
+2018-11-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/87918
+       * simplify-rtx.c (simplify_merge_mask): For COMPARISON_P, use
+       simplify_gen_relational rather than simplify_gen_binary.
+
 2018-11-13  Richard Biener  <rguenther@suse.de>
 
        * tree-ssanames.h (set_range_info): Use value_range_base.
index 0d53135f1ff8009323b93d67ed54571059a8d756..db8af2f76928ba2225fd66a541d4d94a514aca93 100644 (file)
@@ -5647,9 +5647,19 @@ simplify_merge_mask (rtx x, rtx mask, int op)
       rtx top0 = simplify_merge_mask (XEXP (x, 0), mask, op);
       rtx top1 = simplify_merge_mask (XEXP (x, 1), mask, op);
       if (top0 || top1)
-       return simplify_gen_binary (GET_CODE (x), GET_MODE (x),
-                                   top0 ? top0 : XEXP (x, 0),
-                                   top1 ? top1 : XEXP (x, 1));
+       {
+         if (COMPARISON_P (x))
+           return simplify_gen_relational (GET_CODE (x), GET_MODE (x),
+                                           GET_MODE (XEXP (x, 0)) != VOIDmode
+                                           ? GET_MODE (XEXP (x, 0))
+                                           : GET_MODE (XEXP (x, 1)),
+                                           top0 ? top0 : XEXP (x, 0),
+                                           top1 ? top1 : XEXP (x, 1));
+         else
+           return simplify_gen_binary (GET_CODE (x), GET_MODE (x),
+                                       top0 ? top0 : XEXP (x, 0),
+                                       top1 ? top1 : XEXP (x, 1));
+       }
     }
   if (GET_RTX_CLASS (GET_CODE (x)) == RTX_TERNARY
       && VECTOR_MODE_P (GET_MODE (XEXP (x, 0)))
index e7d4ad7143c2ce6dc74ad1b732c799a547dc940b..1427960e5349f96841e3f03cacdd312114d4540a 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/87918
+       * gcc.target/i386/pr87918.c: New test.
+
 2018-11-13  Alan Modra  <amodra@gmail.com>
 
        * gcc.target/powerpc/rotmask.c: New.
diff --git a/gcc/testsuite/gcc.target/i386/pr87918.c b/gcc/testsuite/gcc.target/i386/pr87918.c
new file mode 100644 (file)
index 0000000..dd62910
--- /dev/null
@@ -0,0 +1,14 @@
+/* PR rtl-optimization/87918 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+#include <x86intrin.h>
+
+__m128 b, c, d;
+
+void
+foo (float f)
+{
+  c = _mm_set_ss (f);
+  d = _mm_cmple_ss (c, b);
+}