public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
@ 2011-10-05 11:16 Kirill Yukhin
  2011-10-05 18:51 ` Uros Bizjak
  0 siblings, 1 reply; 24+ messages in thread
From: Kirill Yukhin @ 2011-10-05 11:16 UTC (permalink / raw)
  To: gcc-patches List; +Cc: Uros Bizjak, H.J. Lu, vbyakovl23

[-- Attachment #1: Type: text/plain, Size: 3818 bytes --]

Hi guys,
We're prepared and bunch of tests which checks autogeneration of FMA3
instructions family.
FMA3 typo in .md file is fixed as well (it was catched by tests).

ChangeLog entry:

2011-10-04  Kirill Yukhin <kirill.yukhin@intel.com>
	    Yakovlev Vladimir <vladimir.b.yakovlev@intel.com>

	* config/i386/sse.md (fma_fnmsub_<mode>): Fix a typo.

testsuite/ChangeLog entry:

2011-10-04  Kirill Yukhin <kirill.yukhin@intel.com>
	    Yakovlev Vladimir <vladimir.b.yakovlev@intel.com>

	* gcc.target/i386/fma_1.h: New test.
	* gcc.target/i386/fma_2.h: Ditto.
	* gcc.target/i386/fma_3.h: Ditto.
	* gcc.target/i386/fma_4.h: Ditto.
	* gcc.target/i386/fma_5.h: Ditto.
	* gcc.target/i386/fma_6.h: Ditto.
	* gcc.target/i386/fma_double_1.c: Ditto.
	* gcc.target/i386/fma_double_2.c: Ditto.
	* gcc.target/i386/fma_double_3.c: Ditto.
	* gcc.target/i386/fma_double_4.c: Ditto.
	* gcc.target/i386/fma_double_5.c: Ditto.
	* gcc.target/i386/fma_double_6.c: Ditto.
	* gcc.target/i386/fma_float_1.c: Ditto.
	* gcc.target/i386/fma_float_2.c: Ditto.
	* gcc.target/i386/fma_float_3.c: Ditto.
	* gcc.target/i386/fma_float_4.c: Ditto.
	* gcc.target/i386/fma_float_5.c: Ditto.
	* gcc.target/i386/fma_float_6.c: Ditto.
	* gcc.target/i386/fma_main.h: Ditto.
	* gcc.target/i386/fma_run_double_1.c: Ditto.
	* gcc.target/i386/fma_run_double_2.c: Ditto.
	* gcc.target/i386/fma_run_double_3.c: Ditto.
	* gcc.target/i386/fma_run_double_4.c: Ditto.
	* gcc.target/i386/fma_run_double_5.c: Ditto.
	* gcc.target/i386/fma_run_double_6.c: Ditto.
	* gcc.target/i386/fma_run_double_results_1.h: Ditto.
	* gcc.target/i386/fma_run_double_results_2.h: Ditto.
	* gcc.target/i386/fma_run_double_results_3.h: Ditto.
	* gcc.target/i386/fma_run_double_results_4.h: Ditto.
	* gcc.target/i386/fma_run_double_results_5.h: Ditto.
	* gcc.target/i386/fma_run_double_results_6.h: Ditto.
	* gcc.target/i386/fma_run_float_1.c: Ditto.
	* gcc.target/i386/fma_run_float_2.c: Ditto.
	* gcc.target/i386/fma_run_float_3.c: Ditto.
	* gcc.target/i386/fma_run_float_4.c: Ditto.
	* gcc.target/i386/fma_run_float_5.c: Ditto.
	* gcc.target/i386/fma_run_float_6.c: Ditto.
	* gcc.target/i386/fma_run_float_results_1.h: Ditto.
	* gcc.target/i386/fma_run_float_results_2.h: Ditto.
	* gcc.target/i386/fma_run_float_results_3.h: Ditto.
	* gcc.target/i386/fma_run_float_results_4.h: Ditto.
	* gcc.target/i386/fma_run_float_results_5.h: Ditto.
	* gcc.target/i386/fma_run_float_results_6.h: Ditto.
	* gcc.target/i386/l_fma_1.h: Ditto.
	* gcc.target/i386/l_fma_2.h: Ditto.
	* gcc.target/i386/l_fma_3.h: Ditto.
	* gcc.target/i386/l_fma_4.h: Ditto.
	* gcc.target/i386/l_fma_5.h: Ditto.
	* gcc.target/i386/l_fma_6.h: Ditto.
	* gcc.target/i386/l_fma_double_1.c: Ditto.
	* gcc.target/i386/l_fma_double_2.c: Ditto.
	* gcc.target/i386/l_fma_double_3.c: Ditto.
	* gcc.target/i386/l_fma_double_4.c: Ditto.
	* gcc.target/i386/l_fma_double_5.c: Ditto.
	* gcc.target/i386/l_fma_double_6.c: Ditto.
	* gcc.target/i386/l_fma_float_1.c: Ditto.
	* gcc.target/i386/l_fma_float_2.c: Ditto.
	* gcc.target/i386/l_fma_float_3.c: Ditto.
	* gcc.target/i386/l_fma_float_4.c: Ditto.
	* gcc.target/i386/l_fma_float_5.c: Ditto.
	* gcc.target/i386/l_fma_float_6.c: Ditto.
	* gcc.target/i386/l_fma_main.h: Ditto.
	* gcc.target/i386/l_fma_run_double_1.c: Ditto.
	* gcc.target/i386/l_fma_run_double_2.c: Ditto.
	* gcc.target/i386/l_fma_run_double_3.c: Ditto.
	* gcc.target/i386/l_fma_run_double_4.c: Ditto.
	* gcc.target/i386/l_fma_run_double_5.c: Ditto.
	* gcc.target/i386/l_fma_run_double_6.c: Ditto.
	* gcc.target/i386/l_fma_run_float_1.c: Ditto.
	* gcc.target/i386/l_fma_run_float_2.c: Ditto.
	* gcc.target/i386/l_fma_run_float_3.c: Ditto.
	* gcc.target/i386/l_fma_run_float_4.c: Ditto.
	* gcc.target/i386/l_fma_run_float_5.c: Ditto.
	* gcc.target/i386/l_fma_run_float_6.c: Ditto.

Could you please have a look?

Thanks, K

[-- Attachment #2: fma3_typo_tests.gcc.patch --]
[-- Type: application/octet-stream, Size: 125947 bytes --]

diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 251cdde..f8af580e 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..dccade9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_1.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_1
+#define fma_1
+
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a + b;
+}
+
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a - b;
+}
+
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a + b;
+}
+
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a - b;
+}
+
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a + b;
+}
+
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a - b;
+}
+
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a + b;
+}
+
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a - b;
+}
+
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a + b;
+}
+
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a - b;
+}
+
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a + b;
+}
+
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a - b;
+}
+
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a + b;
+}
+
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a - b;
+}
+
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * a + b;
+}
+
+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..5c703db
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_2.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_2
+#define fma_2
+
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a + c;
+}
+
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a - c;
+}
+
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a + c;
+}
+
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a - c;
+}
+
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a + c;
+}
+
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a - c;
+}
+
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a + c;
+}
+
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a - c;
+}
+
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a + c;
+}
+
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a - c;
+}
+
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a + c;
+}
+
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a - c;
+}
+
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a + c;
+}
+
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a - c;
+}
+
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * a + c;
+}
+
+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..c021626
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_3.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_3
+#define fma_3
+
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b + a;
+}
+
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b - a;
+}
+
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b + a;
+}
+
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b - a;
+}
+
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b + a;
+}
+
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b - a;
+}
+
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b + a;
+}
+
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b - a;
+}
+
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b + a;
+}
+
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b - a;
+}
+
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b + a;
+}
+
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b - a;
+}
+
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b + a;
+}
+
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b - a;
+}
+
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * b + a;
+}
+
+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..fcb2236
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_4.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_4
+#define fma_4
+
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b + c;
+}
+
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b - c;
+}
+
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b + c;
+}
+
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b - c;
+}
+
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b + c;
+}
+
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b - c;
+}
+
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b + c;
+}
+
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b - c;
+}
+
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b + c;
+}
+
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b - c;
+}
+
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b + c;
+}
+
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b - c;
+}
+
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b + c;
+}
+
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b - c;
+}
+
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * b + c;
+}
+
+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..ed9cbc4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_5.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_5
+#define fma_5
+
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c + a;
+}
+
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c - a;
+}
+
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c + a;
+}
+
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c - a;
+}
+
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c + a;
+}
+
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c - a;
+}
+
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c + a;
+}
+
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c - a;
+}
+
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c + a;
+}
+
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c - a;
+}
+
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c + a;
+}
+
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c - a;
+}
+
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c + a;
+}
+
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c - a;
+}
+
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * c + a;
+}
+
+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..ed27656
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_6.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_6
+#define fma_6
+
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c + b;
+}
+
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c - b;
+}
+
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c + b;
+}
+
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c - b;
+}
+
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c + b;
+}
+
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c - b;
+}
+
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c + b;
+}
+
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c - b;
+}
+
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c + b;
+}
+
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c - b;
+}
+
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c + b;
+}
+
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c - b;
+}
+
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c + b;
+}
+
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c - b;
+}
+
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * c + b;
+}
+
+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..138d66a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..7a7ed35
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_2.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..c8533e3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_3.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..365741e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_4.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..73e548c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_5.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..09002d5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_6.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..9501786
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..3cfbcb1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_2.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..148aac4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_3.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..c9d500e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_4.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..bf24b38
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_5.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..a99716c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_6.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..ecb21ab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_main.h
@@ -0,0 +1,113 @@
+
+#ifndef fma_main
+#define fma_main
+
+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..e6ccee5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_1.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..a76f007
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_2.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..7b85784
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_3.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..336737d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_4.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..962c8ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_5.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..abf397e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_6.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..d80012e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_1.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..3e6d684
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_2.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..361f293
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_3.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..da039c1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_4.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..604fd06
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_5.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..fa23f8a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_6.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..c3099fb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_1.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_1
+#define l_fma_1
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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..1e9d89e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_2.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_2
+#define l_fma_2
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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..78b86cc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_3.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_3
+#define l_fma_3
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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..666931a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_4.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_4
+#define l_fma_4
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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..ce59ec1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_5.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_5
+#define l_fma_5
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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..f8c96ad
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_6.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_6
+#define l_fma_6
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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..b6c9711
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_1.c
@@ -0,0 +1,30 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..27050aa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_2.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..3b09d2a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_3.c
@@ -0,0 +1,30 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..735c655
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_4.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..d44a192
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_5.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..00c72a4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_6.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..0e98804
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_1.c
@@ -0,0 +1,30 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..74254f1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_2.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..32e8ab7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_3.c
@@ -0,0 +1,30 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..8875a52
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_4.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..b0bcad7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_5.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..6ebbbe2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_6.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { 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..801ea83
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_main.h
@@ -0,0 +1,96 @@
+
+#ifndef l_fma_main
+#define l_fma_main
+
+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..f51ff7e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_1.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..2e80968
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_2.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..95affcd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_3.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..9da7ce6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_4.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..b44fb6c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_5.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..2ad0bb4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_6.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..5d65e4f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_1.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..802c7ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_2.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..0fe4f87
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_3.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..511b698
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_4.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..28b02fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_5.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..17af3b0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_6.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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"

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-05 11:16 [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD Kirill Yukhin
@ 2011-10-05 18:51 ` Uros Bizjak
  2011-10-06  9:48   ` Kirill Yukhin
  0 siblings, 1 reply; 24+ messages in thread
From: Uros Bizjak @ 2011-10-05 18:51 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: gcc-patches List, H.J. Lu, vbyakovl23

On Wed, Oct 5, 2011 at 12:49 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:

> We're prepared and bunch of tests which checks autogeneration of FMA3
> instructions family.
> FMA3 typo in .md file is fixed as well (it was catched by tests).
>
> ChangeLog entry:
>
> 2011-10-04  Kirill Yukhin <kirill.yukhin@intel.com>
>            Yakovlev Vladimir <vladimir.b.yakovlev@intel.com>
>
>        * config/i386/sse.md (fma_fnmsub_<mode>): Fix a typo.
>
> testsuite/ChangeLog entry:
>
> 2011-10-04  Kirill Yukhin <kirill.yukhin@intel.com>
>            Yakovlev Vladimir <vladimir.b.yakovlev@intel.com>
>
>        * gcc.target/i386/fma_1.h: New test.
>        * gcc.target/i386/fma_2.h: Ditto.
>        * gcc.target/i386/fma_3.h: Ditto.
>        * gcc.target/i386/fma_4.h: Ditto.
>        * gcc.target/i386/fma_5.h: Ditto.
>        * gcc.target/i386/fma_6.h: Ditto.

Just say "New file." for various headers. They are not standalone tests...

>        * gcc.target/i386/fma_double_1.c: Ditto.
>        * gcc.target/i386/fma_double_2.c: Ditto.
>        * gcc.target/i386/fma_double_3.c: Ditto.
>        * gcc.target/i386/fma_double_4.c: Ditto.
>        * gcc.target/i386/fma_double_5.c: Ditto.
>        * gcc.target/i386/fma_double_6.c: Ditto.
>        * gcc.target/i386/fma_float_1.c: Ditto.
>        * gcc.target/i386/fma_float_2.c: Ditto.
>        * gcc.target/i386/fma_float_3.c: Ditto.
>        * gcc.target/i386/fma_float_4.c: Ditto.
>        * gcc.target/i386/fma_float_5.c: Ditto.
>        * gcc.target/i386/fma_float_6.c: Ditto.
>        * gcc.target/i386/fma_main.h: Ditto.
>        * gcc.target/i386/fma_run_double_1.c: Ditto.
>        * gcc.target/i386/fma_run_double_2.c: Ditto.
>        * gcc.target/i386/fma_run_double_3.c: Ditto.
>        * gcc.target/i386/fma_run_double_4.c: Ditto.
>        * gcc.target/i386/fma_run_double_5.c: Ditto.
>        * gcc.target/i386/fma_run_double_6.c: Ditto.
>        * gcc.target/i386/fma_run_double_results_1.h: Ditto.
>        * gcc.target/i386/fma_run_double_results_2.h: Ditto.
>        * gcc.target/i386/fma_run_double_results_3.h: Ditto.
>        * gcc.target/i386/fma_run_double_results_4.h: Ditto.
>        * gcc.target/i386/fma_run_double_results_5.h: Ditto.
>        * gcc.target/i386/fma_run_double_results_6.h: Ditto.
>        * gcc.target/i386/fma_run_float_1.c: Ditto.
>        * gcc.target/i386/fma_run_float_2.c: Ditto.
>        * gcc.target/i386/fma_run_float_3.c: Ditto.
>        * gcc.target/i386/fma_run_float_4.c: Ditto.
>        * gcc.target/i386/fma_run_float_5.c: Ditto.
>        * gcc.target/i386/fma_run_float_6.c: Ditto.
>        * gcc.target/i386/fma_run_float_results_1.h: Ditto.
>        * gcc.target/i386/fma_run_float_results_2.h: Ditto.
>        * gcc.target/i386/fma_run_float_results_3.h: Ditto.
>        * gcc.target/i386/fma_run_float_results_4.h: Ditto.
>        * gcc.target/i386/fma_run_float_results_5.h: Ditto.
>        * gcc.target/i386/fma_run_float_results_6.h: Ditto.
>        * gcc.target/i386/l_fma_1.h: Ditto.
>        * gcc.target/i386/l_fma_2.h: Ditto.
>        * gcc.target/i386/l_fma_3.h: Ditto.
>        * gcc.target/i386/l_fma_4.h: Ditto.
>        * gcc.target/i386/l_fma_5.h: Ditto.
>        * gcc.target/i386/l_fma_6.h: Ditto.
>        * gcc.target/i386/l_fma_double_1.c: Ditto.
>        * gcc.target/i386/l_fma_double_2.c: Ditto.
>        * gcc.target/i386/l_fma_double_3.c: Ditto.
>        * gcc.target/i386/l_fma_double_4.c: Ditto.
>        * gcc.target/i386/l_fma_double_5.c: Ditto.
>        * gcc.target/i386/l_fma_double_6.c: Ditto.
>        * gcc.target/i386/l_fma_float_1.c: Ditto.
>        * gcc.target/i386/l_fma_float_2.c: Ditto.
>        * gcc.target/i386/l_fma_float_3.c: Ditto.
>        * gcc.target/i386/l_fma_float_4.c: Ditto.
>        * gcc.target/i386/l_fma_float_5.c: Ditto.
>        * gcc.target/i386/l_fma_float_6.c: Ditto.
>        * gcc.target/i386/l_fma_main.h: Ditto.
>        * gcc.target/i386/l_fma_run_double_1.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_2.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_3.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_4.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_5.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_6.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_1.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_2.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_3.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_4.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_5.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_6.c: Ditto.
>
> Could you please have a look?

+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O2 -mfma" } */

{ dg-require-effective-target fma } directive is not needed for
compile-only tests, as they stop at generating assembly file. Also,
you have disabled all tests on ia32 - unconditionally use "-O2 -mfma
-mfpmath=sse" for dg-options, and these instructions will magically
appear on all targets.

Otherwise, the patch looks OK.

Uros.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-05 18:51 ` Uros Bizjak
@ 2011-10-06  9:48   ` Kirill Yukhin
  2011-10-06 10:14     ` Uros Bizjak
  0 siblings, 1 reply; 24+ messages in thread
