* [PATCH] Fix simplify_merge_mask (PR rtl-optimization/87918)
@ 2018-11-13 8:39 Jakub Jelinek
2018-11-13 8:57 ` Eric Botcazou
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2018-11-13 8:39 UTC (permalink / raw)
To: Richard Biener, Eric Botcazou; +Cc: gcc-patches
Hi!
The BINARY_P predicate is true not just for arithmetic binary ops, but
for relational ones too; for the latter, we must not call
simplify_gen_binary, but simplify_gen_relational instead.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
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.
* gcc.target/i386/pr87918.c: New test.
--- gcc/simplify-rtx.c.jj 2018-11-08 18:07:08.716852316 +0100
+++ gcc/simplify-rtx.c 2018-11-12 18:20:22.196580659 +0100
@@ -5647,9 +5647,19 @@ simplify_merge_mask (rtx x, rtx mask, in
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)))
--- gcc/testsuite/gcc.target/i386/pr87918.c.jj 2018-11-12 18:17:49.075088126 +0100
+++ gcc/testsuite/gcc.target/i386/pr87918.c 2018-11-12 18:18:36.239316318 +0100
@@ -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);
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix simplify_merge_mask (PR rtl-optimization/87918)
2018-11-13 8:39 [PATCH] Fix simplify_merge_mask (PR rtl-optimization/87918) Jakub Jelinek
@ 2018-11-13 8:57 ` Eric Botcazou
0 siblings, 0 replies; 2+ messages in thread
From: Eric Botcazou @ 2018-11-13 8:57 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Richard Biener, gcc-patches
> 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.
>
> * gcc.target/i386/pr87918.c: New test.
OK, thanks.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-13 8:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-13 8:39 [PATCH] Fix simplify_merge_mask (PR rtl-optimization/87918) Jakub Jelinek
2018-11-13 8:57 ` Eric Botcazou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).