Support "andhi/andsi/anddi" as a zero-extending move.
authorH.J. Lu <hongjiu.lu@intel.com>
Sat, 9 Oct 2010 05:34:10 +0000 (05:34 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Sat, 9 Oct 2010 05:34:10 +0000 (22:34 -0700)
gcc/

2010-10-08  H.J. Lu  <hongjiu.lu@intel.com>

PR target/45913
* config/i386/i386.c (ix86_binary_operator_ok): Support
"andhi/andsi/anddi" as a zero-extending move.

gcc/testsuite/

2010-10-08  H.J. Lu  <hongjiu.lu@intel.com>

PR target/45913
* gcc.target/i386/pr45913.c: New.

From-SVN: r165215

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

index a560cc7..538551d 100644 (file)
@@ -1,3 +1,9 @@
+2010-10-08  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/45913
+       * config/i386/i386.c (ix86_binary_operator_ok): Support
+       "andhi/andsi/anddi" as a zero-extending move.
+
 2010-10-08  Nathan Froyd  <froydnj@codesourcery.com>
 
        * builtins.c (fold_call_stmt): Don't copy gimple call arguments
index 33510a7..999c716 100644 (file)
@@ -14987,7 +14987,16 @@ ix86_binary_operator_ok (enum rtx_code code, enum machine_mode mode,
 
   /* Source 1 cannot be a non-matching memory.  */
   if (MEM_P (src1) && !rtx_equal_p (dst, src1))
-    return false;
+    {
+      /* Support "andhi/andsi/anddi" as a zero-extending move.  */
+      return (code == AND
+             && (mode == HImode
+                 || mode == SImode
+                 || (TARGET_64BIT && mode == DImode))
+             && CONST_INT_P (src2)
+             && (INTVAL (src2) == 0xff
+                 || INTVAL (src2) == 0xffff));
+    }
 
   return true;
 }
index a576470..9c2d0df 100644 (file)
@@ -1,3 +1,8 @@
+2010-10-08  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/45913
+       * gcc.target/i386/pr45913.c: New.
+
 2010-10-08  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR fortran/45943
diff --git a/gcc/testsuite/gcc.target/i386/pr45913.c b/gcc/testsuite/gcc.target/i386/pr45913.c
new file mode 100644 (file)
index 0000000..46b9c66
--- /dev/null
@@ -0,0 +1,23 @@
+/* PR target/45913 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fselective-scheduling2 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops" } */
+
+extern void bar (int, int);
+
+int ss[128];
+
+void
+foo (int i, int j, int k, int *p1, int *p2)
+{
+  int s[128];
+  __builtin_memcpy (s, ss, sizeof s);
+
+  while (i--)
+    {
+      int a = s[i];
+      while (j--)
+       bar (k, p2[a]);
+      j = s[i] & 0xFF;
+      bar (p1[a], k);
+    }
+}