From: Kirill Yukhin @ 2011-10-06  9:48 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches List, H.J. Lu, vbyakovl23, Kirill Yukhin

[-- Attachment #1: Type: text/plain, Size: 4553 bytes --]

Hi Uros,
Thanks for review. I did all but one

> you have disabled all tests on ia32 - unconditionally use "-O2 -mfma
> -mfpmath=sse" for dg-options, and these instructions will magically
> appear on all targets.

I am enabling these tests to run on ia32, they all fail to scan-assembler,
since assemler is completely different, here is instance:
test_neg_sub_neg_sub:
.LFB15:
        .cfi_startproc
        subl    $12, %esp
        .cfi_def_cfa_offset 16
        vmovsd  16(%esp), %xmm2
        vmovsd  24(%esp), %xmm1
        vmovapd %xmm2, %xmm0
        vfnmsub213sd    32(%esp), %xmm1, %xmm0
        vfnmsub132sd    %xmm2, %xmm1, %xmm0
        vmovsd  %xmm0, (%esp)
        fldl    (%esp)
        addl    $12, %esp
        .cfi_def_cfa_offset 4
        ret
        .cfi_endproc

On ia32 params are passed completely different and therefore code differs.

Rest your objections were applied.

gcc's ChangeLog was not changed.

Updated patch is attached.

Updated testsuite/ChangeLog entry:
2011-10-04  Kirill Yukhin <kirill.yukhin@intel.com>
	    Yakovlev Vladimir <vladimir.b.yakovlev@intel.com>

	* gcc.target/i386/fma_1.h: New header.
	* gcc.target/i386/fma_2.h: Ditto.
	* gcc.target/i386/fma_3.h: Ditto.
	* gcc.target/i386/fma_4.h: Ditto.
	* gcc.target/i386/fma_5.h: Ditto.
	* gcc.target/i386/fma_6.h: Ditto.
	* gcc.target/i386/fma_run_double_results_1.h: Ditto.
	* gcc.target/i386/fma_run_double_results_2.h: Ditto.
	* gcc.target/i386/fma_run_double_results_3.h: Ditto.
	* gcc.target/i386/fma_run_double_results_4.h: Ditto.
	* gcc.target/i386/fma_run_double_results_5.h: Ditto.
	* gcc.target/i386/fma_run_double_results_6.h: Ditto.
	* gcc.target/i386/fma_run_float_1.c: Ditto.
	* gcc.target/i386/fma_run_float_2.c: Ditto.
	* gcc.target/i386/fma_run_float_3.c: Ditto.
	* gcc.target/i386/fma_run_float_4.c: Ditto.
	* gcc.target/i386/fma_run_float_5.c: Ditto.
	* gcc.target/i386/fma_run_float_6.c: Ditto.
	* gcc.target/i386/fma_run_float_results_1.h: Ditto.
	* gcc.target/i386/fma_run_float_results_2.h: Ditto.
	* gcc.target/i386/fma_run_float_results_3.h: Ditto.
	* gcc.target/i386/fma_run_float_results_4.h: Ditto.
	* gcc.target/i386/fma_run_float_results_5.h: Ditto.
	* gcc.target/i386/fma_run_float_results_6.h: Ditto.
	* gcc.target/i386/l_fma_1.h: Ditto.
	* gcc.target/i386/l_fma_2.h: Ditto.
	* gcc.target/i386/l_fma_3.h: Ditto.
	* gcc.target/i386/l_fma_4.h: Ditto.
	* gcc.target/i386/l_fma_5.h: Ditto.
	* gcc.target/i386/l_fma_6.h: Ditto.
	* gcc.target/i386/l_fma_main.h: Ditto.
	* gcc.target/i386/fma_main.h: Ditto.
	* gcc.target/i386/fma_double_1.c: New test.
	* gcc.target/i386/fma_double_2.c: Ditto.
	* gcc.target/i386/fma_double_3.c: Ditto.
	* gcc.target/i386/fma_double_4.c: Ditto.
	* gcc.target/i386/fma_double_5.c: Ditto.
	* gcc.target/i386/fma_double_6.c: Ditto.
	* gcc.target/i386/fma_float_1.c: Ditto.
	* gcc.target/i386/fma_float_2.c: Ditto.
	* gcc.target/i386/fma_float_3.c: Ditto.
	* gcc.target/i386/fma_float_4.c: Ditto.
	* gcc.target/i386/fma_float_5.c: Ditto.
	* gcc.target/i386/fma_float_6.c: Ditto.
	* gcc.target/i386/fma_run_double_1.c: Ditto.
	* gcc.target/i386/fma_run_double_2.c: Ditto.
	* gcc.target/i386/fma_run_double_3.c: Ditto.
	* gcc.target/i386/fma_run_double_4.c: Ditto.
	* gcc.target/i386/fma_run_double_5.c: Ditto.
	* gcc.target/i386/fma_run_double_6.c: Ditto.
	* gcc.target/i386/l_fma_double_1.c: Ditto.
	* gcc.target/i386/l_fma_double_2.c: Ditto.
	* gcc.target/i386/l_fma_double_3.c: Ditto.
	* gcc.target/i386/l_fma_double_4.c: Ditto.
	* gcc.target/i386/l_fma_double_5.c: Ditto.
	* gcc.target/i386/l_fma_double_6.c: Ditto.
	* gcc.target/i386/l_fma_float_1.c: Ditto.
	* gcc.target/i386/l_fma_float_2.c: Ditto.
	* gcc.target/i386/l_fma_float_3.c: Ditto.
	* gcc.target/i386/l_fma_float_4.c: Ditto.
	* gcc.target/i386/l_fma_float_5.c: Ditto.
	* gcc.target/i386/l_fma_float_6.c: Ditto.
	* gcc.target/i386/l_fma_run_double_1.c: Ditto.
	* gcc.target/i386/l_fma_run_double_2.c: Ditto.
	* gcc.target/i386/l_fma_run_double_3.c: Ditto.
	* gcc.target/i386/l_fma_run_double_4.c: Ditto.
	* gcc.target/i386/l_fma_run_double_5.c: Ditto.
	* gcc.target/i386/l_fma_run_double_6.c: Ditto.
	* gcc.target/i386/l_fma_run_float_1.c: Ditto.
	* gcc.target/i386/l_fma_run_float_2.c: Ditto.
	* gcc.target/i386/l_fma_run_float_3.c: Ditto.
	* gcc.target/i386/l_fma_run_float_4.c: Ditto.
	* gcc.target/i386/l_fma_run_float_5.c: Ditto.
	* gcc.target/i386/l_fma_run_float_6.c: Ditto.


Updated patch is attached. It is passing tests with and without simulator.

What do you think?

Thanks, K

>
> Otherwise, the patch looks OK.
>
> Uros.
>

[-- Attachment #2: fma3_typo_tests-2.gcc.patch --]
[-- Type: application/octet-stream, Size: 124915 bytes --]

diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 251cdde..f8af580e 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..dccade9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_1.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_1
+#define fma_1
+
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a + b;
+}
+
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a - b;
+}
+
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a + b;
+}
+
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a - b;
+}
+
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a + b;
+}
+
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a - b;
+}
+
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a + b;
+}
+
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a - b;
+}
+
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a + b;
+}
+
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a - b;
+}
+
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a + b;
+}
+
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a - b;
+}
+
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a + b;
+}
+
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a - b;
+}
+
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * a + b;
+}
+
+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..5c703db
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_2.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_2
+#define fma_2
+
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a + c;
+}
+
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a - c;
+}
+
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a + c;
+}
+
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a - c;
+}
+
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a + c;
+}
+
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a - c;
+}
+
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a + c;
+}
+
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a - c;
+}
+
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a + c;
+}
+
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a - c;
+}
+
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a + c;
+}
+
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a - c;
+}
+
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a + c;
+}
+
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a - c;
+}
+
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * a + c;
+}
+
+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..c021626
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_3.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_3
+#define fma_3
+
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b + a;
+}
+
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b - a;
+}
+
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b + a;
+}
+
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b - a;
+}
+
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b + a;
+}
+
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b - a;
+}
+
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b + a;
+}
+
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b - a;
+}
+
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b + a;
+}
+
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b - a;
+}
+
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b + a;
+}
+
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b - a;
+}
+
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b + a;
+}
+
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b - a;
+}
+
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * b + a;
+}
+
+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..fcb2236
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_4.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_4
+#define fma_4
+
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b + c;
+}
+
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b - c;
+}
+
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b + c;
+}
+
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b - c;
+}
+
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b + c;
+}
+
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b - c;
+}
+
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b + c;
+}
+
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b - c;
+}
+
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b + c;
+}
+
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b - c;
+}
+
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b + c;
+}
+
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b - c;
+}
+
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b + c;
+}
+
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b - c;
+}
+
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * b + c;
+}
+
+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..ed9cbc4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_5.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_5
+#define fma_5
+
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c + a;
+}
+
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c - a;
+}
+
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c + a;
+}
+
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c - a;
+}
+
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c + a;
+}
+
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c - a;
+}
+
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c + a;
+}
+
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c - a;
+}
+
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c + a;
+}
+
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c - a;
+}
+
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c + a;
+}
+
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c - a;
+}
+
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c + a;
+}
+
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c - a;
+}
+
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * c + a;
+}
+
+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..ed27656
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_6.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_6
+#define fma_6
+
+TYPE
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c + b;
+}
+
+TYPE
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c - b;
+}
+
+TYPE
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c + b;
+}
+
+TYPE
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c - b;
+}
+
+TYPE
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c + b;
+}
+
+TYPE
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c - b;
+}
+
+TYPE
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c + b;
+}
+
+TYPE
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c - b;
+}
+
+TYPE
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c + b;
+}
+
+TYPE
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c - b;
+}
+
+TYPE
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c + b;
+}
+
+TYPE
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c - b;
+}
+
+TYPE
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c + b;
+}
+
+TYPE
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c - b;
+}
+
+TYPE
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * c + b;
+}
+
+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..6513ec7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..b822959
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..d6b332a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_3.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..bb30fc7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_4.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..0bae7e4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_5.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..efacc6f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_double_6.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..8cf1eed
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..f64669c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..6b90f92
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_3.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..47d568c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_4.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..09c93aa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_5.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..84bcc3c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_float_6.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..ecb21ab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_main.h
@@ -0,0 +1,113 @@
+
+#ifndef fma_main
+#define fma_main
+
+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..e6ccee5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_1.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..a76f007
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_2.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..7b85784
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_3.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..336737d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_4.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..962c8ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_5.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..abf397e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_6.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..d80012e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_1.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..3e6d684
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_2.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..361f293
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_3.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..da039c1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_4.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..604fd06
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_5.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..fa23f8a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_6.c
@@ -0,0 +1,17 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O3 -mfma" } */
+
+/* Test that the compiler properly optimizes floating point multiply
+   and add instructions into FMA3 instructions.  */
+
+#include <stdio.h>
+
+#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..c3099fb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_1.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_1
+#define l_fma_1
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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..1e9d89e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_2.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_2
+#define l_fma_2
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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..78b86cc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_3.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_3
+#define l_fma_3
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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..666931a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_4.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_4
+#define l_fma_4
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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..ce59ec1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_5.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_5
+#define l_fma_5
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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..f8c96ad
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_6.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_6
+#define l_fma_6
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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];
+}
+
+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..6218d74
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_1.c
@@ -0,0 +1,29 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..1419f12
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_2.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..3e431a0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_3.c
@@ -0,0 +1,29 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..eaa8cc3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_4.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..3993bf7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_5.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..dc51abf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_6.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..51b8557
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_1.c
@@ -0,0 +1,29 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..c6e0593
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_2.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..30ffe99
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_3.c
@@ -0,0 +1,29 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..db4935a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_4.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..f55266e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_5.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..fa2703c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_6.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { 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..801ea83
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_main.h
@@ -0,0 +1,96 @@
+
+#ifndef l_fma_main
+#define l_fma_main
+
+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..f51ff7e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_1.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..2e80968
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_2.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..95affcd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_3.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..9da7ce6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_4.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..b44fb6c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_5.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..2ad0bb4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_6.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..5d65e4f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_1.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..802c7ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_2.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..0fe4f87
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_3.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..511b698
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_4.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..28b02fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_5.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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..17af3b0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_6.c
@@ -0,0 +1,15 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { 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"

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-06  9:48   ` Kirill Yukhin
@ 2011-10-06 10:14     ` Uros Bizjak
  2011-10-06 12:58       ` Kirill Yukhin
  0 siblings, 1 reply; 24+ messages in thread
From: Uros Bizjak @ 2011-10-06 10:14 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: gcc-patches List, H.J. Lu, vbyakovl23

On Thu, Oct 6, 2011 at 11:38 AM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:

> Thanks for review. I did all but one
>
>> you have disabled all tests on ia32 - unconditionally use "-O2 -mfma
>> -mfpmath=sse" for dg-options, and these instructions will magically
>> appear on all targets.
>
> I am enabling these tests to run on ia32, they all fail to scan-assembler,
> since assemler is completely different, here is instance:
> test_neg_sub_neg_sub:
> .LFB15:
>        .cfi_startproc
>        subl    $12, %esp
>        .cfi_def_cfa_offset 16
>        vmovsd  16(%esp), %xmm2
>        vmovsd  24(%esp), %xmm1
>        vmovapd %xmm2, %xmm0
>        vfnmsub213sd    32(%esp), %xmm1, %xmm0
>        vfnmsub132sd    %xmm2, %xmm1, %xmm0
>        vmovsd  %xmm0, (%esp)
>        fldl    (%esp)
>        addl    $12, %esp
>        .cfi_def_cfa_offset 4
>        ret
>        .cfi_endproc
>
> On ia32 params are passed completely different and therefore code differs.

You can add __attribute__((sseregparm)) to function declaration. This
will force arguments to/from function to SSE registers. The problem
is, that it will result in "warning: 'sseregparm' attribute ignored",
but this can be ignored using dg-prune-output dg directive. Please see
many examples in the testsuite.

Uros.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-06 10:14     ` Uros Bizjak
@ 2011-10-06 12:58       ` Kirill Yukhin
  2011-10-06 13:04         ` Uros Bizjak
  0 siblings, 1 reply; 24+ messages in thread
From: Kirill Yukhin @ 2011-10-06 12:58 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches List, H.J. Lu, vbyakovl23

[-- Attachment #1: Type: text/plain, Size: 1593 bytes --]

Wow, it works!

Thank you. New patch attached.
ChangeLogs were not touched.

Tests pass both on ia32/x86-64 with and without simulator.

Thanks, K

On Thu, Oct 6, 2011 at 2:07 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, Oct 6, 2011 at 11:38 AM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
>
>> Thanks for review. I did all but one
>>
>>> you have disabled all tests on ia32 - unconditionally use "-O2 -mfma
>>> -mfpmath=sse" for dg-options, and these instructions will magically
>>> appear on all targets.
>>
>> I am enabling these tests to run on ia32, they all fail to scan-assembler,
>> since assemler is completely different, here is instance:
>> test_neg_sub_neg_sub:
>> .LFB15:
>>        .cfi_startproc
>>        subl    $12, %esp
>>        .cfi_def_cfa_offset 16
>>        vmovsd  16(%esp), %xmm2
>>        vmovsd  24(%esp), %xmm1
>>        vmovapd %xmm2, %xmm0
>>        vfnmsub213sd    32(%esp), %xmm1, %xmm0
>>        vfnmsub132sd    %xmm2, %xmm1, %xmm0
>>        vmovsd  %xmm0, (%esp)
>>        fldl    (%esp)
>>        addl    $12, %esp
>>        .cfi_def_cfa_offset 4
>>        ret
>>        .cfi_endproc
>>
>> On ia32 params are passed completely different and therefore code differs.
>
> You can add __attribute__((sseregparm)) to function declaration. This
> will force arguments to/from function to SSE registers. The problem
> is, that it will result in "warning: 'sseregparm' attribute ignored",
> but this can be ignored using dg-prune-output dg directive. Please see
> many examples in the testsuite.
>
> Uros.
>

[-- Attachment #2: fma3_typo_tests-3.gcc.patch --]
[-- Type: application/octet-stream, Size: 132701 bytes --]

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"

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-06 12:58       ` Kirill Yukhin
@ 2011-10-06 13:04         ` Uros Bizjak
  2011-10-06 13:05           ` Uros Bizjak
  2011-10-06 13:07           ` Kirill Yukhin
  0 siblings, 2 replies; 24+ messages in thread
From: Uros Bizjak @ 2011-10-06 13:04 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: gcc-patches List, H.J. Lu, vbyakovl23

On Thu, Oct 6, 2011 at 2:51 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
> Wow, it works!
>
> Thank you. New patch attached.
> ChangeLogs were not touched.
>
> Tests pass both on ia32/x86-64 with and without simulator.

You are missing closing curly braces in dg-do compile directives.

Also, please write:

TYPE __attribute__((sseregparm))
test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)

The patch is OK with these changes.

Thanks,
Uros.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-06 13:04         ` Uros Bizjak
@ 2011-10-06 13:05           ` Uros Bizjak
  2011-10-06 13:49             ` Kirill Yukhin
  2011-10-06 13:07           ` Kirill Yukhin
  1 sibling, 1 reply; 24+ messages in thread
From: Uros Bizjak @ 2011-10-06 13:05 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: gcc-patches List, H.J. Lu, vbyakovl23

On Thu, Oct 6, 2011 at 2:55 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, Oct 6, 2011 at 2:51 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
>> Wow, it works!
>>
>> Thank you. New patch attached.
>> ChangeLogs were not touched.
>>
>> Tests pass both on ia32/x86-64 with and without simulator.
>
> You are missing closing curly braces in dg-do compile directives.
>
> Also, please write:
>
> TYPE __attribute__((sseregparm))
> test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
>
> The patch is OK with these changes.

BTW, don't you also need "-mfmpath=sse" in dg-options?

Uros.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-06 13:04         ` Uros Bizjak
  2011-10-06 13:05           ` Uros Bizjak
@ 2011-10-06 13:07           ` Kirill Yukhin
  2011-10-15 10:42             ` Andreas Schwab
  1 sibling, 1 reply; 24+ messages in thread
From: Kirill Yukhin @ 2011-10-06 13:07 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches List, H.J. Lu, vbyakovl23, Kirill Yukhin

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]

Done

Thanks, K

On Thu, Oct 6, 2011 at 4:55 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, Oct 6, 2011 at 2:51 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
>> Wow, it works!
>>
>> Thank you. New patch attached.
>> ChangeLogs were not touched.
>>
>> Tests pass both on ia32/x86-64 with and without simulator.
>
> You are missing closing curly braces in dg-do compile directives.
>
> Also, please write:
>
> TYPE __attribute__((sseregparm))
> test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
>
> The patch is OK with these changes.
>
> Thanks,
> Uros.
>

[-- Attachment #2: fma3_typo_tests-4.gcc.patch --]
[-- Type: application/octet-stream, Size: 132557 bytes --]

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..72d7373
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_1.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_1
+#define fma_1
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * a + b;
+}
+
+TYPE __attribute__((sseregparm))
+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..c5d38d1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_2.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_2
+#define fma_2
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * a - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * a - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * a - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * a - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * a - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * a - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * a - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * a + c;
+}
+
+TYPE __attribute__((sseregparm))
+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..efa88b5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_3.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_3
+#define fma_3
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * b + a;
+}
+
+TYPE __attribute__((sseregparm))
+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..9fbb3ef
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_4.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_4
+#define fma_4
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * b - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * b - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * b - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * b - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * b - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * b - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b + c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * b - c;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * b + c;
+}
+
+TYPE __attribute__((sseregparm))
+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..3409db8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_5.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_5
+#define fma_5
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c + a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c - a;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * c + a;
+}
+
+TYPE __attribute__((sseregparm))
+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..a6bb4b0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/fma_6.h
@@ -0,0 +1,101 @@
+
+#ifndef fma_6
+#define fma_6
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) + c) * c - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) + c) * c - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return ((a * b) - c) * c - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_noneg_sub_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -((a * b) - c) * c - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) + c) * c - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_add_neg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) + c) * c - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_noneg_add (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c + b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_noneg_sub (TYPE a, TYPE b, TYPE c)
+{
+  return (-(a * b) - c) * c - b;
+}
+
+TYPE __attribute__((sseregparm))
+test_neg_sub_neg_add (TYPE a, TYPE b, TYPE c)
+{
+  return -(-(a * b) - c) * c + b;
+}
+
+TYPE __attribute__((sseregparm))
+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..51196ab
--- /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..8536363
--- /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..8ca789f
--- /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..06a6a12
--- /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..42b3731
--- /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..4ba0ab1
--- /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..0d5ef64
--- /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..a7f0897
--- /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..ab837d6
--- /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..7501974
--- /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..056b067
--- /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..58d9f13
--- /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..4a0fd6e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_1.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_1
+#define l_fma_1
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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..fd64b61
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_2.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_2
+#define l_fma_2
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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..226af24
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_3.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_3
+#define l_fma_3
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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..e33fe25
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_4.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_4
+#define l_fma_4
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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..a754812
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_5.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_5
+#define l_fma_5
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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..39be29a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/l_fma_6.h
@@ -0,0 +1,133 @@
+
+#ifndef l_fma_6
+#define l_fma_6
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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];
+}
+
+void __attribute__((sseregparm))
+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..1f3e528
--- /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..051396f
--- /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..1153ed9
--- /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..804e9ec
--- /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..4d721e7
--- /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..0281fc6
--- /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..a25fa3d
--- /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..6d5fb2c
--- /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..5db5db8
--- /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..792c5f1
--- /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..8be80ad
--- /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..3d88fdb
--- /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"

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-06 13:05           ` Uros Bizjak
@ 2011-10-06 13:49             ` Kirill Yukhin
  2011-10-06 20:17               ` Uros Bizjak
  2011-10-10 21:14               ` Uros Bizjak
  0 siblings, 2 replies; 24+ messages in thread
