Patchwork [i386] : PR51235, PR51236: A couple of bugfixes

login
register
mail settings
Submitter Uros Bizjak
Date Nov. 20, 2011, 10:24 p.m.
Message ID <CAFULd4Zu4gTTsXUTP=TDuH-fMhqwjm2WEjxAev=7M88PQpLbwQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/126667/
State New
Headers show

Comments

Uros Bizjak - Nov. 20, 2011, 10:24 p.m.
Hello!

2011-11-20  Uros Bizjak  <ubizjak@gmail.com>

	PR target/51235
	* config/i386/i386.c (ix86_expand_vcond): Generate TARGET_XOP
	patterns for supported mode only.

	PR target/51236
	* config/i386/i386.c (ix86_expand_builtin)
	<IX86_BUILTIN_GATHERALTSIV4DI>: Use CODE_FOR_avx2_gathersiv4di.

testsuite/ChangeLog:

2011-11-20  Uros Bizjak  <ubizjak@gmail.com>

	PR target/51235
	* gcc.target/i386/pr51235.c: New test.

	PR target/51236
	* gcc.target/i386/pr51236.c: New test.

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

Uros.

Patch

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 181534)
+++ config/i386/i386.c	(working copy)
@@ -19619,8 +19619,12 @@ 
   cop0 = operands[4];
   cop1 = operands[5];
 
-  /* XOP supports all of the comparisons on all vector int types.  */
-  if (!TARGET_XOP)
+  /* XOP supports all of the comparisons on all 128-bit vector int types.  */
+  if (TARGET_XOP
+      && (mode == V16QImode || mode == V8HImode
+	  || mode == V4SImode || mode == V2DImode))
+    ;
+  else
     {
       /* Canonicalize the comparison to EQ, GT, GTU.  */
       switch (code)
@@ -30013,7 +30017,7 @@ 
       icode = CODE_FOR_avx2_gatherdiv8sf;
       goto gather_gen;
     case IX86_BUILTIN_GATHERALTSIV4DI:
-      icode = CODE_FOR_avx2_gathersiv4df;
+      icode = CODE_FOR_avx2_gathersiv4di;
       goto gather_gen;
     case IX86_BUILTIN_GATHERALTDIV8SI:
       icode = CODE_FOR_avx2_gatherdiv8si;
Index: testsuite/gcc.target/i386/pr51236.c
===================================================================
--- testsuite/gcc.target/i386/pr51236.c	(revision 0)
+++ testsuite/gcc.target/i386/pr51236.c	(revision 0)
@@ -0,0 +1,12 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-vectorize -mavx2" } */
+
+long foo (long *p, int i)
+{
+  long x = 0;
+
+  while (--i)
+    x ^= p[i];
+
+  return x;
+}
Index: testsuite/gcc.target/i386/pr51235.c
===================================================================
--- testsuite/gcc.target/i386/pr51235.c	(revision 0)
+++ testsuite/gcc.target/i386/pr51235.c	(revision 0)
@@ -0,0 +1,17 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-vectorize -mxop -mavx2" } */
+
+void *foo (int count, void **list)
+{
+  void *minaddr = list[0];
+  int i;
+
+  for (i = 1; i < count; i++)
+    {
+      void *addr = list[i];
+      if (addr < minaddr)
+	minaddr = addr;
+    }
+
+  return minaddr;
+}