[AArch64] PR target/66731 Fix fnmul insn with -frounding-math
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Mon, 6 Jul 2015 11:00:03 +0000 (11:00 +0000)
committerSzabolcs Nagy <nsz@gcc.gnu.org>
Mon, 6 Jul 2015 11:00:03 +0000 (11:00 +0000)
gcc/Changelog:

2015-07-03  Szabolcs Nagy  <szabolcs.nagy@arm.com>

PR target/66731
* config/aarch64/aarch64.md (fnmul<mode>3): Handle -frounding-math.

gcc/testsuite/Changelog:

2015-07-03  Szabolcs Nagy  <szabolcs.nagy@arm.com>

* gcc.target/aarch64/fnmul-1.c: New.
* gcc.target/aarch64/fnmul-2.c: New.
* gcc.target/aarch64/fnmul-3.c: New.
* gcc.target/aarch64/fnmul-4.c: New.

From-SVN: r225450

gcc/ChangeLog
gcc/config/aarch64/aarch64.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/fnmul-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/fnmul-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/fnmul-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/fnmul-4.c [new file with mode: 0644]

index 5e7108a64792adac10795e899a3e06e6d11e1018..9ee91ff2df25f1e2ff94db0e32e69096c249b924 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-06  Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+       PR target/66731
+       * config/aarch64/aarch64.md (fnmul<mode>3): Handle -frounding-math.
+
 2015-07-06  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/66759
index 2d56a75b43fe548642557f865ac37e790740274b..1e343faecd0c0fab97d92d864480e9abad60c644 100644 (file)
         (mult:GPF
                 (neg:GPF (match_operand:GPF 1 "register_operand" "w"))
                 (match_operand:GPF 2 "register_operand" "w")))]
+  "TARGET_FLOAT && !flag_rounding_math"
+  "fnmul\\t%<s>0, %<s>1, %<s>2"
+  [(set_attr "type" "fmul<s>")]
+)
+
+(define_insn "*fnmul<mode>3"
+  [(set (match_operand:GPF 0 "register_operand" "=w")
+        (neg:GPF (mult:GPF
+                (match_operand:GPF 1 "register_operand" "w")
+                (match_operand:GPF 2 "register_operand" "w"))))]
   "TARGET_FLOAT"
   "fnmul\\t%<s>0, %<s>1, %<s>2"
   [(set_attr "type" "fmul<s>")]
index efe389df056d39a6546ac8215971143dffba0fcf..1f328c7a383176de7ca51b9c3930c80f85c9ac19 100644 (file)
@@ -1,3 +1,10 @@
+2015-07-06  Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+       * gcc.target/aarch64/fnmul-1.c: New.
+       * gcc.target/aarch64/fnmul-2.c: New.
+       * gcc.target/aarch64/fnmul-3.c: New.
+       * gcc.target/aarch64/fnmul-4.c: New.
+
 2015-07-06  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/66759
diff --git a/gcc/testsuite/gcc.target/aarch64/fnmul-1.c b/gcc/testsuite/gcc.target/aarch64/fnmul-1.c
new file mode 100644 (file)
index 0000000..7ec38e0
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+double
+foo_d (double a, double b)
+{
+       /* { dg-final { scan-assembler "fnmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */
+       return -a * b;
+}
+
+float
+foo_s (float a, float b)
+{
+       /* { dg-final { scan-assembler "fnmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */
+       return -a * b;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/fnmul-2.c b/gcc/testsuite/gcc.target/aarch64/fnmul-2.c
new file mode 100644 (file)
index 0000000..f05ee79
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -frounding-math" } */
+
+double
+foo_d (double a, double b)
+{
+       /* { dg-final { scan-assembler "fneg\\td\[0-9\]+, d\[0-9\]+" } } */
+       /* { dg-final { scan-assembler "fmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */
+       return -a * b;
+}
+
+float
+foo_s (float a, float b)
+{
+       /* { dg-final { scan-assembler "fneg\\ts\[0-9\]+, s\[0-9\]+" } } */
+       /* { dg-final { scan-assembler "fmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */
+       return -a * b;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/fnmul-3.c b/gcc/testsuite/gcc.target/aarch64/fnmul-3.c
new file mode 100644 (file)
index 0000000..301e9cd
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+double
+foo_d (double a, double b)
+{
+       /* { dg-final { scan-assembler "fnmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */
+       return -(a * b);
+}
+
+float
+foo_s (float a, float b)
+{
+       /* { dg-final { scan-assembler "fnmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */
+       return -(a * b);
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/fnmul-4.c b/gcc/testsuite/gcc.target/aarch64/fnmul-4.c
new file mode 100644 (file)
index 0000000..9b9bf1b
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -frounding-math" } */
+
+double
+foo_d (double a, double b)
+{
+       /* { dg-final { scan-assembler "fnmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */
+       return -(a * b);
+}
+
+float
+foo_s (float a, float b)
+{
+       /* { dg-final { scan-assembler "fnmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */
+       return -(a * b);
+}