re PR rtl-optimization/54592 (Cannot fuse SSE move and add together)
authorJakub Jelinek <jakub@redhat.com>
Tue, 18 Sep 2012 15:14:15 +0000 (17:14 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 18 Sep 2012 15:14:15 +0000 (17:14 +0200)
PR target/54592
* config/i386/i386.c (ix86_rtx_costs): Limit > UNITS_PER_WORD
AND/IOR/XOR cost calculation to MODE_INT class modes.

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

From-SVN: r191430

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr54592.c [new file with mode: 0644]

index 951467b6c138e2477b96595ad3343942d04c61f7..4b58a9b2835bd84528be07e57dc3f6ac96766723 100644 (file)
@@ -1,3 +1,9 @@
+2012-09-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/54592
+       * config/i386/i386.c (ix86_rtx_costs): Limit > UNITS_PER_WORD
+       AND/IOR/XOR cost calculation to MODE_INT class modes.
+
 2012-09-18 Thomas Quinot  <quinot@adacore.com>       
 
        * doc/invoke.texi: Document -fada-spec-parent.
index df8c101cd76f14da586efa190ece139726d8f476..c82da8214a67b5eefa4d52c79ac8abdc2c9b4194 100644 (file)
@@ -32792,7 +32792,8 @@ ix86_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total,
     case AND:
     case IOR:
     case XOR:
-      if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
+      if (GET_MODE_CLASS (mode) == MODE_INT
+         && GET_MODE_SIZE (mode) > UNITS_PER_WORD)
        {
          *total = (cost->add * 2
                    + (rtx_cost (XEXP (x, 0), outer_code, opno, speed)
index 208a6d23d42f99af10718ce36bf51e03c5f6e12b..40efded3f37c83d03436ce67842f5e09f669fd87 100644 (file)
@@ -1,5 +1,8 @@
 2012-09-18  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/54592
+       * gcc.target/i386/pr54592.c: New test.
+
        PR tree-optimization/54610
        * gcc.target/i386/pr54610.c: New test.
 
diff --git a/gcc/testsuite/gcc.target/i386/pr54592.c b/gcc/testsuite/gcc.target/i386/pr54592.c
new file mode 100644 (file)
index 0000000..20dc11c
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR target/54592 */
+/* { dg-do compile } */
+/* { dg-options "-Os -msse2" } */
+/* { dg-require-effective-target sse2 } */
+
+#include <emmintrin.h>
+
+void
+func (__m128i * foo, size_t a, size_t b, int *dst)
+{
+  __m128i x = foo[a];
+  __m128i y = foo[b];
+  __m128i sum = _mm_add_epi32 (x, y);
+  *dst = _mm_cvtsi128_si32 (sum);
+}
+
+/* { dg-final { scan-assembler "paddd\[^\n\r\]*(\\(\[^\n\r\]*\\)|XMMWORD PTR)" } } */