aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/simplify-rtx.c16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr87918.c14
4 files changed, 38 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 29a216cd..14a310e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 0d53135..db8af2f 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -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)))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e7d4ad7..1427960 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..dd62910
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr87918.c
@@ -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);
+}