@@ -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;
}
@@ -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);
+ }
+}