From: Kirill Yukhin @ 2011-10-06 13:49 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches List, H.J. Lu, vbyakovl23

>
> BTW, don't you also need "-mfmpath=sse" in dg-options?
>

According to doc/invoke.texi
...
@itemx -mfma
...
These options will enable GCC to use these extended instructions in
generated code, even without @option{-mfpmath=sse}.

Seems it -mfpmath=sse is useless..
Although, if this is wrong, we probably have to update doc as well.

Thanks, K

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-06 13:49             ` Kirill Yukhin
@ 2011-10-06 20:17               ` Uros Bizjak
  2011-10-09 19:56                 ` Kirill Yukhin
  2011-10-10 21:14               ` Uros Bizjak
  1 sibling, 1 reply; 24+ messages in thread
From: Uros Bizjak @ 2011-10-06 20:17 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: gcc-patches List, H.J. Lu, vbyakovl23

On Thu, Oct 6, 2011 at 3:48 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
>>
>> BTW, don't you also need "-mfmpath=sse" in dg-options?
>>
>
> According to doc/invoke.texi
> ...
> @itemx -mfma
> ...
> These options will enable GCC to use these extended instructions in
> generated code, even without @option{-mfpmath=sse}.
>
> Seems it -mfpmath=sse is useless..
> Although, if this is wrong, we probably have to update doc as well.

