re PR rtl-optimization/45739 (static evaluation of SSE intrinsics (pxor))
authorJakub Jelinek <jakub@redhat.com>
Tue, 21 Sep 2010 23:33:01 +0000 (01:33 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 21 Sep 2010 23:33:01 +0000 (01:33 +0200)
PR rtl-optimization/45739
* simplify-rtx.c (simplify_binary_operation_1): Optimize even
vector mode | CONST0_RTX (mode) and ^ CONST0_RTX (mode).

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

From-SVN: r164501

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

index 0fddd4a2bd8b298ea188ed7e9214ef51312283f1..5b6133899992de742f5d996f7afc8c2d50635d73 100644 (file)
@@ -1,3 +1,9 @@
+2010-09-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/45739
+       * simplify-rtx.c (simplify_binary_operation_1): Optimize even
+       vector mode | CONST0_RTX (mode) and ^ CONST0_RTX (mode).
+
 2010-09-21  Anatoly Sokolov  <aesok@post.ru>
 
        * config/rs6000/rs6000.h (OUTPUT_ADDR_CONST_EXTRA): Remove macros.
index fb8ba396d4f6f481230e0ae9a534b9b38636086a..122c45fdf647417d5802b134f1b60e367f8d2519 100644 (file)
@@ -2260,7 +2260,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
       break;
 
     case IOR:
-      if (trueop1 == const0_rtx)
+      if (trueop1 == CONST0_RTX (mode))
        return op0;
       if (CONST_INT_P (trueop1)
          && ((INTVAL (trueop1) & GET_MODE_MASK (mode))
@@ -2402,7 +2402,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
       break;
 
     case XOR:
-      if (trueop1 == const0_rtx)
+      if (trueop1 == CONST0_RTX (mode))
        return op0;
       if (CONST_INT_P (trueop1)
          && ((INTVAL (trueop1) & GET_MODE_MASK (mode))
index 101d68470e2c5f805258a9a277ab970d9b975d86..9bd4cb2d04c94a1b7d836b6ce09b648233a5cb30 100644 (file)
@@ -1,3 +1,8 @@
+2010-09-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/45739
+       * gcc.target/i386/pr45739.c: New test.
+
 2010-09-21  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/45648
diff --git a/gcc/testsuite/gcc.target/i386/pr45739.c b/gcc/testsuite/gcc.target/i386/pr45739.c
new file mode 100644 (file)
index 0000000..51e28fc
--- /dev/null
@@ -0,0 +1,24 @@
+/* PR rtl-optimization/45739 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+#include <emmintrin.h>
+
+__m128i var;
+
+void
+foo (void)
+{
+  __m128i zero = _mm_setzero_si128 ();
+  var = _mm_xor_si128 (zero, var);
+}
+
+void
+bar (void)
+{
+  __m128i zero = _mm_setzero_si128 ();
+  var = _mm_or_si128 (var, zero);
+}
+
+/* { dg-final { scan-assembler-not "pxor" } } */
+/* { dg-final { scan-assembler-not "por" } } */