For FMA4, force all operands into registers.
authorRichard Henderson <rth@redhat.com>
Fri, 4 Dec 2009 05:27:02 +0000 (21:27 -0800)
committerSebastian Pop <spop@gcc.gnu.org>
Fri, 4 Dec 2009 05:27:02 +0000 (05:27 +0000)
2009-12-02  Richard Henderson  <rth@redhat.com>

* config/i386/i386.c (ix86_fixup_binary_operands): For FMA4, force
all operands into registers.

From-SVN: r154969

gcc/ChangeLog
gcc/config/i386/i386.c

index ceb7ba7..16e80f1 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-02  Richard Henderson  <rth@redhat.com>
+
+       * config/i386/i386.c (ix86_fixup_binary_operands): For FMA4, force
+       all operands into registers.
+
 2009-12-02  Sebastian Pop  <sebastian.pop@amd.com>
 
        * config/i386/i386.c (ix86_expand_fma4_multiple_memory): Remove unused
index 82ec08f..436e935 100644 (file)
@@ -13384,6 +13384,16 @@ ix86_fixup_binary_operands (enum rtx_code code, enum machine_mode mode,
   if (MEM_P (src1) && !rtx_equal_p (dst, src1))
     src1 = force_reg (mode, src1);
 
+  /* In order for the multiply-add patterns to get matched, we need
+     to aid combine by forcing all operands into registers to start.  */
+  if (optimize && TARGET_FMA4)
+    {
+      if (MEM_P (src2))
+       src2 = force_reg (GET_MODE (src2), src2);
+      else if (MEM_P (src1))
+       src1 = force_reg (GET_MODE (src1), src1);
+    }
+
   operands[1] = src1;
   operands[2] = src2;
   return dst;