Well, OK then.

Uros.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-06 20:17               ` Uros Bizjak
@ 2011-10-09 19:56                 ` Kirill Yukhin
  2011-10-10 16:20                   ` H.J. Lu
  0 siblings, 1 reply; 24+ messages in thread
From: Kirill Yukhin @ 2011-10-09 19:56 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches List, H.J. Lu, vbyakovl23

Hi guys,
This is a Ping. Could anyboady with appropriate rights commit that?

Thanks, K

On Thu, Oct 6, 2011 at 11:46 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, Oct 6, 2011 at 3:48 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
>>>
>>> BTW, don't you also need "-mfmpath=sse" in dg-options?
>>>
>>
>> According to doc/invoke.texi
>> ...
>> @itemx -mfma
>> ...
>> These options will enable GCC to use these extended instructions in
>> generated code, even without @option{-mfpmath=sse}.
>>
>> Seems it -mfpmath=sse is useless..
>> Although, if this is wrong, we probably have to update doc as well.
>
> Well, OK then.
>
> Uros.
>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-09 19:56                 ` Kirill Yukhin
@ 2011-10-10 16:20                   ` H.J. Lu
  2011-10-10 16:23                     ` Kirill Yukhin
  0 siblings, 1 reply; 24+ messages in thread
From: H.J. Lu @ 2011-10-10 16:20 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Uros Bizjak, gcc-patches List, vbyakovl23

On Sun, Oct 9, 2011 at 12:49 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
> Hi guys,
> This is a Ping. Could anyboady with appropriate rights commit that?
>
>

I checked it in for you. Please provide ChangeLog entries together
with the new patch next time.

-- 
H.J.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-10 16:20                   ` H.J. Lu
@ 2011-10-10 16:23                     ` Kirill Yukhin
  0 siblings, 0 replies; 24+ messages in thread
From: Kirill Yukhin @ 2011-10-10 16:23 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Uros Bizjak, gcc-patches List, vbyakovl23

Thank you

K

On Mon, Oct 10, 2011 at 8:08 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Sun, Oct 9, 2011 at 12:49 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
>> Hi guys,
>> This is a Ping. Could anyboady with appropriate rights commit that?
>>
>>
>
> I checked it in for you. Please provide ChangeLog entries together
> with the new patch next time.
>
> --
> H.J.
>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-06 13:49             ` Kirill Yukhin
  2011-10-06 20:17               ` Uros Bizjak
@ 2011-10-10 21:14               ` Uros Bizjak
  2011-10-10 21:18                 ` Uros Bizjak
  1 sibling, 1 reply; 24+ messages in thread
From: Uros Bizjak @ 2011-10-10 21:14 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: gcc-patches List, H.J. Lu, vbyakovl23

On Thu, Oct 6, 2011 at 3:48 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
>>
>> BTW, don't you also need "-mfmpath=sse" in dg-options?
>>
>
> According to doc/invoke.texi
> ...
> @itemx -mfma
> ...
> These options will enable GCC to use these extended instructions in
> generated code, even without @option{-mfpmath=sse}.
>
> Seems it -mfpmath=sse is useless..
> Although, if this is wrong, we probably have to update doc as well.

Apparently [1], this is wrong, you need -mfpmath=sse in dg-options.

The reason you didn't see these failures with -m32 is due to
-mfpmath=sse added to your ./configure flags.

[1] http://gcc.gnu.org/ml/gcc-testresults/2011-10/msg01151.html

