diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index ee9cf0b..61ef15e 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -2006,7 +2006,7 @@
   "TARGET_FMA"
   "@
    vfnmsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
-   vfnmsub231<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
+   vfnmsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
    vfnmsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "ssemuladd")
    (set_attr "mode" "<MODE>")])
diff --git a/gcc/testsuite/gcc.target/i386/fma_1.h b/gcc/testsuite/gcc.target/i386/fma_1.h
new file mode 100644
index 0000000..5b318e4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_1.h
@@ -0,0 +1,117 @@
+
+#ifndef fma_1
+#define fma_1
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * a + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * a - b;
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_2.h b/gcc/testsuite/gcc.target/i386/fma_2.h
new file mode 100644
index 0000000..9851bf1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_2.h
@@ -0,0 +1,117 @@
+
+#ifndef fma_2
+#define fma_2
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * a + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * a - c;
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_3.h b/gcc/testsuite/gcc.target/i386/fma_3.h
new file mode 100644
index 0000000..473dd8a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_3.h
@@ -0,0 +1,117 @@
+
+#ifndef fma_3
+#define fma_3
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * b + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * b - a;
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_4.h b/gcc/testsuite/gcc.target/i386/fma_4.h
new file mode 100644
index 0000000..9efd6de
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_4.h
@@ -0,0 +1,117 @@
+
+#ifndef fma_4
+#define fma_4
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b - c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * b + c;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * b - c;
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_5.h b/gcc/testsuite/gcc.target/i386/fma_5.h
new file mode 100644
index 0000000..f6f27a3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_5.h
@@ -0,0 +1,117 @@
+
+#ifndef fma_5
+#define fma_5
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c - a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * c + a;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * c - a;
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_6.h b/gcc/testsuite/gcc.target/i386/fma_6.h
new file mode 100644
index 0000000..499eaaf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_6.h
@@ -0,0 +1,117 @@
+
+#ifndef fma_6
+#define fma_6
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c - b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * c + b;
+}
+
+__attribute__((sseregparm))
+TYPE
+test_neg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * c - b;
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_double_1.c b/gcc/testsuite/gcc.target/i386/fma_double_1.c
new file mode 100644
index 0000000..4199f40
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "fma_1.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd231sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub231sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd231sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub231sd" 4  } } */
diff --git a/gcc/testsuite/gcc.target/i386/fma_double_2.c b/gcc/testsuite/gcc.target/i386/fma_double_2.c
new file mode 100644
index 0000000..f00d73a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_2.c
@@ -0,0 +1,15 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "fma_2.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132sd" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/fma_double_3.c b/gcc/testsuite/gcc.target/i386/fma_double_3.c
new file mode 100644
index 0000000..63934b1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_3.c
@@ -0,0 +1,19 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "fma_3.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd231sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub231sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd231sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub231sd" 4  } } */
diff --git a/gcc/testsuite/gcc.target/i386/fma_double_4.c b/gcc/testsuite/gcc.target/i386/fma_double_4.c
new file mode 100644
index 0000000..0503fa4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_4.c
@@ -0,0 +1,15 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "fma_4.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132sd" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/fma_double_5.c b/gcc/testsuite/gcc.target/i386/fma_double_5.c
new file mode 100644
index 0000000..5ced6b6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_5.c
@@ -0,0 +1,15 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "fma_5.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132sd" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/fma_double_6.c b/gcc/testsuite/gcc.target/i386/fma_double_6.c
new file mode 100644
index 0000000..41adc38
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_6.c
@@ -0,0 +1,15 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "fma_6.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132sd" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/fma_float_1.c b/gcc/testsuite/gcc.target/i386/fma_float_1.c
new file mode 100644
index 0000000..9b84ebd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "fma_1.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd231ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub231ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd231ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub231ss" 4  } } */
diff --git a/gcc/testsuite/gcc.target/i386/fma_float_2.c b/gcc/testsuite/gcc.target/i386/fma_float_2.c
new file mode 100644
index 0000000..d5a5cc2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_2.c
@@ -0,0 +1,15 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "fma_2.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ss" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/fma_float_3.c b/gcc/testsuite/gcc.target/i386/fma_float_3.c
new file mode 100644
index 0000000..84c847e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_3.c
@@ -0,0 +1,19 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "fma_3.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd231ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub231ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd231ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub231ss" 4  } } */
diff --git a/gcc/testsuite/gcc.target/i386/fma_float_4.c b/gcc/testsuite/gcc.target/i386/fma_float_4.c
new file mode 100644
index 0000000..ee5872c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_4.c
@@ -0,0 +1,15 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "fma_4.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ss" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/fma_float_5.c b/gcc/testsuite/gcc.target/i386/fma_float_5.c
new file mode 100644
index 0000000..9ae3e50
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_5.c
@@ -0,0 +1,15 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "fma_5.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ss" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/fma_float_6.c b/gcc/testsuite/gcc.target/i386/fma_float_6.c
new file mode 100644
index 0000000..d62aa4b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_6.c
@@ -0,0 +1,15 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "fma_6.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ss" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/fma_main.h b/gcc/testsuite/gcc.target/i386/fma_main.h
new file mode 100644
index 0000000..24464ab5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_main.h
@@ -0,0 +1,117 @@
+
+#ifndef fma_main
+#define fma_main
+
+#if DEBUG
+#include <stdio.h>
+#endif
+
+TYPE m1[32] = {
+		1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
+	       17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32
+	      };
+TYPE m2[32] = {
+		2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17,
+	       18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33
+	      };
+TYPE m3[32] = {
+		3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 
+	       19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
+	      };
+TYPE m4[32];
+int test_fails = 0;
+
+void
+compare_result(char * title, TYPE *res)
+{
+  int i;
+  int good = 1;
+  for (i =0; i < 32; i++)
+    if (m4[i] != res[i])
+      {
+        if (good)
+          {
+#if DEBUG
+             printf ("!!!! %s miscompare\n", title);
+#endif
+             good = 0;
+          }
+#if DEBUG
+        printf ("res[%d] = %d, must be %d\n", i, (int)res[i], (int) m4[i]);
+#endif
+      }
+  if (!good)
+    test_fails = 1;
+}
+
+static void fma_test ()
+{
+  int i;
+  for (i=0; i <32; i++)
+    m4[i] = test_noneg_add_noneg_add (m1[i], m2[i], m3[i]);
+  compare_result ("test0000", res_test0000);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_noneg_add_noneg_sub (m1[i], m2[i], m3[i]);
+  compare_result ("test0001", res_test0001);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_noneg_add_neg_add (m1[i], m2[i], m3[i]);
+  compare_result ("test0010", res_test0010);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_noneg_add_neg_sub (m1[i], m2[i], m3[i]);
+  compare_result ("test0011", res_test0011);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_noneg_sub_noneg_add (m1[i], m2[i], m3[i]);
+  compare_result ("test0100", res_test0100);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_noneg_sub_noneg_sub (m1[i], m2[i], m3[i]);
+  compare_result ("test0101", res_test0101);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_noneg_sub_neg_add (m1[i], m2[i], m3[i]);
+  compare_result ("test0110", res_test0110);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_noneg_sub_neg_sub (m1[i], m2[i], m3[i]);
+  compare_result ("test0111", res_test0111);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_neg_add_noneg_add (m1[i], m2[i], m3[i]);
+  compare_result ("test1000", res_test1000);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_neg_add_noneg_sub (m1[i], m2[i], m3[i]);
+  compare_result ("test1001", res_test1001);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_neg_add_neg_add (m1[i], m2[i], m3[i]);
+  compare_result ("test1010", res_test1010);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_neg_add_neg_sub (m1[i], m2[i], m3[i]);
+  compare_result ("test1011", res_test1011);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_neg_sub_noneg_add (m1[i], m2[i], m3[i]);
+  compare_result ("test1100", res_test1100);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_neg_sub_noneg_sub (m1[i], m2[i], m3[i]);
+  compare_result ("test1101", res_test1101);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_neg_sub_neg_add (m1[i], m2[i], m3[i]);
+  compare_result ("test1110", res_test1110);
+
+  for (i=0; i <32; i++)
+    m4[i] = test_neg_sub_neg_sub (m1[i], m2[i], m3[i]);
+  compare_result ("test1111", res_test1111);
+
+  if (test_fails) abort ();
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_1.c b/gcc/testsuite/gcc.target/i386/fma_run_double_1.c
new file mode 100644
index 0000000..d46327d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_1.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "fma_1.h"
+
+#include "fma_run_double_results_1.h"
+
+#include "fma-check.h"
+#include "fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_2.c b/gcc/testsuite/gcc.target/i386/fma_run_double_2.c
new file mode 100644
index 0000000..14d325c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_2.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "fma_2.h"
+
+#include "fma_run_double_results_2.h"
+
+#include "fma-check.h"
+#include "fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_3.c b/gcc/testsuite/gcc.target/i386/fma_run_double_3.c
new file mode 100644
index 0000000..f61f3bf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_3.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "fma_3.h"
+
+#include "fma_run_double_results_3.h"
+
+#include "fma-check.h"
+#include "fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_4.c b/gcc/testsuite/gcc.target/i386/fma_run_double_4.c
new file mode 100644
index 0000000..36d89ed
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_4.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "fma_4.h"
+
+#include "fma_run_double_results_4.h"
+
+#include "fma-check.h"
+#include "fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_5.c b/gcc/testsuite/gcc.target/i386/fma_run_double_5.c
new file mode 100644
index 0000000..a43af76
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_5.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "fma_5.h"
+
+#include "fma_run_double_results_5.h"
+
+#include "fma-check.h"
+#include "fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_6.c b/gcc/testsuite/gcc.target/i386/fma_run_double_6.c
new file mode 100644
index 0000000..b72c87d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_6.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "fma_6.h"
+
+#include "fma_run_double_results_6.h"
+
+#include "fma-check.h"
+#include "fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_results_1.h b/gcc/testsuite/gcc.target/i386/fma_run_double_results_1.h
new file mode 100644
index 0000000..27f325b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_results_1.h
@@ -0,0 +1,54 @@
+
+#ifndef fma_run_double_results_1
+#define fma_run_double_results_1
+
+TYPE res_test0000[32] = {
+  7, 23, 55, 109, 191, 307, 463, 665, 919, 1231, 1607, 2053, 2575, 3179, 3871, 4657, 5543, 6535, 7639, 8861, 10207, 11683, 13295, 15049, 16951, 19007, 21223, 23605, 26159, 28891, 31807, 34913
+};
+TYPE res_test0001[32] = {
+  3, 17, 47, 99, 179, 293, 447, 647, 899, 1209, 1583, 2027, 2547, 3149, 3839, 4623, 5507, 6497, 7599, 8819, 10163, 11637, 13247, 14999, 16899, 18953, 21167, 23547, 26099, 28829, 31743, 34847
+};
+TYPE res_test0010[32] = {
+  -3, -17, -47, -99, -179, -293, -447, -647, -899, -1209, -1583, -2027, -2547, -3149, -3839, -4623, -5507, -6497, -7599, -8819, -10163, -11637, -13247, -14999, -16899, -18953, -21167, -23547, -26099, -28829, -31743, -34847
+};
+TYPE res_test0011[32] = {
+  -7, -23, -55, -109, -191, -307, -463, -665, -919, -1231, -1607, -2053, -2575, -3179, -3871, -4657, -5543, -6535, -7639, -8861, -10207, -11683, -13295, -15049, -16951, -19007, -21223, -23605, -26159, -28891, -31807, -34913
+};
+TYPE res_test0100[32] = {
+  1, 7, 25, 61, 121, 211, 337, 505, 721, 991, 1321, 1717, 2185, 2731, 3361, 4081, 4897, 5815, 6841, 7981, 9241, 10627, 12145, 13801, 15601, 17551, 19657, 21925, 24361, 26971, 29761, 32737
+};
+TYPE res_test0101[32] = {
+  -3, 1, 17, 51, 109, 197, 321, 487, 701, 969, 1297, 1691, 2157, 2701, 3329, 4047, 4861, 5777, 6801, 7939, 9197, 10581, 12097, 13751, 15549, 17497, 19601, 21867, 24301, 26909, 29697, 32671
+};
+TYPE res_test0110[32] = {
+  3, -1, -17, -51, -109, -197, -321, -487, -701, -969, -1297, -1691, -2157, -2701, -3329, -4047, -4861, -5777, -6801, -7939, -9197, -10581, -12097, -13751, -15549, -17497, -19601, -21867, -24301, -26909, -29697, -32671
+};
+TYPE res_test0111[32] = {
+  -1, -7, -25, -61, -121, -211, -337, -505, -721, -991, -1321, -1717, -2185, -2731, -3361, -4081, -4897, -5815, -6841, -7981, -9241, -10627, -12145, -13801, -15601, -17551, -19657, -21925, -24361, -26971, -29761, -32737
+};
+TYPE res_test1000[32] = {
+  3, -1, -17, -51, -109, -197, -321, -487, -701, -969, -1297, -1691, -2157, -2701, -3329, -4047, -4861, -5777, -6801, -7939, -9197, -10581, -12097, -13751, -15549, -17497, -19601, -21867, -24301, -26909, -29697, -32671
+};
+TYPE res_test1001[32] = {
+  -1, -7, -25, -61, -121, -211, -337, -505, -721, -991, -1321, -1717, -2185, -2731, -3361, -4081, -4897, -5815, -6841, -7981, -9241, -10627, -12145, -13801, -15601, -17551, -19657, -21925, -24361, -26971, -29761, -32737
+};
+TYPE res_test1010[32] = {
+  1, 7, 25, 61, 121, 211, 337, 505, 721, 991, 1321, 1717, 2185, 2731, 3361, 4081, 4897, 5815, 6841, 7981, 9241, 10627, 12145, 13801, 15601, 17551, 19657, 21925, 24361, 26971, 29761, 32737
+};
+TYPE res_test1011[32] = {
+  -3, 1, 17, 51, 109, 197, 321, 487, 701, 969, 1297, 1691, 2157, 2701, 3329, 4047, 4861, 5777, 6801, 7939, 9197, 10581, 12097, 13751, 15549, 17497, 19601, 21867, 24301, 26909, 29697, 32671
+};
+TYPE res_test1100[32] = {
+  -3, -17, -47, -99, -179, -293, -447, -647, -899, -1209, -1583, -2027, -2547, -3149, -3839, -4623, -5507, -6497, -7599, -8819, -10163, -11637, -13247, -14999, -16899, -18953, -21167, -23547, -26099, -28829, -31743, -34847
+};
+TYPE res_test1101[32] = {
+  -7, -23, -55, -109, -191, -307, -463, -665, -919, -1231, -1607, -2053, -2575, -3179, -3871, -4657, -5543, -6535, -7639, -8861, -10207, -11683, -13295, -15049, -16951, -19007, -21223, -23605, -26159, -28891, -31807, -34913
+};
+TYPE res_test1110[32] = {
+  7, 23, 55, 109, 191, 307, 463, 665, 919, 1231, 1607, 2053, 2575, 3179, 3871, 4657, 5543, 6535, 7639, 8861, 10207, 11683, 13295, 15049, 16951, 19007, 21223, 23605, 26159, 28891, 31807, 34913
+};
+TYPE res_test1111[32] = {
+  3, 17, 47, 99, 179, 293, 447, 647, 899, 1209, 1583, 2027, 2547, 3149, 3839, 4623, 5507, 6497, 7599, 8819, 10163, 11637, 13247, 14999, 16899, 18953, 21167, 23547, 26099, 28829, 31743, 34847
+};
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_results_2.h b/gcc/testsuite/gcc.target/i386/fma_run_double_results_2.h
new file mode 100644
index 0000000..f9327ce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_results_2.h
@@ -0,0 +1,54 @@
+
+#ifndef fma_run_double_results_2
+#define fma_run_double_results_2
+
+TYPE res_test0000[32] = {
+  8, 24, 56, 110, 192, 308, 464, 666, 920, 1232, 1608, 2054, 2576, 3180, 3872, 4658, 5544, 6536, 7640, 8862, 10208, 11684, 13296, 15050, 16952, 19008, 21224, 23606, 26160, 28892, 31808, 34914
+};
+TYPE res_test0001[32] = {
+  2, 16, 46, 98, 178, 292, 446, 646, 898, 1208, 1582, 2026, 2546, 3148, 3838, 4622, 5506, 6496, 7598, 8818, 10162, 11636, 13246, 14998, 16898, 18952, 21166, 23546, 26098, 28828, 31742, 34846
+};
+TYPE res_test0010[32] = {
+  -2, -16, -46, -98, -178, -292, -446, -646, -898, -1208, -1582, -2026, -2546, -3148, -3838, -4622, -5506, -6496, -7598, -8818, -10162, -11636, -13246, -14998, -16898, -18952, -21166, -23546, -26098, -28828, -31742, -34846
+};
+TYPE res_test0011[32] = {
+  -8, -24, -56, -110, -192, -308, -464, -666, -920, -1232, -1608, -2054, -2576, -3180, -3872, -4658, -5544, -6536, -7640, -8862, -10208, -11684, -13296, -15050, -16952, -19008, -21224, -23606, -26160, -28892, -31808, -34914
+};
+TYPE res_test0100[32] = {
+  2, 8, 26, 62, 122, 212, 338, 506, 722, 992, 1322, 1718, 2186, 2732, 3362, 4082, 4898, 5816, 6842, 7982, 9242, 10628, 12146, 13802, 15602, 17552, 19658, 21926, 24362, 26972, 29762, 32738
+};
+TYPE res_test0101[32] = {
+  -4, 0, 16, 50, 108, 196, 320, 486, 700, 968, 1296, 1690, 2156, 2700, 3328, 4046, 4860, 5776, 6800, 7938, 9196, 10580, 12096, 13750, 15548, 17496, 19600, 21866, 24300, 26908, 29696, 32670
+};
+TYPE res_test0110[32] = {
+  4, 0, -16, -50, -108, -196, -320, -486, -700, -968, -1296, -1690, -2156, -2700, -3328, -4046, -4860, -5776, -6800, -7938, -9196, -10580, -12096, -13750, -15548, -17496, -19600, -21866, -24300, -26908, -29696, -32670
+};
+TYPE res_test0111[32] = {
+  -2, -8, -26, -62, -122, -212, -338, -506, -722, -992, -1322, -1718, -2186, -2732, -3362, -4082, -4898, -5816, -6842, -7982, -9242, -10628, -12146, -13802, -15602, -17552, -19658, -21926, -24362, -26972, -29762, -32738
+};
+TYPE res_test1000[32] = {
+  4, 0, -16, -50, -108, -196, -320, -486, -700, -968, -1296, -1690, -2156, -2700, -3328, -4046, -4860, -5776, -6800, -7938, -9196, -10580, -12096, -13750, -15548, -17496, -19600, -21866, -24300, -26908, -29696, -32670
+};
+TYPE res_test1001[32] = {
+  -2, -8, -26, -62, -122, -212, -338, -506, -722, -992, -1322, -1718, -2186, -2732, -3362, -4082, -4898, -5816, -6842, -7982, -9242, -10628, -12146, -13802, -15602, -17552, -19658, -21926, -24362, -26972, -29762, -32738
+};
+TYPE res_test1010[32] = {
+  2, 8, 26, 62, 122, 212, 338, 506, 722, 992, 1322, 1718, 2186, 2732, 3362, 4082, 4898, 5816, 6842, 7982, 9242, 10628, 12146, 13802, 15602, 17552, 19658, 21926, 24362, 26972, 29762, 32738
+};
+TYPE res_test1011[32] = {
+  -4, 0, 16, 50, 108, 196, 320, 486, 700, 968, 1296, 1690, 2156, 2700, 3328, 4046, 4860, 5776, 6800, 7938, 9196, 10580, 12096, 13750, 15548, 17496, 19600, 21866, 24300, 26908, 29696, 32670
+};
+TYPE res_test1100[32] = {
+  -2, -16, -46, -98, -178, -292, -446, -646, -898, -1208, -1582, -2026, -2546, -3148, -3838, -4622, -5506, -6496, -7598, -8818, -10162, -11636, -13246, -14998, -16898, -18952, -21166, -23546, -26098, -28828, -31742, -34846
+};
+TYPE res_test1101[32] = {
+  -8, -24, -56, -110, -192, -308, -464, -666, -920, -1232, -1608, -2054, -2576, -3180, -3872, -4658, -5544, -6536, -7640, -8862, -10208, -11684, -13296, -15050, -16952, -19008, -21224, -23606, -26160, -28892, -31808, -34914
+};
+TYPE res_test1110[32] = {
+  8, 24, 56, 110, 192, 308, 464, 666, 920, 1232, 1608, 2054, 2576, 3180, 3872, 4658, 5544, 6536, 7640, 8862, 10208, 11684, 13296, 15050, 16952, 19008, 21224, 23606, 26160, 28892, 31808, 34914
+};
+TYPE res_test1111[32] = {
+  2, 16, 46, 98, 178, 292, 446, 646, 898, 1208, 1582, 2026, 2546, 3148, 3838, 4622, 5506, 6496, 7598, 8818, 10162, 11636, 13246, 14998, 16898, 18952, 21166, 23546, 26098, 28828, 31742, 34846
+};
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_results_3.h b/gcc/testsuite/gcc.target/i386/fma_run_double_results_3.h
new file mode 100644
index 0000000..44cf827
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_results_3.h
@@ -0,0 +1,54 @@
+
+#ifndef fma_run_double_results_3
+#define fma_run_double_results_3
+
+TYPE res_test0000[32] = {
+  11, 32, 71, 134, 227, 356, 527, 746, 1019, 1352, 1751, 2222, 2771, 3404, 4127, 4946, 5867, 6896, 8039, 9302, 10691, 12212, 13871, 15674, 17627, 19736, 22007, 24446, 27059, 29852, 32831, 36002
+};
+TYPE res_test0001[32] = {
+  9, 28, 65, 126, 217, 344, 513, 730, 1001, 1332, 1729, 2198, 2745, 3376, 4097, 4914, 5833, 6860, 8001, 9262, 10649, 12168, 13825, 15626, 17577, 19684, 21953, 24390, 27001, 29792, 32769, 35938
+};
+TYPE res_test0010[32] = {
+  -9, -28, -65, -126, -217, -344, -513, -730, -1001, -1332, -1729, -2198, -2745, -3376, -4097, -4914, -5833, -6860, -8001, -9262, -10649, -12168, -13825, -15626, -17577, -19684, -21953, -24390, -27001, -29792, -32769, -35938
+};
+TYPE res_test0011[32] = {
+  -11, -32, -71, -134, -227, -356, -527, -746, -1019, -1352, -1751, -2222, -2771, -3404, -4127, -4946, -5867, -6896, -8039, -9302, -10691, -12212, -13871, -15674, -17627, -19736, -22007, -24446, -27059, -29852, -32831, -36002
+};
+TYPE res_test0100[32] = {
+  -1, 8, 31, 74, 143, 244, 383, 566, 799, 1088, 1439, 1858, 2351, 2924, 3583, 4334, 5183, 6136, 7199, 8378, 9679, 11108, 12671, 14374, 16223, 18224, 20383, 22706, 25199, 27868, 30719, 33758
+};
+TYPE res_test0101[32] = {
+  -3, 4, 25, 66, 133, 232, 369, 550, 781, 1068, 1417, 1834, 2325, 2896, 3553, 4302, 5149, 6100, 7161, 8338, 9637, 11064, 12625, 14326, 16173, 18172, 20329, 22650, 25141, 27808, 30657, 33694
+};
+TYPE res_test0110[32] = {
+  3, -4, -25, -66, -133, -232, -369, -550, -781, -1068, -1417, -1834, -2325, -2896, -3553, -4302, -5149, -6100, -7161, -8338, -9637, -11064, -12625, -14326, -16173, -18172, -20329, -22650, -25141, -27808, -30657, -33694
+};
+TYPE res_test0111[32] = {
+  1, -8, -31, -74, -143, -244, -383, -566, -799, -1088, -1439, -1858, -2351, -2924, -3583, -4334, -5183, -6136, -7199, -8378, -9679, -11108, -12671, -14374, -16223, -18224, -20383, -22706, -25199, -27868, -30719, -33758
+};
+TYPE res_test1000[32] = {
+  3, -4, -25, -66, -133, -232, -369, -550, -781, -1068, -1417, -1834, -2325, -2896, -3553, -4302, -5149, -6100, -7161, -8338, -9637, -11064, -12625, -14326, -16173, -18172, -20329, -22650, -25141, -27808, -30657, -33694
+};
+TYPE res_test1001[32] = {
+  1, -8, -31, -74, -143, -244, -383, -566, -799, -1088, -1439, -1858, -2351, -2924, -3583, -4334, -5183, -6136, -7199, -8378, -9679, -11108, -12671, -14374, -16223, -18224, -20383, -22706, -25199, -27868, -30719, -33758
+};
+TYPE res_test1010[32] = {
+  -1, 8, 31, 74, 143, 244, 383, 566, 799, 1088, 1439, 1858, 2351, 2924, 3583, 4334, 5183, 6136, 7199, 8378, 9679, 11108, 12671, 14374, 16223, 18224, 20383, 22706, 25199, 27868, 30719, 33758
+};
+TYPE res_test1011[32] = {
+  -3, 4, 25, 66, 133, 232, 369, 550, 781, 1068, 1417, 1834, 2325, 2896, 3553, 4302, 5149, 6100, 7161, 8338, 9637, 11064, 12625, 14326, 16173, 18172, 20329, 22650, 25141, 27808, 30657, 33694
+};
+TYPE res_test1100[32] = {
+  -9, -28, -65, -126, -217, -344, -513, -730, -1001, -1332, -1729, -2198, -2745, -3376, -4097, -4914, -5833, -6860, -8001, -9262, -10649, -12168, -13825, -15626, -17577, -19684, -21953, -24390, -27001, -29792, -32769, -35938
+};
+TYPE res_test1101[32] = {
+  -11, -32, -71, -134, -227, -356, -527, -746, -1019, -1352, -1751, -2222, -2771, -3404, -4127, -4946, -5867, -6896, -8039, -9302, -10691, -12212, -13871, -15674, -17627, -19736, -22007, -24446, -27059, -29852, -32831, -36002
+};
+TYPE res_test1110[32] = {
+  11, 32, 71, 134, 227, 356, 527, 746, 1019, 1352, 1751, 2222, 2771, 3404, 4127, 4946, 5867, 6896, 8039, 9302, 10691, 12212, 13871, 15674, 17627, 19736, 22007, 24446, 27059, 29852, 32831, 36002
+};
+TYPE res_test1111[32] = {
+  9, 28, 65, 126, 217, 344, 513, 730, 1001, 1332, 1729, 2198, 2745, 3376, 4097, 4914, 5833, 6860, 8001, 9262, 10649, 12168, 13825, 15626, 17577, 19684, 21953, 24390, 27001, 29792, 32769, 35938
+};
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_results_4.h b/gcc/testsuite/gcc.target/i386/fma_run_double_results_4.h
new file mode 100644
index 0000000..0b7f857
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_results_4.h
@@ -0,0 +1,54 @@
+
+#ifndef fma_run_double_results_4
+#define fma_run_double_results_4
+
+TYPE res_test0000[32] = {
+  13, 34, 73, 136, 229, 358, 529, 748, 1021, 1354, 1753, 2224, 2773, 3406, 4129, 4948, 5869, 6898, 8041, 9304, 10693, 12214, 13873, 15676, 17629, 19738, 22009, 24448, 27061, 29854, 32833, 36004
+};
+TYPE res_test0001[32] = {
+  7, 26, 63, 124, 215, 342, 511, 728, 999, 1330, 1727, 2196, 2743, 3374, 4095, 4912, 5831, 6858, 7999, 9260, 10647, 12166, 13823, 15624, 17575, 19682, 21951, 24388, 26999, 29790, 32767, 35936
+};
+TYPE res_test0010[32] = {
+  -7, -26, -63, -124, -215, -342, -511, -728, -999, -1330, -1727, -2196, -2743, -3374, -4095, -4912, -5831, -6858, -7999, -9260, -10647, -12166, -13823, -15624, -17575, -19682, -21951, -24388, -26999, -29790, -32767, -35936
+};
+TYPE res_test0011[32] = {
+  -13, -34, -73, -136, -229, -358, -529, -748, -1021, -1354, -1753, -2224, -2773, -3406, -4129, -4948, -5869, -6898, -8041, -9304, -10693, -12214, -13873, -15676, -17629, -19738, -22009, -24448, -27061, -29854, -32833, -36004
+};
+TYPE res_test0100[32] = {
+  1, 10, 33, 76, 145, 246, 385, 568, 801, 1090, 1441, 1860, 2353, 2926, 3585, 4336, 5185, 6138, 7201, 8380, 9681, 11110, 12673, 14376, 16225, 18226, 20385, 22708, 25201, 27870, 30721, 33760
+};
+TYPE res_test0101[32] = {
+  -5, 2, 23, 64, 131, 230, 367, 548, 779, 1066, 1415, 1832, 2323, 2894, 3551, 4300, 5147, 6098, 7159, 8336, 9635, 11062, 12623, 14324, 16171, 18170, 20327, 22648, 25139, 27806, 30655, 33692
+};
+TYPE res_test0110[32] = {
+  5, -2, -23, -64, -131, -230, -367, -548, -779, -1066, -1415, -1832, -2323, -2894, -3551, -4300, -5147, -6098, -7159, -8336, -9635, -11062, -12623, -14324, -16171, -18170, -20327, -22648, -25139, -27806, -30655, -33692
+};
+TYPE res_test0111[32] = {
+  -1, -10, -33, -76, -145, -246, -385, -568, -801, -1090, -1441, -1860, -2353, -2926, -3585, -4336, -5185, -6138, -7201, -8380, -9681, -11110, -12673, -14376, -16225, -18226, -20385, -22708, -25201, -27870, -30721, -33760
+};
+TYPE res_test1000[32] = {
+  5, -2, -23, -64, -131, -230, -367, -548, -779, -1066, -1415, -1832, -2323, -2894, -3551, -4300, -5147, -6098, -7159, -8336, -9635, -11062, -12623, -14324, -16171, -18170, -20327, -22648, -25139, -27806, -30655, -33692
+};
+TYPE res_test1001[32] = {
+  -1, -10, -33, -76, -145, -246, -385, -568, -801, -1090, -1441, -1860, -2353, -2926, -3585, -4336, -5185, -6138, -7201, -8380, -9681, -11110, -12673, -14376, -16225, -18226, -20385, -22708, -25201, -27870, -30721, -33760
+};
+TYPE res_test1010[32] = {
+  1, 10, 33, 76, 145, 246, 385, 568, 801, 1090, 1441, 1860, 2353, 2926, 3585, 4336, 5185, 6138, 7201, 8380, 9681, 11110, 12673, 14376, 16225, 18226, 20385, 22708, 25201, 27870, 30721, 33760
+};
+TYPE res_test1011[32] = {
+  -5, 2, 23, 64, 131, 230, 367, 548, 779, 1066, 1415, 1832, 2323, 2894, 3551, 4300, 5147, 6098, 7159, 8336, 9635, 11062, 12623, 14324, 16171, 18170, 20327, 22648, 25139, 27806, 30655, 33692
+};
+TYPE res_test1100[32] = {
+  -7, -26, -63, -124, -215, -342, -511, -728, -999, -1330, -1727, -2196, -2743, -3374, -4095, -4912, -5831, -6858, -7999, -9260, -10647, -12166, -13823, -15624, -17575, -19682, -21951, -24388, -26999, -29790, -32767, -35936
+};
+TYPE res_test1101[32] = {
+  -13, -34, -73, -136, -229, -358, -529, -748, -1021, -1354, -1753, -2224, -2773, -3406, -4129, -4948, -5869, -6898, -8041, -9304, -10693, -12214, -13873, -15676, -17629, -19738, -22009, -24448, -27061, -29854, -32833, -36004
+};
+TYPE res_test1110[32] = {
+  13, 34, 73, 136, 229, 358, 529, 748, 1021, 1354, 1753, 2224, 2773, 3406, 4129, 4948, 5869, 6898, 8041, 9304, 10693, 12214, 13873, 15676, 17629, 19738, 22009, 24448, 27061, 29854, 32833, 36004
+};
+TYPE res_test1111[32] = {
+  7, 26, 63, 124, 215, 342, 511, 728, 999, 1330, 1727, 2196, 2743, 3374, 4095, 4912, 5831, 6858, 7999, 9260, 10647, 12166, 13823, 15624, 17575, 19682, 21951, 24388, 26999, 29790, 32767, 35936
+};
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_results_5.h b/gcc/testsuite/gcc.target/i386/fma_run_double_results_5.h
new file mode 100644
index 0000000..0f96cad
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_results_5.h
@@ -0,0 +1,54 @@
+
+#ifndef fma_run_double_results_5
+#define fma_run_double_results_5
+
+TYPE res_test0000[32] = {
+  16, 42, 88, 160, 264, 406, 592, 828, 1120, 1474, 1896, 2392, 2968, 3630, 4384, 5236, 6192, 7258, 8440, 9744, 11176, 12742, 14448, 16300, 18304, 20466, 22792, 25288, 27960, 30814, 33856, 37092
+};
+TYPE res_test0001[32] = {
+  14, 38, 82, 152, 254, 394, 578, 812, 1102, 1454, 1874, 2368, 2942, 3602, 4354, 5204, 6158, 7222, 8402, 9704, 11134, 12698, 14402, 16252, 18254, 20414, 22738, 25232, 27902, 30754, 33794, 37028
+};
+TYPE res_test0010[32] = {
+  -14, -38, -82, -152, -254, -394, -578, -812, -1102, -1454, -1874, -2368, -2942, -3602, -4354, -5204, -6158, -7222, -8402, -9704, -11134, -12698, -14402, -16252, -18254, -20414, -22738, -25232, -27902, -30754, -33794, -37028
+};
+TYPE res_test0011[32] = {
+  -16, -42, -88, -160, -264, -406, -592, -828, -1120, -1474, -1896, -2392, -2968, -3630, -4384, -5236, -6192, -7258, -8440, -9744, -11176, -12742, -14448, -16300, -18304, -20466, -22792, -25288, -27960, -30814, -33856, -37092
+};
+TYPE res_test0100[32] = {
+  -2, 10, 38, 88, 166, 278, 430, 628, 878, 1186, 1558, 2000, 2518, 3118, 3806, 4588, 5470, 6458, 7558, 8776, 10118, 11590, 13198, 14948, 16846, 18898, 21110, 23488, 26038, 28766, 31678, 34780
+};
+TYPE res_test0101[32] = {
+  -4, 6, 32, 80, 156, 266, 416, 612, 860, 1166, 1536, 1976, 2492, 3090, 3776, 4556, 5436, 6422, 7520, 8736, 10076, 11546, 13152, 14900, 16796, 18846, 21056, 23432, 25980, 28706, 31616, 34716
+};
+TYPE res_test0110[32] = {
+  4, -6, -32, -80, -156, -266, -416, -612, -860, -1166, -1536, -1976, -2492, -3090, -3776, -4556, -5436, -6422, -7520, -8736, -10076, -11546, -13152, -14900, -16796, -18846, -21056, -23432, -25980, -28706, -31616, -34716
+};
+TYPE res_test0111[32] = {
+  2, -10, -38, -88, -166, -278, -430, -628, -878, -1186, -1558, -2000, -2518, -3118, -3806, -4588, -5470, -6458, -7558, -8776, -10118, -11590, -13198, -14948, -16846, -18898, -21110, -23488, -26038, -28766, -31678, -34780
+};
+TYPE res_test1000[32] = {
+  4, -6, -32, -80, -156, -266, -416, -612, -860, -1166, -1536, -1976, -2492, -3090, -3776, -4556, -5436, -6422, -7520, -8736, -10076, -11546, -13152, -14900, -16796, -18846, -21056, -23432, -25980, -28706, -31616, -34716
+};
+TYPE res_test1001[32] = {
+  2, -10, -38, -88, -166, -278, -430, -628, -878, -1186, -1558, -2000, -2518, -3118, -3806, -4588, -5470, -6458, -7558, -8776, -10118, -11590, -13198, -14948, -16846, -18898, -21110, -23488, -26038, -28766, -31678, -34780
+};
+TYPE res_test1010[32] = {
+  -2, 10, 38, 88, 166, 278, 430, 628, 878, 1186, 1558, 2000, 2518, 3118, 3806, 4588, 5470, 6458, 7558, 8776, 10118, 11590, 13198, 14948, 16846, 18898, 21110, 23488, 26038, 28766, 31678, 34780
+};
+TYPE res_test1011[32] = {
+  -4, 6, 32, 80, 156, 266, 416, 612, 860, 1166, 1536, 1976, 2492, 3090, 3776, 4556, 5436, 6422, 7520, 8736, 10076, 11546, 13152, 14900, 16796, 18846, 21056, 23432, 25980, 28706, 31616, 34716
+};
+TYPE res_test1100[32] = {
+  -14, -38, -82, -152, -254, -394, -578, -812, -1102, -1454, -1874, -2368, -2942, -3602, -4354, -5204, -6158, -7222, -8402, -9704, -11134, -12698, -14402, -16252, -18254, -20414, -22738, -25232, -27902, -30754, -33794, -37028
+};
+TYPE res_test1101[32] = {
+  -16, -42, -88, -160, -264, -406, -592, -828, -1120, -1474, -1896, -2392, -2968, -3630, -4384, -5236, -6192, -7258, -8440, -9744, -11176, -12742, -14448, -16300, -18304, -20466, -22792, -25288, -27960, -30814, -33856, -37092
+};
+TYPE res_test1110[32] = {
+  16, 42, 88, 160, 264, 406, 592, 828, 1120, 1474, 1896, 2392, 2968, 3630, 4384, 5236, 6192, 7258, 8440, 9744, 11176, 12742, 14448, 16300, 18304, 20466, 22792, 25288, 27960, 30814, 33856, 37092
+};
+TYPE res_test1111[32] = {
+  14, 38, 82, 152, 254, 394, 578, 812, 1102, 1454, 1874, 2368, 2942, 3602, 4354, 5204, 6158, 7222, 8402, 9704, 11134, 12698, 14402, 16252, 18254, 20414, 22738, 25232, 27902, 30754, 33794, 37028
+};
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_results_6.h b/gcc/testsuite/gcc.target/i386/fma_run_double_results_6.h
new file mode 100644
index 0000000..29ae925
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_results_6.h
@@ -0,0 +1,54 @@
+
+#ifndef fma_run_double_results_6
+#define fma_run_double_results_6
+
+TYPE res_test0000[32] = {
+  17, 43, 89, 161, 265, 407, 593, 829, 1121, 1475, 1897, 2393, 2969, 3631, 4385, 5237, 6193, 7259, 8441, 9745, 11177, 12743, 14449, 16301, 18305, 20467, 22793, 25289, 27961, 30815, 33857, 37093
+};
+TYPE res_test0001[32] = {
+  13, 37, 81, 151, 253, 393, 577, 811, 1101, 1453, 1873, 2367, 2941, 3601, 4353, 5203, 6157, 7221, 8401, 9703, 11133, 12697, 14401, 16251, 18253, 20413, 22737, 25231, 27901, 30753, 33793, 37027
+};
+TYPE res_test0010[32] = {
+  -13, -37, -81, -151, -253, -393, -577, -811, -1101, -1453, -1873, -2367, -2941, -3601, -4353, -5203, -6157, -7221, -8401, -9703, -11133, -12697, -14401, -16251, -18253, -20413, -22737, -25231, -27901, -30753, -33793, -37027
+};
+TYPE res_test0011[32] = {
+  -17, -43, -89, -161, -265, -407, -593, -829, -1121, -1475, -1897, -2393, -2969, -3631, -4385, -5237, -6193, -7259, -8441, -9745, -11177, -12743, -14449, -16301, -18305, -20467, -22793, -25289, -27961, -30815, -33857, -37093
+};
+TYPE res_test0100[32] = {
+  -1, 11, 39, 89, 167, 279, 431, 629, 879, 1187, 1559, 2001, 2519, 3119, 3807, 4589, 5471, 6459, 7559, 8777, 10119, 11591, 13199, 14949, 16847, 18899, 21111, 23489, 26039, 28767, 31679, 34781
+};
+TYPE res_test0101[32] = {
+  -5, 5, 31, 79, 155, 265, 415, 611, 859, 1165, 1535, 1975, 2491, 3089, 3775, 4555, 5435, 6421, 7519, 8735, 10075, 11545, 13151, 14899, 16795, 18845, 21055, 23431, 25979, 28705, 31615, 34715
+};
+TYPE res_test0110[32] = {
+  5, -5, -31, -79, -155, -265, -415, -611, -859, -1165, -1535, -1975, -2491, -3089, -3775, -4555, -5435, -6421, -7519, -8735, -10075, -11545, -13151, -14899, -16795, -18845, -21055, -23431, -25979, -28705, -31615, -34715
+};
+TYPE res_test0111[32] = {
+  1, -11, -39, -89, -167, -279, -431, -629, -879, -1187, -1559, -2001, -2519, -3119, -3807, -4589, -5471, -6459, -7559, -8777, -10119, -11591, -13199, -14949, -16847, -18899, -21111, -23489, -26039, -28767, -31679, -34781
+};
+TYPE res_test1000[32] = {
+  5, -5, -31, -79, -155, -265, -415, -611, -859, -1165, -1535, -1975, -2491, -3089, -3775, -4555, -5435, -6421, -7519, -8735, -10075, -11545, -13151, -14899, -16795, -18845, -21055, -23431, -25979, -28705, -31615, -34715
+};
+TYPE res_test1001[32] = {
+  1, -11, -39, -89, -167, -279, -431, -629, -879, -1187, -1559, -2001, -2519, -3119, -3807, -4589, -5471, -6459, -7559, -8777, -10119, -11591, -13199, -14949, -16847, -18899, -21111, -23489, -26039, -28767, -31679, -34781
+};
+TYPE res_test1010[32] = {
+  -1, 11, 39, 89, 167, 279, 431, 629, 879, 1187, 1559, 2001, 2519, 3119, 3807, 4589, 5471, 6459, 7559, 8777, 10119, 11591, 13199, 14949, 16847, 18899, 21111, 23489, 26039, 28767, 31679, 34781
+};
+TYPE res_test1011[32] = {
+  -5, 5, 31, 79, 155, 265, 415, 611, 859, 1165, 1535, 1975, 2491, 3089, 3775, 4555, 5435, 6421, 7519, 8735, 10075, 11545, 13151, 14899, 16795, 18845, 21055, 23431, 25979, 28705, 31615, 34715
+};
+TYPE res_test1100[32] = {
+  -13, -37, -81, -151, -253, -393, -577, -811, -1101, -1453, -1873, -2367, -2941, -3601, -4353, -5203, -6157, -7221, -8401, -9703, -11133, -12697, -14401, -16251, -18253, -20413, -22737, -25231, -27901, -30753, -33793, -37027
+};
+TYPE res_test1101[32] = {
+  -17, -43, -89, -161, -265, -407, -593, -829, -1121, -1475, -1897, -2393, -2969, -3631, -4385, -5237, -6193, -7259, -8441, -9745, -11177, -12743, -14449, -16301, -18305, -20467, -22793, -25289, -27961, -30815, -33857, -37093
+};
+TYPE res_test1110[32] = {
+  17, 43, 89, 161, 265, 407, 593, 829, 1121, 1475, 1897, 2393, 2969, 3631, 4385, 5237, 6193, 7259, 8441, 9745, 11177, 12743, 14449, 16301, 18305, 20467, 22793, 25289, 27961, 30815, 33857, 37093
+};
+TYPE res_test1111[32] = {
+  13, 37, 81, 151, 253, 393, 577, 811, 1101, 1453, 1873, 2367, 2941, 3601, 4353, 5203, 6157, 7221, 8401, 9703, 11133, 12697, 14401, 16251, 18253, 20413, 22737, 25231, 27901, 30753, 33793, 37027
+};
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_1.c b/gcc/testsuite/gcc.target/i386/fma_run_float_1.c
new file mode 100644
index 0000000..1ca34af
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_1.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "fma_1.h"
+
+#include "fma_run_float_results_1.h"
+
+#include "fma-check.h"
+#include "fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_2.c b/gcc/testsuite/gcc.target/i386/fma_run_float_2.c
new file mode 100644
index 0000000..380fd3b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_2.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "fma_2.h"
+
+#include "fma_run_float_results_2.h"
+
+#include "fma-check.h"
+#include "fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_3.c b/gcc/testsuite/gcc.target/i386/fma_run_float_3.c
new file mode 100644
index 0000000..0b09056
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_3.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "fma_3.h"
+
+#include "fma_run_float_results_3.h"
+
+#include "fma-check.h"
+#include "fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_4.c b/gcc/testsuite/gcc.target/i386/fma_run_float_4.c
new file mode 100644
index 0000000..e44a62c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_4.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "fma_4.h"
+
+#include "fma_run_float_results_4.h"
+
+#include "fma-check.h"
+#include "fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_5.c b/gcc/testsuite/gcc.target/i386/fma_run_float_5.c
new file mode 100644
index 0000000..10c4f2b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_5.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "fma_5.h"
+
+#include "fma_run_float_results_5.h"
+
+#include "fma-check.h"
+#include "fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_6.c b/gcc/testsuite/gcc.target/i386/fma_run_float_6.c
new file mode 100644
index 0000000..95c44a1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_6.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "fma_6.h"
+
+#include "fma_run_float_results_6.h"
+
+#include "fma-check.h"
+#include "fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_results_1.h b/gcc/testsuite/gcc.target/i386/fma_run_float_results_1.h
new file mode 100644
index 0000000..65f52f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_results_1.h
@@ -0,0 +1,54 @@
+
+#ifndef fma_run_float_results_1
+#define fma_run_float_results_1
+
+TYPE res_test0000[32] = {
+  7, 23, 55, 109, 191, 307, 463, 665, 919, 1231, 1607, 2053, 2575, 3179, 3871, 4657, 5543, 6535, 7639, 8861, 10207, 11683, 13295, 15049, 16951, 19007, 21223, 23605, 26159, 28891, 31807, 34913
+};
+TYPE res_test0001[32] = {
+  3, 17, 47, 99, 179, 293, 447, 647, 899, 1209, 1583, 2027, 2547, 3149, 3839, 4623, 5507, 6497, 7599, 8819, 10163, 11637, 13247, 14999, 16899, 18953, 21167, 23547, 26099, 28829, 31743, 34847
+};
+TYPE res_test0010[32] = {
+  -3, -17, -47, -99, -179, -293, -447, -647, -899, -1209, -1583, -2027, -2547, -3149, -3839, -4623, -5507, -6497, -7599, -8819, -10163, -11637, -13247, -14999, -16899, -18953, -21167, -23547, -26099, -28829, -31743, -34847
+};
+TYPE res_test0011[32] = {
+  -7, -23, -55, -109, -191, -307, -463, -665, -919, -1231, -1607, -2053, -2575, -3179, -3871, -4657, -5543, -6535, -7639, -8861, -10207, -11683, -13295, -15049, -16951, -19007, -21223, -23605, -26159, -28891, -31807, -34913
+};
+TYPE res_test0100[32] = {
+  1, 7, 25, 61, 121, 211, 337, 505, 721, 991, 1321, 1717, 2185, 2731, 3361, 4081, 4897, 5815, 6841, 7981, 9241, 10627, 12145, 13801, 15601, 17551, 19657, 21925, 24361, 26971, 29761, 32737
+};
+TYPE res_test0101[32] = {
+  -3, 1, 17, 51, 109, 197, 321, 487, 701, 969, 1297, 1691, 2157, 2701, 3329, 4047, 4861, 5777, 6801, 7939, 9197, 10581, 12097, 13751, 15549, 17497, 19601, 21867, 24301, 26909, 29697, 32671
+};
+TYPE res_test0110[32] = {
+  3, -1, -17, -51, -109, -197, -321, -487, -701, -969, -1297, -1691, -2157, -2701, -3329, -4047, -4861, -5777, -6801, -7939, -9197, -10581, -12097, -13751, -15549, -17497, -19601, -21867, -24301, -26909, -29697, -32671
+};
+TYPE res_test0111[32] = {
+  -1, -7, -25, -61, -121, -211, -337, -505, -721, -991, -1321, -1717, -2185, -2731, -3361, -4081, -4897, -5815, -6841, -7981, -9241, -10627, -12145, -13801, -15601, -17551, -19657, -21925, -24361, -26971, -29761, -32737
+};
+TYPE res_test1000[32] = {
+  3, -1, -17, -51, -109, -197, -321, -487, -701, -969, -1297, -1691, -2157, -2701, -3329, -4047, -4861, -5777, -6801, -7939, -9197, -10581, -12097, -13751, -15549, -17497, -19601, -21867, -24301, -26909, -29697, -32671
+};
+TYPE res_test1001[32] = {
+  -1, -7, -25, -61, -121, -211, -337, -505, -721, -991, -1321, -1717, -2185, -2731, -3361, -4081, -4897, -5815, -6841, -7981, -9241, -10627, -12145, -13801, -15601, -17551, -19657, -21925, -24361, -26971, -29761, -32737
+};
+TYPE res_test1010[32] = {
+  1, 7, 25, 61, 121, 211, 337, 505, 721, 991, 1321, 1717, 2185, 2731, 3361, 4081, 4897, 5815, 6841, 7981, 9241, 10627, 12145, 13801, 15601, 17551, 19657, 21925, 24361, 26971, 29761, 32737
+};
+TYPE res_test1011[32] = {
+  -3, 1, 17, 51, 109, 197, 321, 487, 701, 969, 1297, 1691, 2157, 2701, 3329, 4047, 4861, 5777, 6801, 7939, 9197, 10581, 12097, 13751, 15549, 17497, 19601, 21867, 24301, 26909, 29697, 32671
+};
+TYPE res_test1100[32] = {
+  -3, -17, -47, -99, -179, -293, -447, -647, -899, -1209, -1583, -2027, -2547, -3149, -3839, -4623, -5507, -6497, -7599, -8819, -10163, -11637, -13247, -14999, -16899, -18953, -21167, -23547, -26099, -28829, -31743, -34847
+};
+TYPE res_test1101[32] = {
+  -7, -23, -55, -109, -191, -307, -463, -665, -919, -1231, -1607, -2053, -2575, -3179, -3871, -4657, -5543, -6535, -7639, -8861, -10207, -11683, -13295, -15049, -16951, -19007, -21223, -23605, -26159, -28891, -31807, -34913
+};
+TYPE res_test1110[32] = {
+  7, 23, 55, 109, 191, 307, 463, 665, 919, 1231, 1607, 2053, 2575, 3179, 3871, 4657, 5543, 6535, 7639, 8861, 10207, 11683, 13295, 15049, 16951, 19007, 21223, 23605, 26159, 28891, 31807, 34913
+};
+TYPE res_test1111[32] = {
+  3, 17, 47, 99, 179, 293, 447, 647, 899, 1209, 1583, 2027, 2547, 3149, 3839, 4623, 5507, 6497, 7599, 8819, 10163, 11637, 13247, 14999, 16899, 18953, 21167, 23547, 26099, 28829, 31743, 34847
+};
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_results_2.h b/gcc/testsuite/gcc.target/i386/fma_run_float_results_2.h
new file mode 100644
index 0000000..d215efd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_results_2.h
@@ -0,0 +1,54 @@
+
+#ifndef fma_run_float_results_2
+#define fma_run_float_results_2
+
+TYPE res_test0000[32] = {
+  8, 24, 56, 110, 192, 308, 464, 666, 920, 1232, 1608, 2054, 2576, 3180, 3872, 4658, 5544, 6536, 7640, 8862, 10208, 11684, 13296, 15050, 16952, 19008, 21224, 23606, 26160, 28892, 31808, 34914
+};
+TYPE res_test0001[32] = {
+  2, 16, 46, 98, 178, 292, 446, 646, 898, 1208, 1582, 2026, 2546, 3148, 3838, 4622, 5506, 6496, 7598, 8818, 10162, 11636, 13246, 14998, 16898, 18952, 21166, 23546, 26098, 28828, 31742, 34846
+};
+TYPE res_test0010[32] = {
+  -2, -16, -46, -98, -178, -292, -446, -646, -898, -1208, -1582, -2026, -2546, -3148, -3838, -4622, -5506, -6496, -7598, -8818, -10162, -11636, -13246, -14998, -16898, -18952, -21166, -23546, -26098, -28828, -31742, -34846
+};
+TYPE res_test0011[32] = {
+  -8, -24, -56, -110, -192, -308, -464, -666, -920, -1232, -1608, -2054, -2576, -3180, -3872, -4658, -5544, -6536, -7640, -8862, -10208, -11684, -13296, -15050, -16952, -19008, -21224, -23606, -26160, -28892, -31808, -34914
+};
+TYPE res_test0100[32] = {
+  2, 8, 26, 62, 122, 212, 338, 506, 722, 992, 1322, 1718, 2186, 2732, 3362, 4082, 4898, 5816, 6842, 7982, 9242, 10628, 12146, 13802, 15602, 17552, 19658, 21926, 24362, 26972, 29762, 32738
+};
+TYPE res_test0101[32] = {
+  -4, 0, 16, 50, 108, 196, 320, 486, 700, 968, 1296, 1690, 2156, 2700, 3328, 4046, 4860, 5776, 6800, 7938, 9196, 10580, 12096, 13750, 15548, 17496, 19600, 21866, 24300, 26908, 29696, 32670
+};
+TYPE res_test0110[32] = {
+  4, 0, -16, -50, -108, -196, -320, -486, -700, -968, -1296, -1690, -2156, -2700, -3328, -4046, -4860, -5776, -6800, -7938, -9196, -10580, -12096, -13750, -15548, -17496, -19600, -21866, -24300, -26908, -29696, -32670
+};
+TYPE res_test0111[32] = {
+  -2, -8, -26, -62, -122, -212, -338, -506, -722, -992, -1322, -1718, -2186, -2732, -3362, -4082, -4898, -5816, -6842, -7982, -9242, -10628, -12146, -13802, -15602, -17552, -19658, -21926, -24362, -26972, -29762, -32738
+};
+TYPE res_test1000[32] = {
+  4, 0, -16, -50, -108, -196, -320, -486, -700, -968, -1296, -1690, -2156, -2700, -3328, -4046, -4860, -5776, -6800, -7938, -9196, -10580, -12096, -13750, -15548, -17496, -19600, -21866, -24300, -26908, -29696, -32670
+};
+TYPE res_test1001[32] = {
+  -2, -8, -26, -62, -122, -212, -338, -506, -722, -992, -1322, -1718, -2186, -2732, -3362, -4082, -4898, -5816, -6842, -7982, -9242, -10628, -12146, -13802, -15602, -17552, -19658, -21926, -24362, -26972, -29762, -32738
+};
+TYPE res_test1010[32] = {
+  2, 8, 26, 62, 122, 212, 338, 506, 722, 992, 1322, 1718, 2186, 2732, 3362, 4082, 4898, 5816, 6842, 7982, 9242, 10628, 12146, 13802, 15602, 17552, 19658, 21926, 24362, 26972, 29762, 32738
+};
+TYPE res_test1011[32] = {
+  -4, 0, 16, 50, 108, 196, 320, 486, 700, 968, 1296, 1690, 2156, 2700, 3328, 4046, 4860, 5776, 6800, 7938, 9196, 10580, 12096, 13750, 15548, 17496, 19600, 21866, 24300, 26908, 29696, 32670
+};
+TYPE res_test1100[32] = {
+  -2, -16, -46, -98, -178, -292, -446, -646, -898, -1208, -1582, -2026, -2546, -3148, -3838, -4622, -5506, -6496, -7598, -8818, -10162, -11636, -13246, -14998, -16898, -18952, -21166, -23546, -26098, -28828, -31742, -34846
+};
+TYPE res_test1101[32] = {
+  -8, -24, -56, -110, -192, -308, -464, -666, -920, -1232, -1608, -2054, -2576, -3180, -3872, -4658, -5544, -6536, -7640, -8862, -10208, -11684, -13296, -15050, -16952, -19008, -21224, -23606, -26160, -28892, -31808, -34914
+};
+TYPE res_test1110[32] = {
+  8, 24, 56, 110, 192, 308, 464, 666, 920, 1232, 1608, 2054, 2576, 3180, 3872, 4658, 5544, 6536, 7640, 8862, 10208, 11684, 13296, 15050, 16952, 19008, 21224, 23606, 26160, 28892, 31808, 34914
+};
+TYPE res_test1111[32] = {
+  2, 16, 46, 98, 178, 292, 446, 646, 898, 1208, 1582, 2026, 2546, 3148, 3838, 4622, 5506, 6496, 7598, 8818, 10162, 11636, 13246, 14998, 16898, 18952, 21166, 23546, 26098, 28828, 31742, 34846
+};
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_results_3.h b/gcc/testsuite/gcc.target/i386/fma_run_float_results_3.h
new file mode 100644
index 0000000..11751f1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_results_3.h
@@ -0,0 +1,54 @@
+
+#ifndef fma_run_float_results_3
+#define fma_run_float_results_3
+
+TYPE res_test0000[32] = {
+  11, 32, 71, 134, 227, 356, 527, 746, 1019, 1352, 1751, 2222, 2771, 3404, 4127, 4946, 5867, 6896, 8039, 9302, 10691, 12212, 13871, 15674, 17627, 19736, 22007, 24446, 27059, 29852, 32831, 36002
+};
+TYPE res_test0001[32] = {
+  9, 28, 65, 126, 217, 344, 513, 730, 1001, 1332, 1729, 2198, 2745, 3376, 4097, 4914, 5833, 6860, 8001, 9262, 10649, 12168, 13825, 15626, 17577, 19684, 21953, 24390, 27001, 29792, 32769, 35938
+};
+TYPE res_test0010[32] = {
+  -9, -28, -65, -126, -217, -344, -513, -730, -1001, -1332, -1729, -2198, -2745, -3376, -4097, -4914, -5833, -6860, -8001, -9262, -10649, -12168, -13825, -15626, -17577, -19684, -21953, -24390, -27001, -29792, -32769, -35938
+};
+TYPE res_test0011[32] = {
+  -11, -32, -71, -134, -227, -356, -527, -746, -1019, -1352, -1751, -2222, -2771, -3404, -4127, -4946, -5867, -6896, -8039, -9302, -10691, -12212, -13871, -15674, -17627, -19736, -22007, -24446, -27059, -29852, -32831, -36002
+};
+TYPE res_test0100[32] = {
+  -1, 8, 31, 74, 143, 244, 383, 566, 799, 1088, 1439, 1858, 2351, 2924, 3583, 4334, 5183, 6136, 7199, 8378, 9679, 11108, 12671, 14374, 16223, 18224, 20383, 22706, 25199, 27868, 30719, 33758
+};
+TYPE res_test0101[32] = {
+  -3, 4, 25, 66, 133, 232, 369, 550, 781, 1068, 1417, 1834, 2325, 2896, 3553, 4302, 5149, 6100, 7161, 8338, 9637, 11064, 12625, 14326, 16173, 18172, 20329, 22650, 25141, 27808, 30657, 33694
+};
+TYPE res_test0110[32] = {
+  3, -4, -25, -66, -133, -232, -369, -550, -781, -1068, -1417, -1834, -2325, -2896, -3553, -4302, -5149, -6100, -7161, -8338, -9637, -11064, -12625, -14326, -16173, -18172, -20329, -22650, -25141, -27808, -30657, -33694
+};
+TYPE res_test0111[32] = {
+  1, -8, -31, -74, -143, -244, -383, -566, -799, -1088, -1439, -1858, -2351, -2924, -3583, -4334, -5183, -6136, -7199, -8378, -9679, -11108, -12671, -14374, -16223, -18224, -20383, -22706, -25199, -27868, -30719, -33758
+};
+TYPE res_test1000[32] = {
+  3, -4, -25, -66, -133, -232, -369, -550, -781, -1068, -1417, -1834, -2325, -2896, -3553, -4302, -5149, -6100, -7161, -8338, -9637, -11064, -12625, -14326, -16173, -18172, -20329, -22650, -25141, -27808, -30657, -33694
+};
+TYPE res_test1001[32] = {
+  1, -8, -31, -74, -143, -244, -383, -566, -799, -1088, -1439, -1858, -2351, -2924, -3583, -4334, -5183, -6136, -7199, -8378, -9679, -11108, -12671, -14374, -16223, -18224, -20383, -22706, -25199, -27868, -30719, -33758
+};
+TYPE res_test1010[32] = {
+  -1, 8, 31, 74, 143, 244, 383, 566, 799, 1088, 1439, 1858, 2351, 2924, 3583, 4334, 5183, 6136, 7199, 8378, 9679, 11108, 12671, 14374, 16223, 18224, 20383, 22706, 25199, 27868, 30719, 33758
+};
+TYPE res_test1011[32] = {
+  -3, 4, 25, 66, 133, 232, 369, 550, 781, 1068, 1417, 1834, 2325, 2896, 3553, 4302, 5149, 6100, 7161, 8338, 9637, 11064, 12625, 14326, 16173, 18172, 20329, 22650, 25141, 27808, 30657, 33694
+};
+TYPE res_test1100[32] = {
+  -9, -28, -65, -126, -217, -344, -513, -730, -1001, -1332, -1729, -2198, -2745, -3376, -4097, -4914, -5833, -6860, -8001, -9262, -10649, -12168, -13825, -15626, -17577, -19684, -21953, -24390, -27001, -29792, -32769, -35938
+};
+TYPE res_test1101[32] = {
+  -11, -32, -71, -134, -227, -356, -527, -746, -1019, -1352, -1751, -2222, -2771, -3404, -4127, -4946, -5867, -6896, -8039, -9302, -10691, -12212, -13871, -15674, -17627, -19736, -22007, -24446, -27059, -29852, -32831, -36002
+};
+TYPE res_test1110[32] = {
+  11, 32, 71, 134, 227, 356, 527, 746, 1019, 1352, 1751, 2222, 2771, 3404, 4127, 4946, 5867, 6896, 8039, 9302, 10691, 12212, 13871, 15674, 17627, 19736, 22007, 24446, 27059, 29852, 32831, 36002
+};
+TYPE res_test1111[32] = {
+  9, 28, 65, 126, 217, 344, 513, 730, 1001, 1332, 1729, 2198, 2745, 3376, 4097, 4914, 5833, 6860, 8001, 9262, 10649, 12168, 13825, 15626, 17577, 19684, 21953, 24390, 27001, 29792, 32769, 35938
+};
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_results_4.h b/gcc/testsuite/gcc.target/i386/fma_run_float_results_4.h
new file mode 100644
index 0000000..13906db
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_results_4.h
@@ -0,0 +1,54 @@
+
+#ifndef fma_run_float_results_4
+#define fma_run_float_results_4
+
+TYPE res_test0000[32] = {
+  13, 34, 73, 136, 229, 358, 529, 748, 1021, 1354, 1753, 2224, 2773, 3406, 4129, 4948, 5869, 6898, 8041, 9304, 10693, 12214, 13873, 15676, 17629, 19738, 22009, 24448, 27061, 29854, 32833, 36004
+};
+TYPE res_test0001[32] = {
+  7, 26, 63, 124, 215, 342, 511, 728, 999, 1330, 1727, 2196, 2743, 3374, 4095, 4912, 5831, 6858, 7999, 9260, 10647, 12166, 13823, 15624, 17575, 19682, 21951, 24388, 26999, 29790, 32767, 35936
+};
+TYPE res_test0010[32] = {
+  -7, -26, -63, -124, -215, -342, -511, -728, -999, -1330, -1727, -2196, -2743, -3374, -4095, -4912, -5831, -6858, -7999, -9260, -10647, -12166, -13823, -15624, -17575, -19682, -21951, -24388, -26999, -29790, -32767, -35936
+};
+TYPE res_test0011[32] = {
+  -13, -34, -73, -136, -229, -358, -529, -748, -1021, -1354, -1753, -2224, -2773, -3406, -4129, -4948, -5869, -6898, -8041, -9304, -10693, -12214, -13873, -15676, -17629, -19738, -22009, -24448, -27061, -29854, -32833, -36004
+};
+TYPE res_test0100[32] = {
+  1, 10, 33, 76, 145, 246, 385, 568, 801, 1090, 1441, 1860, 2353, 2926, 3585, 4336, 5185, 6138, 7201, 8380, 9681, 11110, 12673, 14376, 16225, 18226, 20385, 22708, 25201, 27870, 30721, 33760
+};
+TYPE res_test0101[32] = {
+  -5, 2, 23, 64, 131, 230, 367, 548, 779, 1066, 1415, 1832, 2323, 2894, 3551, 4300, 5147, 6098, 7159, 8336, 9635, 11062, 12623, 14324, 16171, 18170, 20327, 22648, 25139, 27806, 30655, 33692
+};
+TYPE res_test0110[32] = {
+  5, -2, -23, -64, -131, -230, -367, -548, -779, -1066, -1415, -1832, -2323, -2894, -3551, -4300, -5147, -6098, -7159, -8336, -9635, -11062, -12623, -14324, -16171, -18170, -20327, -22648, -25139, -27806, -30655, -33692
+};
+TYPE res_test0111[32] = {
+  -1, -10, -33, -76, -145, -246, -385, -568, -801, -1090, -1441, -1860, -2353, -2926, -3585, -4336, -5185, -6138, -7201, -8380, -9681, -11110, -12673, -14376, -16225, -18226, -20385, -22708, -25201, -27870, -30721, -33760
+};
+TYPE res_test1000[32] = {
+  5, -2, -23, -64, -131, -230, -367, -548, -779, -1066, -1415, -1832, -2323, -2894, -3551, -4300, -5147, -6098, -7159, -8336, -9635, -11062, -12623, -14324, -16171, -18170, -20327, -22648, -25139, -27806, -30655, -33692
+};
+TYPE res_test1001[32] = {
+  -1, -10, -33, -76, -145, -246, -385, -568, -801, -1090, -1441, -1860, -2353, -2926, -3585, -4336, -5185, -6138, -7201, -8380, -9681, -11110, -12673, -14376, -16225, -18226, -20385, -22708, -25201, -27870, -30721, -33760
+};
+TYPE res_test1010[32] = {
+  1, 10, 33, 76, 145, 246, 385, 568, 801, 1090, 1441, 1860, 2353, 2926, 3585, 4336, 5185, 6138, 7201, 8380, 9681, 11110, 12673, 14376, 16225, 18226, 20385, 22708, 25201, 27870, 30721, 33760
+};
+TYPE res_test1011[32] = {
+  -5, 2, 23, 64, 131, 230, 367, 548, 779, 1066, 1415, 1832, 2323, 2894, 3551, 4300, 5147, 6098, 7159, 8336, 9635, 11062, 12623, 14324, 16171, 18170, 20327, 22648, 25139, 27806, 30655, 33692
+};
+TYPE res_test1100[32] = {
+  -7, -26, -63, -124, -215, -342, -511, -728, -999, -1330, -1727, -2196, -2743, -3374, -4095, -4912, -5831, -6858, -7999, -9260, -10647, -12166, -13823, -15624, -17575, -19682, -21951, -24388, -26999, -29790, -32767, -35936
+};
+TYPE res_test1101[32] = {
+  -13, -34, -73, -136, -229, -358, -529, -748, -1021, -1354, -1753, -2224, -2773, -3406, -4129, -4948, -5869, -6898, -8041, -9304, -10693, -12214, -13873, -15676, -17629, -19738, -22009, -24448, -27061, -29854, -32833, -36004
+};
+TYPE res_test1110[32] = {
+  13, 34, 73, 136, 229, 358, 529, 748, 1021, 1354, 1753, 2224, 2773, 3406, 4129, 4948, 5869, 6898, 8041, 9304, 10693, 12214, 13873, 15676, 17629, 19738, 22009, 24448, 27061, 29854, 32833, 36004
+};
+TYPE res_test1111[32] = {
+  7, 26, 63, 124, 215, 342, 511, 728, 999, 1330, 1727, 2196, 2743, 3374, 4095, 4912, 5831, 6858, 7999, 9260, 10647, 12166, 13823, 15624, 17575, 19682, 21951, 24388, 26999, 29790, 32767, 35936
+};
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_results_5.h b/gcc/testsuite/gcc.target/i386/fma_run_float_results_5.h
new file mode 100644
index 0000000..f156bef
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_results_5.h
@@ -0,0 +1,54 @@
+
+#ifndef fma_run_float_results_5
+#define fma_run_float_results_5
+
+TYPE res_test0000[32] = {
+  16, 42, 88, 160, 264, 406, 592, 828, 1120, 1474, 1896, 2392, 2968, 3630, 4384, 5236, 6192, 7258, 8440, 9744, 11176, 12742, 14448, 16300, 18304, 20466, 22792, 25288, 27960, 30814, 33856, 37092
+};
+TYPE res_test0001[32] = {
+  14, 38, 82, 152, 254, 394, 578, 812, 1102, 1454, 1874, 2368, 2942, 3602, 4354, 5204, 6158, 7222, 8402, 9704, 11134, 12698, 14402, 16252, 18254, 20414, 22738, 25232, 27902, 30754, 33794, 37028
+};
+TYPE res_test0010[32] = {
+  -14, -38, -82, -152, -254, -394, -578, -812, -1102, -1454, -1874, -2368, -2942, -3602, -4354, -5204, -6158, -7222, -8402, -9704, -11134, -12698, -14402, -16252, -18254, -20414, -22738, -25232, -27902, -30754, -33794, -37028
+};
+TYPE res_test0011[32] = {
+  -16, -42, -88, -160, -264, -406, -592, -828, -1120, -1474, -1896, -2392, -2968, -3630, -4384, -5236, -6192, -7258, -8440, -9744, -11176, -12742, -14448, -16300, -18304, -20466, -22792, -25288, -27960, -30814, -33856, -37092
+};
+TYPE res_test0100[32] = {
+  -2, 10, 38, 88, 166, 278, 430, 628, 878, 1186, 1558, 2000, 2518, 3118, 3806, 4588, 5470, 6458, 7558, 8776, 10118, 11590, 13198, 14948, 16846, 18898, 21110, 23488, 26038, 28766, 31678, 34780
+};
+TYPE res_test0101[32] = {
+  -4, 6, 32, 80, 156, 266, 416, 612, 860, 1166, 1536, 1976, 2492, 3090, 3776, 4556, 5436, 6422, 7520, 8736, 10076, 11546, 13152, 14900, 16796, 18846, 21056, 23432, 25980, 28706, 31616, 34716
+};
+TYPE res_test0110[32] = {
+  4, -6, -32, -80, -156, -266, -416, -612, -860, -1166, -1536, -1976, -2492, -3090, -3776, -4556, -5436, -6422, -7520, -8736, -10076, -11546, -13152, -14900, -16796, -18846, -21056, -23432, -25980, -28706, -31616, -34716
+};
+TYPE res_test0111[32] = {
+  2, -10, -38, -88, -166, -278, -430, -628, -878, -1186, -1558, -2000, -2518, -3118, -3806, -4588, -5470, -6458, -7558, -8776, -10118, -11590, -13198, -14948, -16846, -18898, -21110, -23488, -26038, -28766, -31678, -34780
+};
+TYPE res_test1000[32] = {
+  4, -6, -32, -80, -156, -266, -416, -612, -860, -1166, -1536, -1976, -2492, -3090, -3776, -4556, -5436, -6422, -7520, -8736, -10076, -11546, -13152, -14900, -16796, -18846, -21056, -23432, -25980, -28706, -31616, -34716
+};
+TYPE res_test1001[32] = {
+  2, -10, -38, -88, -166, -278, -430, -628, -878, -1186, -1558, -2000, -2518, -3118, -3806, -4588, -5470, -6458, -7558, -8776, -10118, -11590, -13198, -14948, -16846, -18898, -21110, -23488, -26038, -28766, -31678, -34780
+};
+TYPE res_test1010[32] = {
+  -2, 10, 38, 88, 166, 278, 430, 628, 878, 1186, 1558, 2000, 2518, 3118, 3806, 4588, 5470, 6458, 7558, 8776, 10118, 11590, 13198, 14948, 16846, 18898, 21110, 23488, 26038, 28766, 31678, 34780
+};
+TYPE res_test1011[32] = {
+  -4, 6, 32, 80, 156, 266, 416, 612, 860, 1166, 1536, 1976, 2492, 3090, 3776, 4556, 5436, 6422, 7520, 8736, 10076, 11546, 13152, 14900, 16796, 18846, 21056, 23432, 25980, 28706, 31616, 34716
+};
+TYPE res_test1100[32] = {
+  -14, -38, -82, -152, -254, -394, -578, -812, -1102, -1454, -1874, -2368, -2942, -3602, -4354, -5204, -6158, -7222, -8402, -9704, -11134, -12698, -14402, -16252, -18254, -20414, -22738, -25232, -27902, -30754, -33794, -37028
+};
+TYPE res_test1101[32] = {
+  -16, -42, -88, -160, -264, -406, -592, -828, -1120, -1474, -1896, -2392, -2968, -3630, -4384, -5236, -6192, -7258, -8440, -9744, -11176, -12742, -14448, -16300, -18304, -20466, -22792, -25288, -27960, -30814, -33856, -37092
+};
+TYPE res_test1110[32] = {
+  16, 42, 88, 160, 264, 406, 592, 828, 1120, 1474, 1896, 2392, 2968, 3630, 4384, 5236, 6192, 7258, 8440, 9744, 11176, 12742, 14448, 16300, 18304, 20466, 22792, 25288, 27960, 30814, 33856, 37092
+};
+TYPE res_test1111[32] = {
+  14, 38, 82, 152, 254, 394, 578, 812, 1102, 1454, 1874, 2368, 2942, 3602, 4354, 5204, 6158, 7222, 8402, 9704, 11134, 12698, 14402, 16252, 18254, 20414, 22738, 25232, 27902, 30754, 33794, 37028
+};
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_results_6.h b/gcc/testsuite/gcc.target/i386/fma_run_float_results_6.h
new file mode 100644
index 0000000..d2c2e1f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_results_6.h
@@ -0,0 +1,54 @@
+
+#ifndef fma_run_float_results_6
+#define fma_run_float_results_6
+
+TYPE res_test0000[32] = {
+  17, 43, 89, 161, 265, 407, 593, 829, 1121, 1475, 1897, 2393, 2969, 3631, 4385, 5237, 6193, 7259, 8441, 9745, 11177, 12743, 14449, 16301, 18305, 20467, 22793, 25289, 27961, 30815, 33857, 37093
+};
+TYPE res_test0001[32] = {
+  13, 37, 81, 151, 253, 393, 577, 811, 1101, 1453, 1873, 2367, 2941, 3601, 4353, 5203, 6157, 7221, 8401, 9703, 11133, 12697, 14401, 16251, 18253, 20413, 22737, 25231, 27901, 30753, 33793, 37027
+};
+TYPE res_test0010[32] = {
+  -13, -37, -81, -151, -253, -393, -577, -811, -1101, -1453, -1873, -2367, -2941, -3601, -4353, -5203, -6157, -7221, -8401, -9703, -11133, -12697, -14401, -16251, -18253, -20413, -22737, -25231, -27901, -30753, -33793, -37027
+};
+TYPE res_test0011[32] = {
+  -17, -43, -89, -161, -265, -407, -593, -829, -1121, -1475, -1897, -2393, -2969, -3631, -4385, -5237, -6193, -7259, -8441, -9745, -11177, -12743, -14449, -16301, -18305, -20467, -22793, -25289, -27961, -30815, -33857, -37093
+};
+TYPE res_test0100[32] = {
+  -1, 11, 39, 89, 167, 279, 431, 629, 879, 1187, 1559, 2001, 2519, 3119, 3807, 4589, 5471, 6459, 7559, 8777, 10119, 11591, 13199, 14949, 16847, 18899, 21111, 23489, 26039, 28767, 31679, 34781
+};
+TYPE res_test0101[32] = {
+  -5, 5, 31, 79, 155, 265, 415, 611, 859, 1165, 1535, 1975, 2491, 3089, 3775, 4555, 5435, 6421, 7519, 8735, 10075, 11545, 13151, 14899, 16795, 18845, 21055, 23431, 25979, 28705, 31615, 34715
+};
+TYPE res_test0110[32] = {
+  5, -5, -31, -79, -155, -265, -415, -611, -859, -1165, -1535, -1975, -2491, -3089, -3775, -4555, -5435, -6421, -7519, -8735, -10075, -11545, -13151, -14899, -16795, -18845, -21055, -23431, -25979, -28705, -31615, -34715
+};
+TYPE res_test0111[32] = {
+  1, -11, -39, -89, -167, -279, -431, -629, -879, -1187, -1559, -2001, -2519, -3119, -3807, -4589, -5471, -6459, -7559, -8777, -10119, -11591, -13199, -14949, -16847, -18899, -21111, -23489, -26039, -28767, -31679, -34781
+};
+TYPE res_test1000[32] = {
+  5, -5, -31, -79, -155, -265, -415, -611, -859, -1165, -1535, -1975, -2491, -3089, -3775, -4555, -5435, -6421, -7519, -8735, -10075, -11545, -13151, -14899, -16795, -18845, -21055, -23431, -25979, -28705, -31615, -34715
+};
+TYPE res_test1001[32] = {
+  1, -11, -39, -89, -167, -279, -431, -629, -879, -1187, -1559, -2001, -2519, -3119, -3807, -4589, -5471, -6459, -7559, -8777, -10119, -11591, -13199, -14949, -16847, -18899, -21111, -23489, -26039, -28767, -31679, -34781
+};
+TYPE res_test1010[32] = {
+  -1, 11, 39, 89, 167, 279, 431, 629, 879, 1187, 1559, 2001, 2519, 3119, 3807, 4589, 5471, 6459, 7559, 8777, 10119, 11591, 13199, 14949, 16847, 18899, 21111, 23489, 26039, 28767, 31679, 34781
+};
+TYPE res_test1011[32] = {
+  -5, 5, 31, 79, 155, 265, 415, 611, 859, 1165, 1535, 1975, 2491, 3089, 3775, 4555, 5435, 6421, 7519, 8735, 10075, 11545, 13151, 14899, 16795, 18845, 21055, 23431, 25979, 28705, 31615, 34715
+};
+TYPE res_test1100[32] = {
+  -13, -37, -81, -151, -253, -393, -577, -811, -1101, -1453, -1873, -2367, -2941, -3601, -4353, -5203, -6157, -7221, -8401, -9703, -11133, -12697, -14401, -16251, -18253, -20413, -22737, -25231, -27901, -30753, -33793, -37027
+};
+TYPE res_test1101[32] = {
+  -17, -43, -89, -161, -265, -407, -593, -829, -1121, -1475, -1897, -2393, -2969, -3631, -4385, -5237, -6193, -7259, -8441, -9745, -11177, -12743, -14449, -16301, -18305, -20467, -22793, -25289, -27961, -30815, -33857, -37093
+};
+TYPE res_test1110[32] = {
+  17, 43, 89, 161, 265, 407, 593, 829, 1121, 1475, 1897, 2393, 2969, 3631, 4385, 5237, 6193, 7259, 8441, 9745, 11177, 12743, 14449, 16301, 18305, 20467, 22793, 25289, 27961, 30815, 33857, 37093
+};
+TYPE res_test1111[32] = {
+  13, 37, 81, 151, 253, 393, 577, 811, 1101, 1453, 1873, 2367, 2941, 3601, 4353, 5203, 6157, 7221, 8401, 9703, 11133, 12697, 14401, 16251, 18253, 20413, 22737, 25231, 27901, 30753, 33793, 37027
+};
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_1.h b/gcc/testsuite/gcc.target/i386/l_fma_1.h
new file mode 100644
index 0000000..09e3376
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_1.h
@@ -0,0 +1,149 @@
+
+#ifndef l_fma_1
+#define l_fma_1
+
+__attribute__((sseregparm))
+void
+test_noneg_add_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) + c[i]) * a[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) + c[i]) * a[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) + c[i]) * a[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) + c[i]) * a[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) - c[i]) * a[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) - c[i]) * a[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) - c[i]) * a[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) - c[i]) * a[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) + c[i]) * a[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) + c[i]) * a[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) + c[i]) * a[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) + c[i]) * a[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) - c[i]) * a[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) - c[i]) * a[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) - c[i]) * a[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) - c[i]) * a[i] - b[i];
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_2.h b/gcc/testsuite/gcc.target/i386/l_fma_2.h
new file mode 100644
index 0000000..dbe30aa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_2.h
@@ -0,0 +1,149 @@
+
+#ifndef l_fma_2
+#define l_fma_2
+
+__attribute__((sseregparm))
+void
+test_noneg_add_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) + c[i]) * a[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) + c[i]) * a[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) + c[i]) * a[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) + c[i]) * a[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) - c[i]) * a[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) - c[i]) * a[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) - c[i]) * a[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) - c[i]) * a[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) + c[i]) * a[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) + c[i]) * a[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) + c[i]) * a[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) + c[i]) * a[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) - c[i]) * a[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) - c[i]) * a[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) - c[i]) * a[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) - c[i]) * a[i] - c[i];
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_3.h b/gcc/testsuite/gcc.target/i386/l_fma_3.h
new file mode 100644
index 0000000..d749693
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_3.h
@@ -0,0 +1,149 @@
+
+#ifndef l_fma_3
+#define l_fma_3
+
+__attribute__((sseregparm))
+void
+test_noneg_add_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) + c[i]) * b[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) + c[i]) * b[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) + c[i]) * b[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) + c[i]) * b[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) - c[i]) * b[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) - c[i]) * b[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) - c[i]) * b[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) - c[i]) * b[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) + c[i]) * b[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) + c[i]) * b[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) + c[i]) * b[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) + c[i]) * b[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) - c[i]) * b[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) - c[i]) * b[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) - c[i]) * b[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) - c[i]) * b[i] - a[i];
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_4.h b/gcc/testsuite/gcc.target/i386/l_fma_4.h
new file mode 100644
index 0000000..c96b53a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_4.h
@@ -0,0 +1,149 @@
+
+#ifndef l_fma_4
+#define l_fma_4
+
+__attribute__((sseregparm))
+void
+test_noneg_add_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) + c[i]) * b[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) + c[i]) * b[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) + c[i]) * b[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) + c[i]) * b[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) - c[i]) * b[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) - c[i]) * b[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) - c[i]) * b[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) - c[i]) * b[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) + c[i]) * b[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) + c[i]) * b[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) + c[i]) * b[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) + c[i]) * b[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) - c[i]) * b[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) - c[i]) * b[i] - c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) - c[i]) * b[i] + c[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) - c[i]) * b[i] - c[i];
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_5.h b/gcc/testsuite/gcc.target/i386/l_fma_5.h
new file mode 100644
index 0000000..7b12b16
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_5.h
@@ -0,0 +1,149 @@
+
+#ifndef l_fma_5
+#define l_fma_5
+
+__attribute__((sseregparm))
+void
+test_noneg_add_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) + c[i]) * c[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) + c[i]) * c[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) + c[i]) * c[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) + c[i]) * c[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) - c[i]) * c[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) - c[i]) * c[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) - c[i]) * c[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) - c[i]) * c[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) + c[i]) * c[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) + c[i]) * c[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) + c[i]) * c[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) + c[i]) * c[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) - c[i]) * c[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) - c[i]) * c[i] - a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) - c[i]) * c[i] + a[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) - c[i]) * c[i] - a[i];
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_6.h b/gcc/testsuite/gcc.target/i386/l_fma_6.h
new file mode 100644
index 0000000..5ccc00a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_6.h
@@ -0,0 +1,149 @@
+
+#ifndef l_fma_6
+#define l_fma_6
+
+__attribute__((sseregparm))
+void
+test_noneg_add_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) + c[i]) * c[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) + c[i]) * c[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) + c[i]) * c[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_add_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) + c[i]) * c[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) - c[i]) * c[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = ((a[i] * b[i]) - c[i]) * c[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) - c[i]) * c[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_noneg_sub_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -((a[i] * b[i]) - c[i]) * c[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) + c[i]) * c[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) + c[i]) * c[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) + c[i]) * c[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_add_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) + c[i]) * c[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_noneg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) - c[i]) * c[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_noneg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = (-(a[i] * b[i]) - c[i]) * c[i] - b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_neg_add (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) - c[i]) * c[i] + b[i];
+}
+
+__attribute__((sseregparm))
+void
+test_neg_sub_neg_sub (TYPE *a, TYPE *b, TYPE *c, TYPE *d, int n)
+{
+  int i;
+  for (i = 0; i < n; i++)
+    d[i] = -(-(a[i] * b[i]) - c[i]) * c[i] - b[i];
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_1.c b/gcc/testsuite/gcc.target/i386/l_fma_double_1.c
new file mode 100644
index 0000000..60059bb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_1.c
@@ -0,0 +1,30 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+/* { dg-options "-O3 -mfma" } */
+
+
+#define TYPE double
+
+#include "l_fma_1.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd231pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub132pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub231pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd231pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub231pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd213sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub213sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd213sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub213sd" 4  } } */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_2.c b/gcc/testsuite/gcc.target/i386/l_fma_double_2.c
new file mode 100644
index 0000000..cc85b14
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_2.c
@@ -0,0 +1,22 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+/* { dg-options "-O3 -mfma" } */
+
+
+#define TYPE double
+
+#include "l_fma_2.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132sd" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_3.c b/gcc/testsuite/gcc.target/i386/l_fma_double_3.c
new file mode 100644
index 0000000..b5ff311
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_3.c
@@ -0,0 +1,30 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+/* { dg-options "-O3 -mfma" } */
+
+
+#define TYPE double
+
+#include "l_fma_3.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd231pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub132pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub231pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd231pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub231pd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd213sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub213sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd213sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132sd" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub213sd" 4  } } */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_4.c b/gcc/testsuite/gcc.target/i386/l_fma_double_4.c
new file mode 100644
index 0000000..199a741
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_4.c
@@ -0,0 +1,22 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+/* { dg-options "-O3 -mfma" } */
+
+
+#define TYPE double
+
+#include "l_fma_4.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132sd" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_5.c b/gcc/testsuite/gcc.target/i386/l_fma_double_5.c
new file mode 100644
index 0000000..cfc5b60
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_5.c
@@ -0,0 +1,22 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+/* { dg-options "-O3 -mfma" } */
+
+
+#define TYPE double
+
+#include "l_fma_5.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132sd" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_6.c b/gcc/testsuite/gcc.target/i386/l_fma_double_6.c
new file mode 100644
index 0000000..0f98824
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_6.c
@@ -0,0 +1,22 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+/* { dg-options "-O3 -mfma" } */
+
+
+#define TYPE double
+
+#include "l_fma_6.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132pd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132sd" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132sd" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_1.c b/gcc/testsuite/gcc.target/i386/l_fma_float_1.c
new file mode 100644
index 0000000..12d2c0b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_1.c
@@ -0,0 +1,30 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+/* { dg-options "-O3 -mfma" } */
+
+
+#define TYPE float
+
+#include "l_fma_1.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd231ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub231ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd231ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub231ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd213ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub213ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd213ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub213ss" 4  } } */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_2.c b/gcc/testsuite/gcc.target/i386/l_fma_float_2.c
new file mode 100644
index 0000000..19ddfd4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_2.c
@@ -0,0 +1,22 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+/* { dg-options "-O3 -mfma" } */
+
+
+#define TYPE float
+
+#include "l_fma_2.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ss" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_3.c b/gcc/testsuite/gcc.target/i386/l_fma_float_3.c
new file mode 100644
index 0000000..03c1743
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_3.c
@@ -0,0 +1,30 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+/* { dg-options "-O3 -mfma" } */
+
+
+#define TYPE float
+
+#include "l_fma_3.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd231ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub231ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd231ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub231ps" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfmadd213ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfmsub213ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmadd213ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ss" 4  } } */
+/* { dg-final { scan-assembler-times "vfnmsub213ss" 4  } } */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_4.c b/gcc/testsuite/gcc.target/i386/l_fma_float_4.c
new file mode 100644
index 0000000..9b3f735
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_4.c
@@ -0,0 +1,22 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+/* { dg-options "-O3 -mfma" } */
+
+
+#define TYPE float
+
+#include "l_fma_4.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ss" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_5.c b/gcc/testsuite/gcc.target/i386/l_fma_float_5.c
new file mode 100644
index 0000000..773980c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_5.c
@@ -0,0 +1,22 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+/* { dg-options "-O3 -mfma" } */
+
+
+#define TYPE float
+
+#include "l_fma_5.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ss" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_6.c b/gcc/testsuite/gcc.target/i386/l_fma_float_6.c
new file mode 100644
index 0000000..7976d4c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_6.c
@@ -0,0 +1,22 @@
+/* { dg-do compile */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-options "-O2 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+/* { dg-options "-O3 -mfma" } */
+
+
+#define TYPE float
+
+#include "l_fma_6.h"
+
+/* { dg-final { scan-assembler-times "vfmadd132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ps" 8  } } */
+/* { dg-final { scan-assembler-times "vfmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfmsub132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmadd132ss" 8  } } */
+/* { dg-final { scan-assembler-times "vfnmsub132ss" 8  } } */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_main.h b/gcc/testsuite/gcc.target/i386/l_fma_main.h
new file mode 100644
index 0000000..a9dc5cd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_main.h
@@ -0,0 +1,100 @@
+
+#ifndef l_fma_main
+#define l_fma_main
+
+#if DEBUG
+#include <stdio.h>
+#endif
+
+TYPE m1[32] = {
+		1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
+	       17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32
+	      };
+TYPE m2[32] = {
+		2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17,
+	       18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33
+	      };
+TYPE m3[32] = {
+		3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 
+	       19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
+	      };
+TYPE m4[32];
+int test_fails = 0;
+
+void
+compare_result(char *title, TYPE *res)
+{
+  int i;
+  int good = 1;
+  for (i =0; i < 32; i++)
+    if (m4[i] != res[i])
+      {
+        if (good)
+          {
+#if DEBUG
+             printf ("!!!! %s miscompare\n", title);
+#endif
+             good = 0;
+          }
+#if DEBUG
+        printf ("res[%d] = %d, must be %d\n", i, (int)res[i], (int) m4[i]);
+#endif
+      }
+  if (!good)
+    test_fails = 1;
+}
+
+static void fma_test ()
+{
+  test_noneg_add_noneg_add (m1, m2, m3, m4, 32);
+  compare_result ("test0000", res_test0000);
+
+  test_noneg_add_noneg_sub (m1, m2, m3, m4, 32);
+  compare_result ("test0001", res_test0001);
+
+  test_noneg_add_neg_add (m1, m2, m3, m4, 32);
+  compare_result ("test0010", res_test0010);
+
+  test_noneg_add_neg_sub (m1, m2, m3, m4, 32);
+  compare_result ("test0011", res_test0011);
+
+  test_noneg_sub_noneg_add (m1, m2, m3, m4, 32);
+  compare_result ("test0100", res_test0100);
+
+  test_noneg_sub_noneg_sub (m1, m2, m3, m4, 32);
+  compare_result ("test0101", res_test0101);
+
+  test_noneg_sub_neg_add (m1, m2, m3, m4, 32);
+  compare_result ("test0110", res_test0110);
+
+  test_noneg_sub_neg_sub (m1, m2, m3, m4, 32);
+  compare_result ("test0111", res_test0111);
+
+  test_neg_add_noneg_add (m1, m2, m3, m4, 32);
+  compare_result ("test1000", res_test1000);
+
+  test_neg_add_noneg_sub (m1, m2, m3, m4, 32);
+  compare_result ("test1001", res_test1001);
+
+  test_neg_add_neg_add (m1, m2, m3, m4, 32);
+  compare_result ("test1010", res_test1010);
+
+  test_neg_add_neg_sub (m1, m2, m3, m4, 32);
+  compare_result ("test1011", res_test1011);
+
+  test_neg_sub_noneg_add (m1, m2, m3, m4, 32);
+  compare_result ("test1100", res_test1100);
+
+  test_neg_sub_noneg_sub (m1, m2, m3, m4, 32);
+  compare_result ("test1101", res_test1101);
+
+  test_neg_sub_neg_add (m1, m2, m3, m4, 32);
+  compare_result ("test1110", res_test1110);
+
+  test_neg_sub_neg_sub (m1, m2, m3, m4, 32);
+  compare_result ("test1111", res_test1111);
+
+  if (test_fails) abort ();
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_run_double_1.c b/gcc/testsuite/gcc.target/i386/l_fma_run_double_1.c
new file mode 100644
index 0000000..86f74d4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_1.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "l_fma_1.h"
+
+#include "fma_run_double_results_1.h"
+
+#include "fma-check.h"
+#include "l_fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_run_double_2.c b/gcc/testsuite/gcc.target/i386/l_fma_run_double_2.c
new file mode 100644
index 0000000..1f512d2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_2.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "l_fma_2.h"
+
+#include "fma_run_double_results_2.h"
+
+#include "fma-check.h"
+#include "l_fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_run_double_3.c b/gcc/testsuite/gcc.target/i386/l_fma_run_double_3.c
new file mode 100644
index 0000000..b7710e0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_3.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "l_fma_3.h"
+
+#include "fma_run_double_results_3.h"
+
+#include "fma-check.h"
+#include "l_fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_run_double_4.c b/gcc/testsuite/gcc.target/i386/l_fma_run_double_4.c
new file mode 100644
index 0000000..1a0ec54
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_4.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "l_fma_4.h"
+
+#include "fma_run_double_results_4.h"
+
+#include "fma-check.h"
+#include "l_fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_run_double_5.c b/gcc/testsuite/gcc.target/i386/l_fma_run_double_5.c
new file mode 100644
index 0000000..f0581c8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_5.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "l_fma_5.h"
+
+#include "fma_run_double_results_5.h"
+
+#include "fma-check.h"
+#include "l_fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_run_double_6.c b/gcc/testsuite/gcc.target/i386/l_fma_run_double_6.c
new file mode 100644
index 0000000..981043c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_6.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE double
+
+#include "l_fma_6.h"
+
+#include "fma_run_double_results_6.h"
+
+#include "fma-check.h"
+#include "l_fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_run_float_1.c b/gcc/testsuite/gcc.target/i386/l_fma_run_float_1.c
new file mode 100644
index 0000000..36d658d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_1.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "l_fma_1.h"
+
+#include "fma_run_float_results_1.h"
+
+#include "fma-check.h"
+#include "l_fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_run_float_2.c b/gcc/testsuite/gcc.target/i386/l_fma_run_float_2.c
new file mode 100644
index 0000000..7c6d376
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_2.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "l_fma_2.h"
+
+#include "fma_run_float_results_2.h"
+
+#include "fma-check.h"
+#include "l_fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_run_float_3.c b/gcc/testsuite/gcc.target/i386/l_fma_run_float_3.c
new file mode 100644
index 0000000..a94b562
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_3.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "l_fma_3.h"
+
+#include "fma_run_float_results_3.h"
+
+#include "fma-check.h"
+#include "l_fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_run_float_4.c b/gcc/testsuite/gcc.target/i386/l_fma_run_float_4.c
new file mode 100644
index 0000000..c6d51f8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_4.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "l_fma_4.h"
+
+#include "fma_run_float_results_4.h"
+
+#include "fma-check.h"
+#include "l_fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_run_float_5.c b/gcc/testsuite/gcc.target/i386/l_fma_run_float_5.c
new file mode 100644
index 0000000..ad90804
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_5.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "l_fma_5.h"
+
+#include "fma_run_float_results_5.h"
+
+#include "fma-check.h"
+#include "l_fma_main.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_run_float_6.c b/gcc/testsuite/gcc.target/i386/l_fma_run_float_6.c
new file mode 100644
index 0000000..0bd8103
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_6.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#define TYPE float
+
+#include "l_fma_6.h"
+
+#include "fma_run_float_results_6.h"
+
+#include "fma-check.h"
+#include "l_fma_main.h"
