summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-10 16:07:15 +0000
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-10 16:07:15 +0000
commit9383072e87f4d553605ed46e767d35d17cfdcb82 (patch)
tree7175f23be707f864764b8b00f3dea30f5ac5b946 /gcc
parent03abbc5d244919a7f42f483163a72e3cda99fe74 (diff)
downloadgcc-9383072e87f4d553605ed46e767d35d17cfdcb82.tar.gz
Fix a typo in x86 FMA.
gcc/ 2011-10-10 Kirill Yukhin <kirill.yukhin@intel.com> Yakovlev Vladimir <vladimir.b.yakovlev@intel.com> * config/i386/sse.md (fma_fnmsub_<mode>): Fix a typo. gcc/testsuite/ 2011-10-10 Kirill Yukhin <kirill.yukhin@intel.com> Yakovlev Vladimir <vladimir.b.yakovlev@intel.com> * gcc.target/i386/fma_1.h: New file. * gcc.target/i386/fma_2.h: Likewise. * gcc.target/i386/fma_3.h: Likewise. * gcc.target/i386/fma_4.h: Likewise. * gcc.target/i386/fma_5.h: Likewise. * gcc.target/i386/fma_6.h: Likewise. * gcc.target/i386/fma_double_1.c: Likewise. * gcc.target/i386/fma_double_2.c: Likewise. * gcc.target/i386/fma_double_3.c: Likewise. * gcc.target/i386/fma_double_4.c: Likewise. * gcc.target/i386/fma_double_5.c: Likewise. * gcc.target/i386/fma_double_6.c: Likewise. * gcc.target/i386/fma_float_1.c: Likewise. * gcc.target/i386/fma_float_2.c: Likewise. * gcc.target/i386/fma_float_3.c: Likewise. * gcc.target/i386/fma_float_4.c: Likewise. * gcc.target/i386/fma_float_5.c: Likewise. * gcc.target/i386/fma_float_6.c: Likewise. * gcc.target/i386/fma_main.h: Likewise. * gcc.target/i386/fma_run_double_1.c: Likewise. * 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_double_results_1.h: Likewise. * gcc.target/i386/fma_run_double_results_2.h: Likewise. * gcc.target/i386/fma_run_double_results_3.h: Likewise. * gcc.target/i386/fma_run_double_results_4.h: Likewise. * gcc.target/i386/fma_run_double_results_5.h: Likewise. * gcc.target/i386/fma_run_double_results_6.h: 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/fma_run_float_results_1.h: Likewise. * gcc.target/i386/fma_run_float_results_2.h: Likewise. * gcc.target/i386/fma_run_float_results_3.h: Likewise. * gcc.target/i386/fma_run_float_results_4.h: Likewise. * gcc.target/i386/fma_run_float_results_5.h: Likewise. * gcc.target/i386/fma_run_float_results_6.h: Likewise. * gcc.target/i386/l_fma_1.h: Likewise. * gcc.target/i386/l_fma_2.h: Likewise. * gcc.target/i386/l_fma_3.h: Likewise. * gcc.target/i386/l_fma_4.h: Likewise. * gcc.target/i386/l_fma_5.h: Likewise. * gcc.target/i386/l_fma_6.h: Likewise. * gcc.target/i386/l_fma_double_1.c: Likewise. * 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. * gcc.target/i386/l_fma_main.h: Likewise. * gcc.target/i386/l_fma_run_double_1.c: Likewise. * gcc.target/i386/l_fma_run_double_2.c: Likewise. * gcc.target/i386/l_fma_run_double_3.c: Likewise. * gcc.target/i386/l_fma_run_double_4.c: Likewise. * gcc.target/i386/l_fma_run_double_5.c: Likewise. * gcc.target/i386/l_fma_run_double_6.c: Likewise. * gcc.target/i386/l_fma_run_float_1.c: Likewise. * gcc.target/i386/l_fma_run_float_2.c: Likewise. * gcc.target/i386/l_fma_run_float_3.c: Likewise. * gcc.target/i386/l_fma_run_float_4.c: Likewise. * gcc.target/i386/l_fma_run_float_5.c: Likewise. * gcc.target/i386/l_fma_run_float_6.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179758 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/i386/sse.md2
-rw-r--r--gcc/testsuite/ChangeLog78
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_1.h101
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_2.h101
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_3.h101
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_4.h101
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_5.h101
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_6.h101
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_double_1.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_double_2.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_double_3.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_double_4.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_double_5.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_double_6.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_float_1.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_float_2.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_float_3.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_float_4.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_float_5.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_float_6.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_main.h117
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_double_1.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_double_2.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_double_3.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_double_4.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_double_5.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_double_6.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_double_results_1.h54
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_double_results_2.h54
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_double_results_3.h54
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_double_results_4.h54
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_double_results_5.h54
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_double_results_6.h54
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_float_1.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_float_2.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_float_3.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_float_4.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_float_5.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_float_6.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_float_results_1.h54
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_float_results_2.h54
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_float_results_3.h54
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_float_results_4.h54
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_float_results_5.h54
-rw-r--r--gcc/testsuite/gcc.target/i386/fma_run_float_results_6.h54
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_1.h133
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_2.h133
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_3.h133
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_4.h133
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_5.h133
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_6.h133
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_double_1.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_double_2.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_double_3.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_double_4.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_double_5.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_double_6.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_float_1.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_float_2.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_float_3.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_float_4.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_float_5.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_float_6.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_main.h100
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_run_double_1.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_run_double_2.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_run_double_3.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_run_double_4.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_run_double_5.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_run_double_6.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_run_float_1.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_run_float_2.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_run_float_3.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_run_float_4.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_run_float_5.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/l_fma_run_float_6.c16
77 files changed, 3229 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b3219b50c9f..d006b4f40b9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-10 Kirill Yukhin <kirill.yukhin@intel.com>
+ Yakovlev Vladimir <vladimir.b.yakovlev@intel.com>
+
+ * config/i386/sse.md (fma_fnmsub_<mode>): Fix a typo.
+
2011-10-10 Richard Guenther <rguenther@suse.de>
PR middle-end/50389
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index f135716c583..9153352d9a8 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -2009,7 +2009,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/ChangeLog b/gcc/testsuite/ChangeLog
index d3299d8d017..82e1213412f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,81 @@
+2011-10-10 Kirill Yukhin <kirill.yukhin@intel.com>
+ Yakovlev Vladimir <vladimir.b.yakovlev@intel.com>
+
+ * gcc.target/i386/fma_1.h: New file.
+ * gcc.target/i386/fma_2.h: Likewise.
+ * gcc.target/i386/fma_3.h: Likewise.
+ * gcc.target/i386/fma_4.h: Likewise.
+ * gcc.target/i386/fma_5.h: Likewise.
+ * gcc.target/i386/fma_6.h: Likewise.
+ * gcc.target/i386/fma_double_1.c: Likewise.
+ * gcc.target/i386/fma_double_2.c: Likewise.
+ * gcc.target/i386/fma_double_3.c: Likewise.
+ * gcc.target/i386/fma_double_4.c: Likewise.
+ * gcc.target/i386/fma_double_5.c: Likewise.
+ * gcc.target/i386/fma_double_6.c: Likewise.
+ * gcc.target/i386/fma_float_1.c: Likewise.
+ * gcc.target/i386/fma_float_2.c: Likewise.
+ * gcc.target/i386/fma_float_3.c: Likewise.
+ * gcc.target/i386/fma_float_4.c: Likewise.
+ * gcc.target/i386/fma_float_5.c: Likewise.
+ * gcc.target/i386/fma_float_6.c: Likewise.
+ * gcc.target/i386/fma_main.h: Likewise.
+ * gcc.target/i386/fma_run_double_1.c: Likewise.
+ * 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_double_results_1.h: Likewise.
+ * gcc.target/i386/fma_run_double_results_2.h: Likewise.
+ * gcc.target/i386/fma_run_double_results_3.h: Likewise.
+ * gcc.target/i386/fma_run_double_results_4.h: Likewise.
+ * gcc.target/i386/fma_run_double_results_5.h: Likewise.
+ * gcc.target/i386/fma_run_double_results_6.h: 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/fma_run_float_results_1.h: Likewise.
+ * gcc.target/i386/fma_run_float_results_2.h: Likewise.
+ * gcc.target/i386/fma_run_float_results_3.h: Likewise.
+ * gcc.target/i386/fma_run_float_results_4.h: Likewise.
+ * gcc.target/i386/fma_run_float_results_5.h: Likewise.
+ * gcc.target/i386/fma_run_float_results_6.h: Likewise.
+ * gcc.target/i386/l_fma_1.h: Likewise.
+ * gcc.target/i386/l_fma_2.h: Likewise.
+ * gcc.target/i386/l_fma_3.h: Likewise.
+ * gcc.target/i386/l_fma_4.h: Likewise.
+ * gcc.target/i386/l_fma_5.h: Likewise.
+ * gcc.target/i386/l_fma_6.h: Likewise.
+ * gcc.target/i386/l_fma_double_1.c: Likewise.
+ * 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.
+ * gcc.target/i386/l_fma_main.h: Likewise.
+ * gcc.target/i386/l_fma_run_double_1.c: Likewise.
+ * gcc.target/i386/l_fma_run_double_2.c: Likewise.
+ * gcc.target/i386/l_fma_run_double_3.c: Likewise.
+ * gcc.target/i386/l_fma_run_double_4.c: Likewise.
+ * gcc.target/i386/l_fma_run_double_5.c: Likewise.
+ * gcc.target/i386/l_fma_run_double_6.c: Likewise.
+ * gcc.target/i386/l_fma_run_float_1.c: Likewise.
+ * gcc.target/i386/l_fma_run_float_2.c: Likewise.
+ * gcc.target/i386/l_fma_run_float_3.c: Likewise.
+ * gcc.target/i386/l_fma_run_float_4.c: Likewise.
+ * gcc.target/i386/l_fma_run_float_5.c: Likewise.
+ * gcc.target/i386/l_fma_run_float_6.c: Likewise.
+
2011-10-10 Richard Guenther <rguenther@suse.de>
PR middle-end/50389
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 00000000000..72d7373946f
--- /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 00000000000..c5d38d19a1b
--- /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 00000000000..efa88b5d977
--- /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 00000000000..9fbb3efdf1c
--- /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 00000000000..3409db8f4fe
--- /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 00000000000..a6bb4b0cd81
--- /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 00000000000..51196ab60f9
--- /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 00000000000..8536363b2c5
--- /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 00000000000..8ca789fab08
--- /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 00000000000..06a6a123527
--- /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 00000000000..42b37311f59
--- /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 00000000000..4ba0ab19972
--- /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 00000000000..0d5ef645b43
--- /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 00000000000..a7f08972499
--- /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 00000000000..ab837d64212
--- /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 00000000000..7501974c46f
--- /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 00000000000..056b067406f
--- /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 00000000000..58d9f13b403
--- /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 00000000000..24464ab508b
--- /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 00000000000..d46327d23ee
--- /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 00000000000..14d325c3af4
--- /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 00000000000..f61f3bf7664
--- /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 00000000000..36d89ed979f
--- /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 00000000000..a43af769c03
--- /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 00000000000..b72c87d13cb
--- /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 00000000000..27f325b86bf
--- /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 00000000000..f9327ce6501
--- /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 00000000000..44cf82735d1
--- /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 00000000000..0b7f85775cc
--- /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 00000000000..0f96cad0114
--- /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 00000000000..29ae9256c0a
--- /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 00000000000..1ca34af62fe
--- /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 00000000000..380fd3bd742
--- /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 00000000000..0b09056cd36
--- /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 00000000000..e44a62cb92f
--- /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 00000000000..10c4f2beab1
--- /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 00000000000..95c44a1ca13
--- /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 00000000000..65f52f2c75d
--- /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 00000000000..d215efd587c
--- /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 00000000000..11751f131a3
--- /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 00000000000..13906dbdde1
--- /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 00000000000..f156bef6f4f
--- /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 00000000000..d2c2e1f9728
--- /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 00000000000..4a0fd6e0050
--- /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 00000000000..fd64b61fdc3
--- /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 00000000000..226af24a0be
--- /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 00000000000..e33fe25ffd0
--- /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 00000000000..a754812e387
--- /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 00000000000..39be29ad376
--- /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 00000000000..1f3e5281b78
--- /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 00000000000..051396f5185
--- /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 00000000000..1153ed9a169
--- /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 00000000000..804e9ec2ac9
--- /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 00000000000..4d721e75723
--- /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 00000000000..0281fc69770
--- /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 00000000000..a25fa3d6da6
--- /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 00000000000..6d5fb2c548e
--- /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 00000000000..5db5db8bb60
--- /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 00000000000..792c5f128a7
--- /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 00000000000..8be80ad249f
--- /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 00000000000..3d88fdbb930
--- /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 00000000000..a9dc5cd20e5
--- /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 00000000000..86f74d41564
--- /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 00000000000..1f512d2e6ba
--- /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 00000000000..b7710e0ac48
--- /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 00000000000..1a0ec54c4cb
--- /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 00000000000..f0581c85dc2
--- /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 00000000000..981043c3a93
--- /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 00000000000..36d658d61f1
--- /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 00000000000..7c6d37642e9
--- /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 00000000000..a94b5628468
--- /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 00000000000..c6d51f8c5cd
--- /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 00000000000..ad90804e4c3
--- /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 00000000000..0bd8103581d
--- /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"