Uros.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-10 21:14               ` Uros Bizjak
@ 2011-10-10 21:18                 ` Uros Bizjak
  2011-10-11 10:38                   ` Kirill Yukhin
  0 siblings, 1 reply; 24+ messages in thread
From: Uros Bizjak @ 2011-10-10 21:18 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: gcc-patches List, H.J. Lu, vbyakovl23

On Mon, Oct 10, 2011 at 10:56 PM, Uros Bizjak <ubizjak@gmail.com> wrote:

>>> BTW, don't you also need "-mfmpath=sse" in dg-options?
>>>
>>
>> According to doc/invoke.texi
>> ...
>> @itemx -mfma
>> ...
>> These options will enable GCC to use these extended instructions in
>> generated code, even without @option{-mfpmath=sse}.
>>
>> Seems it -mfpmath=sse is useless..
>> Although, if this is wrong, we probably have to update doc as well.
>
> Apparently [1], this is wrong, you need -mfpmath=sse in dg-options.
>
> The reason you didn't see these failures with -m32 is due to
> -mfpmath=sse added to your ./configure flags.

Please read the above as: -with-fpmath=sse.

Uros.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-10 21:18                 ` Uros Bizjak
@ 2011-10-11 10:38                   ` Kirill Yukhin
  2011-10-11 10:53                     ` Uros Bizjak
  2011-10-11 16:12                     ` H.J. Lu
  0 siblings, 2 replies; 24+ messages in thread
From: Kirill Yukhin @ 2011-10-11 10:38 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches List, H.J. Lu, vbyakovl23

[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]

Hi
Uros, you was right both with fpmath and configflags. That is why it
was passing for me.

Attached patch which cures the problem.

testsuite/ChangeLog entry:

2011-10-11  Kirill Yukhin  <kirill.yukhin@intel.com>

	* gcc.target/i386/fma_double_1.c: Add -mfpmath=sse.
	* gcc.target/i386/fma_double_2.c: Ditto.
	* gcc.target/i386/fma_double_3.c: Ditto.
	* gcc.target/i386/fma_double_4.c: Ditto.
	* gcc.target/i386/fma_double_5.c: Ditto.
	* gcc.target/i386/fma_double_6.c: Ditto.
	* gcc.target/i386/fma_float_1.c: Ditto.
	* gcc.target/i386/fma_float_2.c: Ditto.
	* gcc.target/i386/fma_float_3.c: Ditto.
	* gcc.target/i386/fma_float_4.c: Ditto.
	* gcc.target/i386/fma_float_5.c: Ditto.
	* gcc.target/i386/fma_float_6.c: Ditto.
	* gcc.target/i386/l_fma_double_1.c: Ditto.
	* gcc.target/i386/l_fma_double_2.c: Ditto.
	* gcc.target/i386/l_fma_double_3.c: Ditto.
	* gcc.target/i386/l_fma_double_4.c: Ditto.
	* gcc.target/i386/l_fma_double_5.c: Ditto.
	* gcc.target/i386/l_fma_double_6.c: Ditto.
	* gcc.target/i386/l_fma_float_1.c: Ditto.
	* gcc.target/i386/l_fma_float_2.c: Ditto.
	* gcc.target/i386/l_fma_float_3.c: Ditto.
	* gcc.target/i386/l_fma_float_4.c: Ditto.
	* gcc.target/i386/l_fma_float_5.c: Ditto.
	* gcc.target/i386/l_fma_float_6.c: Ditto.
	* gcc.target/i386/l_fma_run_double_1.c: Ditto.
	* gcc.target/i386/l_fma_run_double_2.c: Ditto.
	* gcc.target/i386/l_fma_run_double_3.c: Ditto.
	* gcc.target/i386/l_fma_run_double_4.c: Ditto.
	* gcc.target/i386/l_fma_run_double_5.c: Ditto.
	* gcc.target/i386/l_fma_run_double_6.c: Ditto.
	* gcc.target/i386/l_fma_run_float_1.c: Ditto.
	* gcc.target/i386/l_fma_run_float_2.c: Ditto.
	* gcc.target/i386/l_fma_run_float_3.c: Ditto.
	* gcc.target/i386/l_fma_run_float_4.c: Ditto.
	* gcc.target/i386/l_fma_run_float_5.c: Ditto.
	* gcc.target/i386/l_fma_run_float_6.c: Ditto.

Could you please have a look?

Sorry for inconvenience, K

[-- Attachment #2: fma3-tests-fix.gcc.patch --]
[-- Type: application/octet-stream, Size: 19950 bytes --]

diff --git a/gcc/testsuite/gcc.target/i386/fma_double_1.c b/gcc/testsuite/gcc.target/i386/fma_double_1.c
index 51196ab..86bd754 100644
--- a/gcc/testsuite/gcc.target/i386/fma_double_1.c
+++ b/gcc/testsuite/gcc.target/i386/fma_double_1.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O2 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_double_2.c b/gcc/testsuite/gcc.target/i386/fma_double_2.c
index 8536363..e30d689 100644
--- a/gcc/testsuite/gcc.target/i386/fma_double_2.c
+++ b/gcc/testsuite/gcc.target/i386/fma_double_2.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O2 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_double_3.c b/gcc/testsuite/gcc.target/i386/fma_double_3.c
index 8ca789f..c66078d 100644
--- a/gcc/testsuite/gcc.target/i386/fma_double_3.c
+++ b/gcc/testsuite/gcc.target/i386/fma_double_3.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O2 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_double_4.c b/gcc/testsuite/gcc.target/i386/fma_double_4.c
index 06a6a12..5df7020 100644
--- a/gcc/testsuite/gcc.target/i386/fma_double_4.c
+++ b/gcc/testsuite/gcc.target/i386/fma_double_4.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O2 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_double_5.c b/gcc/testsuite/gcc.target/i386/fma_double_5.c
index 42b3731..68b785f 100644
--- a/gcc/testsuite/gcc.target/i386/fma_double_5.c
+++ b/gcc/testsuite/gcc.target/i386/fma_double_5.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O2 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_double_6.c b/gcc/testsuite/gcc.target/i386/fma_double_6.c
index 4ba0ab1..5078601 100644
--- a/gcc/testsuite/gcc.target/i386/fma_double_6.c
+++ b/gcc/testsuite/gcc.target/i386/fma_double_6.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O2 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_float_1.c b/gcc/testsuite/gcc.target/i386/fma_float_1.c
index 0d5ef64..a8a2706 100644
--- a/gcc/testsuite/gcc.target/i386/fma_float_1.c
+++ b/gcc/testsuite/gcc.target/i386/fma_float_1.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O2 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_float_2.c b/gcc/testsuite/gcc.target/i386/fma_float_2.c
index a7f0897..81836be 100644
--- a/gcc/testsuite/gcc.target/i386/fma_float_2.c
+++ b/gcc/testsuite/gcc.target/i386/fma_float_2.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O2 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_float_3.c b/gcc/testsuite/gcc.target/i386/fma_float_3.c
index ab837d6..354da87 100644
--- a/gcc/testsuite/gcc.target/i386/fma_float_3.c
+++ b/gcc/testsuite/gcc.target/i386/fma_float_3.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O2 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_float_4.c b/gcc/testsuite/gcc.target/i386/fma_float_4.c
index 7501974..ed1e449 100644
--- a/gcc/testsuite/gcc.target/i386/fma_float_4.c
+++ b/gcc/testsuite/gcc.target/i386/fma_float_4.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O2 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_float_5.c b/gcc/testsuite/gcc.target/i386/fma_float_5.c
index 056b067..ed563da 100644
--- a/gcc/testsuite/gcc.target/i386/fma_float_5.c
+++ b/gcc/testsuite/gcc.target/i386/fma_float_5.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O2 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_float_6.c b/gcc/testsuite/gcc.target/i386/fma_float_6.c
index 58d9f13..50ca455 100644
--- a/gcc/testsuite/gcc.target/i386/fma_float_6.c
+++ b/gcc/testsuite/gcc.target/i386/fma_float_6.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O2 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_1.c b/gcc/testsuite/gcc.target/i386/l_fma_double_1.c
index 1f3e528..81f6111 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_double_1.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_1.c
@@ -5,7 +5,7 @@
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
 
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 
 #define TYPE double
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_2.c b/gcc/testsuite/gcc.target/i386/l_fma_double_2.c
index 051396f..cb100f6 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_double_2.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_2.c
@@ -5,7 +5,7 @@
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
 
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 
 #define TYPE double
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_3.c b/gcc/testsuite/gcc.target/i386/l_fma_double_3.c
index 1153ed9..3aa1139 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_double_3.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_3.c
@@ -5,7 +5,7 @@
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
 
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 
 #define TYPE double
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_4.c b/gcc/testsuite/gcc.target/i386/l_fma_double_4.c
index 804e9ec..97b3a18 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_double_4.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_4.c
@@ -5,7 +5,7 @@
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
 
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 
 #define TYPE double
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_5.c b/gcc/testsuite/gcc.target/i386/l_fma_double_5.c
index 4d721e7..743d5a7 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_double_5.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_5.c
@@ -5,7 +5,7 @@
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
 
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 
 #define TYPE double
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_6.c b/gcc/testsuite/gcc.target/i386/l_fma_double_6.c
index 0281fc6..4f433d5 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_double_6.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_6.c
@@ -5,7 +5,7 @@
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
 
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 
 #define TYPE double
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_1.c b/gcc/testsuite/gcc.target/i386/l_fma_float_1.c
index a25fa3d..bc44d15 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_float_1.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_1.c
@@ -5,7 +5,7 @@
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
 
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 
 #define TYPE float
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_2.c b/gcc/testsuite/gcc.target/i386/l_fma_float_2.c
index 6d5fb2c..8e4db8a 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_float_2.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_2.c
@@ -5,7 +5,7 @@
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
 
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 
 #define TYPE float
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_3.c b/gcc/testsuite/gcc.target/i386/l_fma_float_3.c
index 5db5db8..397618a 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_float_3.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_3.c
@@ -5,7 +5,7 @@
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
 
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 
 #define TYPE float
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_4.c b/gcc/testsuite/gcc.target/i386/l_fma_float_4.c
index 792c5f1..6ba667a 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_float_4.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_4.c
@@ -5,7 +5,7 @@
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
 
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 
 #define TYPE float
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_5.c b/gcc/testsuite/gcc.target/i386/l_fma_float_5.c
index 8be80ad..0f7b3aa 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_float_5.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_5.c
@@ -5,7 +5,7 @@
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
 
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 
 #define TYPE float
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_6.c b/gcc/testsuite/gcc.target/i386/l_fma_float_6.c
index 3d88fdb..f53f0c0 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_float_6.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_6.c
@@ -5,7 +5,7 @@
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
 
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 
 #define TYPE float
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
index 86f74d4..f7aaf25 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_run_double_1.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_1.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
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
index 1f512d2..9bd3a5b 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_run_double_2.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_2.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
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
index b7710e0..eac0e5b 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_run_double_3.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_3.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
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
index 1a0ec54..eca6c0a 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_run_double_4.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_4.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
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
index f0581c8..830574b 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_run_double_5.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_5.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
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
index 981043c..cd869dd 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_run_double_6.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_double_6.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
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
index 36d658d..55c9bcf 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_run_float_1.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_1.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
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
index 7c6d376..e0a9274 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_run_float_2.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_2.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
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
index a94b562..4beac3c 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_run_float_3.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_3.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
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
index c6d51f8..f85dba4 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_run_float_4.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_4.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
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
index ad90804..4de24ea 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_run_float_5.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_5.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
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
index 0bd8103..daaf017 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_run_float_6.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_run_float_6.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-11 10:38                   ` Kirill Yukhin
@ 2011-10-11 10:53                     ` Uros Bizjak
  2011-10-11 10:59                       ` Kirill Yukhin
  2011-10-11 16:12                     ` H.J. Lu
  1 sibling, 1 reply; 24+ messages in thread
From: Uros Bizjak @ 2011-10-11 10:53 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: gcc-patches List, H.J. Lu, vbyakovl23

On Tue, Oct 11, 2011 at 12:12 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:

> Uros, you was right both with fpmath and configflags. That is why it
> was passing for me.
>
> Attached patch which cures the problem.
>
> testsuite/ChangeLog entry:
>
> 2011-10-11  Kirill Yukhin  <kirill.yukhin@intel.com>
>
>        * gcc.target/i386/fma_double_1.c: Add -mfpmath=sse.
>        * gcc.target/i386/fma_double_2.c: Ditto.
>        * gcc.target/i386/fma_double_3.c: Ditto.
>        * gcc.target/i386/fma_double_4.c: Ditto.
>        * gcc.target/i386/fma_double_5.c: Ditto.
>        * gcc.target/i386/fma_double_6.c: Ditto.
>        * gcc.target/i386/fma_float_1.c: Ditto.
>        * gcc.target/i386/fma_float_2.c: Ditto.
>        * gcc.target/i386/fma_float_3.c: Ditto.
>        * gcc.target/i386/fma_float_4.c: Ditto.
>        * gcc.target/i386/fma_float_5.c: Ditto.
>        * gcc.target/i386/fma_float_6.c: Ditto.
>        * gcc.target/i386/l_fma_double_1.c: Ditto.
>        * gcc.target/i386/l_fma_double_2.c: Ditto.
>        * gcc.target/i386/l_fma_double_3.c: Ditto.
>        * gcc.target/i386/l_fma_double_4.c: Ditto.
>        * gcc.target/i386/l_fma_double_5.c: Ditto.
>        * gcc.target/i386/l_fma_double_6.c: Ditto.
>        * gcc.target/i386/l_fma_float_1.c: Ditto.
>        * gcc.target/i386/l_fma_float_2.c: Ditto.
>        * gcc.target/i386/l_fma_float_3.c: Ditto.
>        * gcc.target/i386/l_fma_float_4.c: Ditto.
>        * gcc.target/i386/l_fma_float_5.c: Ditto.
>        * gcc.target/i386/l_fma_float_6.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_1.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_2.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_3.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_4.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_5.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_6.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_1.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_2.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_3.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_4.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_5.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_6.c: Ditto.

OK. (I have also applied your patch to mainline SVN).

Thanks,
Uros.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-11 10:53                     ` Uros Bizjak
@ 2011-10-11 10:59                       ` Kirill Yukhin
  0 siblings, 0 replies; 24+ messages in thread
From: Kirill Yukhin @ 2011-10-11 10:59 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches List, H.J. Lu, vbyakovl23

Thank you!

K

On Tue, Oct 11, 2011 at 2:19 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Tue, Oct 11, 2011 at 12:12 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
>
>> Uros, you was right both with fpmath and configflags. That is why it
>> was passing for me.
>>
>> Attached patch which cures the problem.
>>
>> testsuite/ChangeLog entry:
>>
>> 2011-10-11  Kirill Yukhin  <kirill.yukhin@intel.com>
>>
>>        * gcc.target/i386/fma_double_1.c: Add -mfpmath=sse.
>>        * gcc.target/i386/fma_double_2.c: Ditto.
>>        * gcc.target/i386/fma_double_3.c: Ditto.
>>        * gcc.target/i386/fma_double_4.c: Ditto.
>>        * gcc.target/i386/fma_double_5.c: Ditto.
>>        * gcc.target/i386/fma_double_6.c: Ditto.
>>        * gcc.target/i386/fma_float_1.c: Ditto.
>>        * gcc.target/i386/fma_float_2.c: Ditto.
>>        * gcc.target/i386/fma_float_3.c: Ditto.
>>        * gcc.target/i386/fma_float_4.c: Ditto.
>>        * gcc.target/i386/fma_float_5.c: Ditto.
>>        * gcc.target/i386/fma_float_6.c: Ditto.
>>        * gcc.target/i386/l_fma_double_1.c: Ditto.
>>        * gcc.target/i386/l_fma_double_2.c: Ditto.
>>        * gcc.target/i386/l_fma_double_3.c: Ditto.
>>        * gcc.target/i386/l_fma_double_4.c: Ditto.
>>        * gcc.target/i386/l_fma_double_5.c: Ditto.
>>        * gcc.target/i386/l_fma_double_6.c: Ditto.
>>        * gcc.target/i386/l_fma_float_1.c: Ditto.
>>        * gcc.target/i386/l_fma_float_2.c: Ditto.
>>        * gcc.target/i386/l_fma_float_3.c: Ditto.
>>        * gcc.target/i386/l_fma_float_4.c: Ditto.
>>        * gcc.target/i386/l_fma_float_5.c: Ditto.
>>        * gcc.target/i386/l_fma_float_6.c: Ditto.
>>        * gcc.target/i386/l_fma_run_double_1.c: Ditto.
>>        * gcc.target/i386/l_fma_run_double_2.c: Ditto.
>>        * gcc.target/i386/l_fma_run_double_3.c: Ditto.
>>        * gcc.target/i386/l_fma_run_double_4.c: Ditto.
>>        * gcc.target/i386/l_fma_run_double_5.c: Ditto.
>>        * gcc.target/i386/l_fma_run_double_6.c: Ditto.
>>        * gcc.target/i386/l_fma_run_float_1.c: Ditto.
>>        * gcc.target/i386/l_fma_run_float_2.c: Ditto.
>>        * gcc.target/i386/l_fma_run_float_3.c: Ditto.
>>        * gcc.target/i386/l_fma_run_float_4.c: Ditto.
>>        * gcc.target/i386/l_fma_run_float_5.c: Ditto.
>>        * gcc.target/i386/l_fma_run_float_6.c: Ditto.
>
> OK. (I have also applied your patch to mainline SVN).
>
> Thanks,
> Uros.
>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-11 10:38                   ` Kirill Yukhin
  2011-10-11 10:53                     ` Uros Bizjak
@ 2011-10-11 16:12                     ` H.J. Lu
  2011-10-12 18:12                       ` H.J. Lu
  1 sibling, 1 reply; 24+ messages in thread
From: H.J. Lu @ 2011-10-11 16:12 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Uros Bizjak, gcc-patches List, vbyakovl23

On Tue, Oct 11, 2011 at 3:12 AM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
> Hi
> Uros, you was right both with fpmath and configflags. That is why it
> was passing for me.
>
> Attached patch which cures the problem.
>
> testsuite/ChangeLog entry:
>
> 2011-10-11  Kirill Yukhin  <kirill.yukhin@intel.com>
>
>        * gcc.target/i386/fma_double_1.c: Add -mfpmath=sse.
>        * gcc.target/i386/fma_double_2.c: Ditto.
>        * gcc.target/i386/fma_double_3.c: Ditto.
>        * gcc.target/i386/fma_double_4.c: Ditto.
>        * gcc.target/i386/fma_double_5.c: Ditto.
>        * gcc.target/i386/fma_double_6.c: Ditto.
>        * gcc.target/i386/fma_float_1.c: Ditto.
>        * gcc.target/i386/fma_float_2.c: Ditto.
>        * gcc.target/i386/fma_float_3.c: Ditto.
>        * gcc.target/i386/fma_float_4.c: Ditto.
>        * gcc.target/i386/fma_float_5.c: Ditto.
>        * gcc.target/i386/fma_float_6.c: Ditto.
>        * gcc.target/i386/l_fma_double_1.c: Ditto.
>        * gcc.target/i386/l_fma_double_2.c: Ditto.
>        * gcc.target/i386/l_fma_double_3.c: Ditto.
>        * gcc.target/i386/l_fma_double_4.c: Ditto.
>        * gcc.target/i386/l_fma_double_5.c: Ditto.
>        * gcc.target/i386/l_fma_double_6.c: Ditto.
>        * gcc.target/i386/l_fma_float_1.c: Ditto.
>        * gcc.target/i386/l_fma_float_2.c: Ditto.
>        * gcc.target/i386/l_fma_float_3.c: Ditto.
>        * gcc.target/i386/l_fma_float_4.c: Ditto.
>        * gcc.target/i386/l_fma_float_5.c: Ditto.
>        * gcc.target/i386/l_fma_float_6.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_1.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_2.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_3.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_4.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_5.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_6.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_1.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_2.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_3.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_4.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_5.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_6.c: Ditto.
>
> Could you please have a look?
>
> Sorry for inconvenience, K
>

All double vector tests are failed when GCC is configured with
--with-cpu=atom since double vectorizer is turned off by default.
You should add -mtune=generic to those tests.

-- 
H.J.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-11 16:12                     ` H.J. Lu
@ 2011-10-12 18:12                       ` H.J. Lu
  0 siblings, 0 replies; 24+ messages in thread
From: H.J. Lu @ 2011-10-12 18:12 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Uros Bizjak, gcc-patches List, vbyakovl23

On Tue, Oct 11, 2011 at 8:37 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Oct 11, 2011 at 3:12 AM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
>> Hi
>> Uros, you was right both with fpmath and configflags. That is why it
>> was passing for me.
>>
>> Attached patch which cures the problem.
>>
>> testsuite/ChangeLog entry:
>>
>> 2011-10-11  Kirill Yukhin  <kirill.yukhin@intel.com>
>>
>>        * gcc.target/i386/fma_double_1.c: Add -mfpmath=sse.
>>        * gcc.target/i386/fma_double_2.c: Ditto.
>>        * gcc.target/i386/fma_double_3.c: Ditto.
>>        * gcc.target/i386/fma_double_4.c: Ditto.
>>        * gcc.target/i386/fma_double_5.c: Ditto.
>>        * gcc.target/i386/fma_double_6.c: Ditto.
>>        * gcc.target/i386/fma_float_1.c: Ditto.
>>        * gcc.target/i386/fma_float_2.c: Ditto.
>>        * gcc.target/i386/fma_float_3.c: Ditto.
>>        * gcc.target/i386/fma_float_4.c: Ditto.
>>        * gcc.target/i386/fma_float_5.c: Ditto.
>>        * gcc.target/i386/fma_float_6.c: Ditto.
>>        * gcc.target/i386/l_fma_double_1.c: Ditto.
>>        * gcc.target/i386/l_fma_double_2.c: Ditto.
>>        * gcc.target/i386/l_fma_double_3.c: Ditto.
>>        * gcc.target/i386/l_fma_double_4.c: Ditto.
>>        * gcc.target/i386/l_fma_double_5.c: Ditto.
>>        * gcc.target/i386/l_fma_double_6.c: Ditto.
>>        * gcc.target/i386/l_fma_float_1.c: Ditto.
>>        * gcc.target/i386/l_fma_float_2.c: Ditto.
>>        * gcc.target/i386/l_fma_float_3.c: Ditto.
>>        * gcc.target/i386/l_fma_float_4.c: Ditto.
>>        * gcc.target/i386/l_fma_float_5.c: Ditto.
>>        * gcc.target/i386/l_fma_float_6.c: Ditto.
>>        * gcc.target/i386/l_fma_run_double_1.c: Ditto.
>>        * gcc.target/i386/l_fma_run_double_2.c: Ditto.
>>        * gcc.target/i386/l_fma_run_double_3.c: Ditto.
>>        * gcc.target/i386/l_fma_run_double_4.c: Ditto.
>>        * gcc.target/i386/l_fma_run_double_5.c: Ditto.
>>        * gcc.target/i386/l_fma_run_double_6.c: Ditto.
>>        * gcc.target/i386/l_fma_run_float_1.c: Ditto.
>>        * gcc.target/i386/l_fma_run_float_2.c: Ditto.
>>        * gcc.target/i386/l_fma_run_float_3.c: Ditto.
>>        * gcc.target/i386/l_fma_run_float_4.c: Ditto.
>>        * gcc.target/i386/l_fma_run_float_5.c: Ditto.
>>        * gcc.target/i386/l_fma_run_float_6.c: Ditto.
>>
>> Could you please have a look?
>>
>> Sorry for inconvenience, K
>>
>
> All double vector tests are failed when GCC is configured with
> --with-cpu=atom since double vectorizer is turned off by default.
> You should add -mtune=generic to those tests.
>

I checked in this patch to add -mfpmath=sse/-mtune=generic to FMA tests.
I also removed the extra dg-options.  Tested on Linux/ia32 and Linux/x96-64.


-- 
H.J.
---
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5af301f..11a3cc6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,32 @@
+2011-10-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* gcc.target/i386/fma_run_double_1.c: Add -mfpmath=sse.
+	* gcc.target/i386/fma_run_double_2.c: Likewise.
+	* gcc.target/i386/fma_run_double_3.c: Likewise.
+	* gcc.target/i386/fma_run_double_4.c: Likewise.
+	* gcc.target/i386/fma_run_double_5.c: Likewise.
+	* gcc.target/i386/fma_run_double_6.c: Likewise.
+	* gcc.target/i386/fma_run_float_1.c: Likewise.
+	* gcc.target/i386/fma_run_float_2.c: Likewise.
+	* gcc.target/i386/fma_run_float_3.c: Likewise.
+	* gcc.target/i386/fma_run_float_4.c: Likewise.
+	* gcc.target/i386/fma_run_float_5.c: Likewise.
+	* gcc.target/i386/fma_run_float_6.c: Likewise.
+
+	* gcc.target/i386/l_fma_double_1.c: Add -mtune=generic and
+	remove the extra dg-options.
+	* gcc.target/i386/l_fma_double_2.c: Likewise.
+	* gcc.target/i386/l_fma_double_3.c: Likewise.
+	* gcc.target/i386/l_fma_double_4.c: Likewise.
+	* gcc.target/i386/l_fma_double_5.c: Likewise.
+	* gcc.target/i386/l_fma_double_6.c: Likewise.
+	* gcc.target/i386/l_fma_float_1.c: Likewise.
+	* gcc.target/i386/l_fma_float_2.c: Likewise.
+	* gcc.target/i386/l_fma_float_3.c: Likewise.
+	* gcc.target/i386/l_fma_float_4.c: Likewise.
+	* gcc.target/i386/l_fma_float_5.c: Likewise.
+	* gcc.target/i386/l_fma_float_6.c: Likewise.
+
 2011-10-12  Paul Koning  <pkoning@gcc.gnu.org>

 	PR tree-optimization/50189
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_1.c
b/gcc/testsuite/gcc.target/i386/fma_run_double_1.c
index d46327d..79b219b 100644
--- a/gcc/testsuite/gcc.target/i386/fma_run_double_1.c
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_1.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_2.c
b/gcc/testsuite/gcc.target/i386/fma_run_double_2.c
index 14d325c..ee1c50c 100644
--- a/gcc/testsuite/gcc.target/i386/fma_run_double_2.c
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_2.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_3.c
b/gcc/testsuite/gcc.target/i386/fma_run_double_3.c
index f61f3bf..e55c41f 100644
--- a/gcc/testsuite/gcc.target/i386/fma_run_double_3.c
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_3.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_4.c
b/gcc/testsuite/gcc.target/i386/fma_run_double_4.c
index 36d89ed..5912872 100644
--- a/gcc/testsuite/gcc.target/i386/fma_run_double_4.c
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_4.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_5.c
b/gcc/testsuite/gcc.target/i386/fma_run_double_5.c
index a43af76..701b606 100644
--- a/gcc/testsuite/gcc.target/i386/fma_run_double_5.c
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_5.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_double_6.c
b/gcc/testsuite/gcc.target/i386/fma_run_double_6.c
index b72c87d..5e9756d 100644
--- a/gcc/testsuite/gcc.target/i386/fma_run_double_6.c
+++ b/gcc/testsuite/gcc.target/i386/fma_run_double_6.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_1.c
b/gcc/testsuite/gcc.target/i386/fma_run_float_1.c
index 1ca34af..2c0766a 100644
--- a/gcc/testsuite/gcc.target/i386/fma_run_float_1.c
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_1.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_2.c
b/gcc/testsuite/gcc.target/i386/fma_run_float_2.c
index 380fd3b..701f32f 100644
--- a/gcc/testsuite/gcc.target/i386/fma_run_float_2.c
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_2.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_3.c
b/gcc/testsuite/gcc.target/i386/fma_run_float_3.c
index 0b09056..73e2a8d 100644
--- a/gcc/testsuite/gcc.target/i386/fma_run_float_3.c
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_3.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_4.c
b/gcc/testsuite/gcc.target/i386/fma_run_float_4.c
index e44a62c..860d361 100644
--- a/gcc/testsuite/gcc.target/i386/fma_run_float_4.c
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_4.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_5.c
b/gcc/testsuite/gcc.target/i386/fma_run_float_5.c
index 10c4f2b..93a0c09 100644
--- a/gcc/testsuite/gcc.target/i386/fma_run_float_5.c
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_5.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/fma_run_float_6.c
b/gcc/testsuite/gcc.target/i386/fma_run_float_6.c
index 95c44a1..5004e2d 100644
--- a/gcc/testsuite/gcc.target/i386/fma_run_float_6.c
+++ b/gcc/testsuite/gcc.target/i386/fma_run_float_6.c
@@ -1,7 +1,7 @@
 /* { dg-do run } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_1.c
b/gcc/testsuite/gcc.target/i386/l_fma_double_1.c
index 81f6111..c5d5b6a 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_double_1.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_1.c
@@ -1,13 +1,10 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
-
-
 #define TYPE double

 #include "l_fma_1.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_2.c
b/gcc/testsuite/gcc.target/i386/l_fma_double_2.c
index cb100f6..cc52c75 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_double_2.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_2.c
@@ -1,13 +1,10 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
-
-
 #define TYPE double

 #include "l_fma_2.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_3.c
b/gcc/testsuite/gcc.target/i386/l_fma_double_3.c
index 3aa1139..0e26f2a 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_double_3.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_3.c
@@ -1,13 +1,10 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
-
-
 #define TYPE double

 #include "l_fma_3.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_4.c
b/gcc/testsuite/gcc.target/i386/l_fma_double_4.c
index 97b3a18..0951330 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_double_4.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_4.c
@@ -1,13 +1,10 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
-
-
 #define TYPE double

 #include "l_fma_4.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_5.c
b/gcc/testsuite/gcc.target/i386/l_fma_double_5.c
index 743d5a7..ceb6490 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_double_5.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_5.c
@@ -1,13 +1,10 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
-
-
 #define TYPE double

 #include "l_fma_5.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_double_6.c
b/gcc/testsuite/gcc.target/i386/l_fma_double_6.c
index 4f433d5..4360693 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_double_6.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_double_6.c
@@ -1,13 +1,10 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
-
-
 #define TYPE double

 #include "l_fma_6.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_1.c
b/gcc/testsuite/gcc.target/i386/l_fma_float_1.c
index bc44d15..b2cdbdc 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_float_1.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_1.c
@@ -1,13 +1,10 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
-
-
 #define TYPE float

 #include "l_fma_1.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_2.c
b/gcc/testsuite/gcc.target/i386/l_fma_float_2.c
index 8e4db8a..9926e84 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_float_2.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_2.c
@@ -1,13 +1,10 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
-
-
 #define TYPE float

 #include "l_fma_2.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_3.c
b/gcc/testsuite/gcc.target/i386/l_fma_float_3.c
index 397618a..e365a26 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_float_3.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_3.c
@@ -1,13 +1,10 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
-
-
 #define TYPE float

 #include "l_fma_3.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_4.c
b/gcc/testsuite/gcc.target/i386/l_fma_float_4.c
index 6ba667a..b0ae671 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_float_4.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_4.c
@@ -1,13 +1,10 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
-
-
 #define TYPE float

 #include "l_fma_4.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_5.c
b/gcc/testsuite/gcc.target/i386/l_fma_float_5.c
index 0f7b3aa..d574959 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_float_5.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_5.c
@@ -1,13 +1,10 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
-
-
 #define TYPE float

 #include "l_fma_5.h"
diff --git a/gcc/testsuite/gcc.target/i386/l_fma_float_6.c
b/gcc/testsuite/gcc.target/i386/l_fma_float_6.c
index f53f0c0..7ab8dd3 100644
--- a/gcc/testsuite/gcc.target/i386/l_fma_float_6.c
+++ b/gcc/testsuite/gcc.target/i386/l_fma_float_6.c
@@ -1,13 +1,10 @@
 /* { dg-do compile } */
 /* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfma" } */
+/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */

 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
-
-
 #define TYPE float

 #include "l_fma_6.h"

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-06 13:07           ` Kirill Yukhin
@ 2011-10-15 10:42             ` Andreas Schwab
  2011-10-15 10:45               ` Uros Bizjak
  0 siblings, 1 reply; 24+ messages in thread
