Hello!

2011-09-08  Uros Bizjak  <ubiz...@gmail.com>

        * config/i386/i386.c (standard_sse_constant_p): Handle AVX2 modes.
        (standard_sse_constant_opcode) <case 2>: Change vpcmpeqd template.

testsuite/ChangeLog:

2011-09-08  Uros Bizjak  <ubiz...@gmail.com>

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

Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.

Uros.
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c  (revision 178695)
+++ config/i386/i386.c  (working copy)
@@ -8176,7 +8176,7 @@ standard_80387_constant_rtx (int idx)
 }
 
 /* Return 1 if X is all 0s and 2 if x is all 1s
-   in supported SSE vector mode.  */
+   in supported SSE/AVX vector mode.  */
 
 int
 standard_sse_constant_p (rtx x)
@@ -8194,6 +8194,12 @@ standard_sse_constant_p (rtx x)
       case V2DImode:
        if (TARGET_SSE2)
          return 2;
+      case V32QImode:
+      case V16HImode:
+      case V8SImode:
+      case V4DImode:
+       if (TARGET_AVX2)
+         return 2;
       default:
        break;
       }
@@ -8235,7 +8241,8 @@ standard_sse_constant_opcode (rtx insn, rtx x)
        }
 
     case 2:
-      return "%vpcmpeqd\t%0, %d0";
+      return "%vpcmpeqd\t%0, %0, %0";
+
     default:
       break;
     }
Index: testsuite/gcc.target/i386/all_one_m256i.c
===================================================================
--- testsuite/gcc.target/i386/all_one_m256i.c   (revision 0)
+++ testsuite/gcc.target/i386/all_one_m256i.c   (revision 0)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx2" } */
+
+typedef long long __m256i __attribute__ ((__vector_size__ (32)));
+typedef int __v8si __attribute__ ((__vector_size__ (32)));
+
+__m256i foo ()
+{
+  __m256i minus_1 = (__m256i) (__v8si) { -1, -1, -1, -1, -1, -1, -1, -1 };
+
+  return minus_1;
+}
+
+/* { dg-final { scan-assembler "vpcmpeqd" } } */

Reply via email to