From: Andreas Schwab @ 2011-10-15 10:42 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Uros Bizjak, gcc-patches List, H.J. Lu, vbyakovl23

Kirill Yukhin <kirill.yukhin@gmail.com> writes:

> --- /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.*" } */

That prunes too much.  gcc-dg-prune brackets the regexp so that it only
matches within a single line, but your use of ".*" (which also matches
newlines) overrides that and will cause the *whole* output to be thrown
away, including any unrelated error messages.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-15 10:42             ` Andreas Schwab
@ 2011-10-15 10:45               ` Uros Bizjak
  2011-10-15 14:45                 ` Uros Bizjak
  0 siblings, 1 reply; 24+ messages in thread
From: Uros Bizjak @ 2011-10-15 10:45 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Kirill Yukhin, gcc-patches List, H.J. Lu, vbyakovl23

On Sat, Oct 15, 2011 at 10:14 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:

>> --- /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.*" } */
>
> That prunes too much.  gcc-dg-prune brackets the regexp so that it only
> matches within a single line, but your use of ".*" (which also matches
> newlines) overrides that and will cause the *whole* output to be thrown
> away, including any unrelated error messages.

Perhaps e can add -Wno-attributes to dg-options and remove dg-prune-output.

I will look at this possibility and create a patch.

Uros.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-15 10:45               ` Uros Bizjak
@ 2011-10-15 14:45                 ` Uros Bizjak
  2011-10-17 13:17                   ` Kirill Yukhin
  0 siblings, 1 reply; 24+ messages in thread
From: Uros Bizjak @ 2011-10-15 14:45 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Kirill Yukhin, gcc-patches List, H.J. Lu, vbyakovl23

[-- Attachment #1: Type: text/plain, Size: 1275 bytes --]

On Sat, Oct 15, 2011 at 10:32 AM, Uros Bizjak <ubizjak@gmail.com> wrote:

>>> --- /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.*" } */
>>
>> That prunes too much.  gcc-dg-prune brackets the regexp so that it only
>> matches within a single line, but your use of ".*" (which also matches
>> newlines) overrides that and will cause the *whole* output to be thrown
>> away, including any unrelated error messages.
>
> Perhaps e can add -Wno-attributes to dg-options and remove dg-prune-output.
>
> I will look at this possibility and create a patch.

It works.

2011-10-15  Uros Bizjak  <ubizjak@gmail.com>

	* gcc.target/i386/fma_float_?.c (dg-prune_output): Remove.
	(dg-options): Add -Wno-attributes.
	* gcc.target/i386/fma_double_?.c: Ditto.
	* gcc.target/i386/fma_run_float_?.c: Ditto.
	* gcc.target/i386/fma_run_double_?.c: Ditto.
	* gcc.target/i386/l_fma_float_?.c: Dtto.
	* gcc.target/i386/l_fma_double_?.c: Ditto.
	* gcc.target/i386/l_fma_run_float_?.c: Ditto.
	* gcc.target/i386/l_fma_run_double_?.c: Ditto.

Attached patch was tested on x86_64-pc-linux-gnu {,-m32} and committed to SVN.

Uros.

[-- Attachment #2: t.diff.txt --]
[-- Type: text/plain, Size: 28440 bytes --]

Index: gcc.target/i386/fma_run_double_3.c
===================================================================
--- gcc.target/i386/fma_run_double_3.c	(revision 180023)
+++ gcc.target/i386/fma_run_double_3.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_float_5.c
===================================================================
--- gcc.target/i386/fma_float_5.c	(revision 180023)
+++ gcc.target/i386/fma_float_5.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfpmath=sse -mfma" } */
+/* { dg-options "-O2 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_float_5.c
===================================================================
--- gcc.target/i386/l_fma_float_5.c	(revision 180023)
+++ gcc.target/i386/l_fma_float_5.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma -mtune=generic" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_double_1.c
===================================================================
--- gcc.target/i386/fma_double_1.c	(revision 180023)
+++ gcc.target/i386/fma_double_1.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfpmath=sse -mfma" } */
+/* { dg-options "-O2 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_run_float_4.c
===================================================================
--- gcc.target/i386/l_fma_run_float_4.c	(revision 180023)
+++ gcc.target/i386/l_fma_run_float_4.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_double_5.c
===================================================================
--- gcc.target/i386/fma_double_5.c	(revision 180023)
+++ gcc.target/i386/fma_double_5.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfpmath=sse -mfma" } */
+/* { dg-options "-O2 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_run_double_3.c
===================================================================
--- gcc.target/i386/l_fma_run_double_3.c	(revision 180023)
+++ gcc.target/i386/l_fma_run_double_3.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_double_4.c
===================================================================
--- gcc.target/i386/l_fma_double_4.c	(revision 180023)
+++ gcc.target/i386/l_fma_double_4.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma -mtune=generic" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_run_float_4.c
===================================================================
--- gcc.target/i386/fma_run_float_4.c	(revision 180023)
+++ gcc.target/i386/fma_run_float_4.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_float_2.c
===================================================================
--- gcc.target/i386/fma_float_2.c	(revision 180023)
+++ gcc.target/i386/fma_float_2.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfpmath=sse -mfma" } */
+/* { dg-options "-O2 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_float_2.c
===================================================================
--- gcc.target/i386/l_fma_float_2.c	(revision 180023)
+++ gcc.target/i386/l_fma_float_2.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma -mtune=generic" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_run_double_4.c
===================================================================
--- gcc.target/i386/fma_run_double_4.c	(revision 180023)
+++ gcc.target/i386/fma_run_double_4.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_run_float_1.c
===================================================================
--- gcc.target/i386/l_fma_run_float_1.c	(revision 180023)
+++ gcc.target/i386/l_fma_run_float_1.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_float_6.c
===================================================================
--- gcc.target/i386/fma_float_6.c	(revision 180023)
+++ gcc.target/i386/fma_float_6.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfpmath=sse -mfma" } */
+/* { dg-options "-O2 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_float_6.c
===================================================================
--- gcc.target/i386/l_fma_float_6.c	(revision 180023)
+++ gcc.target/i386/l_fma_float_6.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma -mtune=generic" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_double_2.c
===================================================================
--- gcc.target/i386/fma_double_2.c	(revision 180023)
+++ gcc.target/i386/fma_double_2.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfpmath=sse -mfma" } */
+/* { dg-options "-O2 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_run_float_5.c
===================================================================
--- gcc.target/i386/l_fma_run_float_5.c	(revision 180023)
+++ gcc.target/i386/l_fma_run_float_5.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_double_6.c
===================================================================
--- gcc.target/i386/fma_double_6.c	(revision 180023)
+++ gcc.target/i386/fma_double_6.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfpmath=sse -mfma" } */
+/* { dg-options "-O2 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_double_1.c
===================================================================
--- gcc.target/i386/l_fma_double_1.c	(revision 180023)
+++ gcc.target/i386/l_fma_double_1.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma -mtune=generic" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_run_float_1.c
===================================================================
--- gcc.target/i386/fma_run_float_1.c	(revision 180023)
+++ gcc.target/i386/fma_run_float_1.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_run_double_4.c
===================================================================
--- gcc.target/i386/l_fma_run_double_4.c	(revision 180023)
+++ gcc.target/i386/l_fma_run_double_4.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_run_double_1.c
===================================================================
--- gcc.target/i386/fma_run_double_1.c	(revision 180023)
+++ gcc.target/i386/fma_run_double_1.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_double_5.c
===================================================================
--- gcc.target/i386/l_fma_double_5.c	(revision 180023)
+++ gcc.target/i386/l_fma_double_5.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma -mtune=generic" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_run_float_5.c
===================================================================
--- gcc.target/i386/fma_run_float_5.c	(revision 180023)
+++ gcc.target/i386/fma_run_float_5.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_float_3.c
===================================================================
--- gcc.target/i386/fma_float_3.c	(revision 180023)
+++ gcc.target/i386/fma_float_3.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfpmath=sse -mfma" } */
+/* { dg-options "-O2 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_float_3.c
===================================================================
--- gcc.target/i386/l_fma_float_3.c	(revision 180023)
+++ gcc.target/i386/l_fma_float_3.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma -mtune=generic" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_run_double_5.c
===================================================================
--- gcc.target/i386/fma_run_double_5.c	(revision 180023)
+++ gcc.target/i386/fma_run_double_5.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_run_float_2.c
===================================================================
--- gcc.target/i386/l_fma_run_float_2.c	(revision 180023)
+++ gcc.target/i386/l_fma_run_float_2.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_double_3.c
===================================================================
--- gcc.target/i386/fma_double_3.c	(revision 180023)
+++ gcc.target/i386/fma_double_3.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfpmath=sse -mfma" } */
+/* { dg-options "-O2 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_run_float_6.c
===================================================================
--- gcc.target/i386/l_fma_run_float_6.c	(revision 180023)
+++ gcc.target/i386/l_fma_run_float_6.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_run_double_1.c
===================================================================
--- gcc.target/i386/l_fma_run_double_1.c	(revision 180023)
+++ gcc.target/i386/l_fma_run_double_1.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_double_2.c
===================================================================
--- gcc.target/i386/l_fma_double_2.c	(revision 180023)
+++ gcc.target/i386/l_fma_double_2.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma -mtune=generic" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_run_float_2.c
===================================================================
--- gcc.target/i386/fma_run_float_2.c	(revision 180023)
+++ gcc.target/i386/fma_run_float_2.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_run_double_5.c
===================================================================
--- gcc.target/i386/l_fma_run_double_5.c	(revision 180023)
+++ gcc.target/i386/l_fma_run_double_5.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_run_double_2.c
===================================================================
--- gcc.target/i386/fma_run_double_2.c	(revision 180023)
+++ gcc.target/i386/fma_run_double_2.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_double_6.c
===================================================================
--- gcc.target/i386/l_fma_double_6.c	(revision 180023)
+++ gcc.target/i386/l_fma_double_6.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma -mtune=generic" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_run_float_6.c
===================================================================
--- gcc.target/i386/fma_run_float_6.c	(revision 180023)
+++ gcc.target/i386/fma_run_float_6.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_float_4.c
===================================================================
--- gcc.target/i386/fma_float_4.c	(revision 180023)
+++ gcc.target/i386/fma_float_4.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfpmath=sse -mfma" } */
+/* { dg-options "-O2 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_float_4.c
===================================================================
--- gcc.target/i386/l_fma_float_4.c	(revision 180023)
+++ gcc.target/i386/l_fma_float_4.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma -mtune=generic" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_run_double_6.c
===================================================================
--- gcc.target/i386/fma_run_double_6.c	(revision 180023)
+++ gcc.target/i386/fma_run_double_6.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_run_float_3.c
===================================================================
--- gcc.target/i386/l_fma_run_float_3.c	(revision 180023)
+++ gcc.target/i386/l_fma_run_float_3.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_double_4.c
===================================================================
--- gcc.target/i386/fma_double_4.c	(revision 180023)
+++ gcc.target/i386/fma_double_4.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfpmath=sse -mfma" } */
+/* { dg-options "-O2 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_run_double_2.c
===================================================================
--- gcc.target/i386/l_fma_run_double_2.c	(revision 180023)
+++ gcc.target/i386/l_fma_run_double_2.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_double_3.c
===================================================================
--- gcc.target/i386/l_fma_double_3.c	(revision 180023)
+++ gcc.target/i386/l_fma_double_3.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma -mtune=generic" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_run_float_3.c
===================================================================
--- gcc.target/i386/fma_run_float_3.c	(revision 180023)
+++ gcc.target/i386/fma_run_float_3.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/fma_float_1.c
===================================================================
--- gcc.target/i386/fma_float_1.c	(revision 180023)
+++ gcc.target/i386/fma_float_1.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O2 -mfpmath=sse -mfma" } */
+/* { dg-options "-O2 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_run_double_6.c
===================================================================
--- gcc.target/i386/l_fma_run_double_6.c	(revision 180023)
+++ gcc.target/i386/l_fma_run_double_6.c	(working copy)
@@ -1,7 +1,6 @@
 /* { dg-do run } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
 /* { dg-require-effective-target fma } */
-/* { dg-options "-O3 -mfpmath=sse -mfma" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */
Index: gcc.target/i386/l_fma_float_1.c
===================================================================
--- gcc.target/i386/l_fma_float_1.c	(revision 180023)
+++ gcc.target/i386/l_fma_float_1.c	(working copy)
@@ -1,6 +1,5 @@
 /* { dg-do compile } */
-/* { dg-prune-output ".*warning: 'sseregparm' attribute ignored.*" } */
-/* { dg-options "-O3 -mfpmath=sse -mfma -mtune=generic" } */
+/* { dg-options "-O3 -Wno-attributes -mfpmath=sse -mfma -mtune=generic" } */
 
 /* Test that the compiler properly optimizes floating point multiply
    and add instructions into FMA3 instructions.  */

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD
  2011-10-15 14:45                 ` Uros Bizjak
@ 2011-10-17 13:17                   ` Kirill Yukhin
  0 siblings, 0 replies; 24+ messages in thread
From: Kirill Yukhin @ 2011-10-17 13:17 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: Andreas Schwab, gcc-patches List, H.J. Lu, vbyakovl23

Thanks!

K

On Sat, Oct 15, 2011 at 3:08 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Sat, Oct 15, 2011 at 10:32 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>
>>>> --- /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.*" } */
>>>
>>> That prunes too much.  gcc-dg-prune brackets the regexp so that it only
>>> matches within a single line, but your use of ".*" (which also matches
>>> newlines) overrides that and will cause the *whole* output to be thrown
>>> away, including any unrelated error messages.
>>
>> Perhaps e can add -Wno-attributes to dg-options and remove dg-prune-output.
>>
>> I will look at this possibility and create a patch.
>
> It works.
>
> 2011-10-15  Uros Bizjak  <ubizjak@gmail.com>
>
>        * gcc.target/i386/fma_float_?.c (dg-prune_output): Remove.
>        (dg-options): Add -Wno-attributes.
>        * gcc.target/i386/fma_double_?.c: Ditto.
>        * gcc.target/i386/fma_run_float_?.c: Ditto.
>        * gcc.target/i386/fma_run_double_?.c: Ditto.
>        * gcc.target/i386/l_fma_float_?.c: Dtto.
>        * gcc.target/i386/l_fma_double_?.c: Ditto.
>        * gcc.target/i386/l_fma_run_float_?.c: Ditto.
>        * gcc.target/i386/l_fma_run_double_?.c: Ditto.
>
> Attached patch was tested on x86_64-pc-linux-gnu {,-m32} and committed to SVN.
>
> Uros.
>

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2011-10-17 12:41 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-05 11:16 [PATCH, testsuite, i386] FMA3 testcases + typo fix in MD Kirill Yukhin
2011-10-05 18:51 ` Uros Bizjak
2011-10-06  9:48   ` Kirill Yukhin
2011-10-06 10:14     ` Uros Bizjak
2011-10-06 12:58       ` Kirill Yukhin
2011-10-06 13:04         ` Uros Bizjak
2011-10-06 13:05           ` Uros Bizjak
2011-10-06 13:49             ` Kirill Yukhin
2011-10-06 20:17               ` Uros Bizjak
2011-10-09 19:56                 ` Kirill Yukhin
2011-10-10 16:20                   ` H.J. Lu
2011-10-10 16:23                     ` Kirill Yukhin
2011-10-10 21:14               ` Uros Bizjak
2011-10-10 21:18                 ` Uros Bizjak
2011-10-11 10:38                   ` Kirill Yukhin
2011-10-11 10:53                     ` Uros Bizjak
2011-10-11 10:59                       ` Kirill Yukhin
2011-10-11 16:12                     ` H.J. Lu
2011-10-12 18:12                       ` H.J. Lu
2011-10-06 13:07           ` Kirill Yukhin
2011-10-15 10:42             ` Andreas Schwab
2011-10-15 10:45               ` Uros Bizjak
2011-10-15 14:45                 ` Uros Bizjak
2011-10-17 13:17                   ` Kirill Yukhin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).