|
|
25c7f1 |
2015-08-04 Szabolcs Nagy <szabolcs.nagy@arm.com>
|
|
|
25c7f1 |
|
|
|
25c7f1 |
Backport from mainline:
|
|
|
25c7f1 |
2015-07-06 Szabolcs Nagy <szabolcs.nagy@arm.com>
|
|
|
25c7f1 |
|
|
|
25c7f1 |
PR target/66731
|
|
|
25c7f1 |
* config/aarch64/aarch64.md (fnmul<mode>3): Handle -frounding-math.
|
|
|
25c7f1 |
|
|
|
25c7f1 |
* gcc.target/aarch64/fnmul-1.c: New.
|
|
|
25c7f1 |
* gcc.target/aarch64/fnmul-2.c: New.
|
|
|
25c7f1 |
* gcc.target/aarch64/fnmul-3.c: New.
|
|
|
25c7f1 |
* gcc.target/aarch64/fnmul-4.c: New.
|
|
|
25c7f1 |
|
|
|
25c7f1 |
--- gcc/config/aarch64/aarch64.md (revision 226591)
|
|
|
25c7f1 |
+++ gcc/config/aarch64/aarch64.md (revision 226592)
|
|
|
25c7f1 |
@@ -3101,6 +3101,17 @@
|
|
|
25c7f1 |
(mult:GPF
|
|
|
25c7f1 |
(neg:GPF (match_operand:GPF 1 "register_operand" "w"))
|
|
|
25c7f1 |
(match_operand:GPF 2 "register_operand" "w")))]
|
|
|
25c7f1 |
+ "TARGET_FLOAT && !flag_rounding_math"
|
|
|
25c7f1 |
+ "fnmul\\t%<s>0, %<s>1, %<s>2"
|
|
|
25c7f1 |
+ [(set_attr "v8type" "fmul")
|
|
|
25c7f1 |
+ (set_attr "mode" "<MODE>")]
|
|
|
25c7f1 |
+)
|
|
|
25c7f1 |
+
|
|
|
25c7f1 |
+(define_insn "*fnmul<mode>3"
|
|
|
25c7f1 |
+ [(set (match_operand:GPF 0 "register_operand" "=w")
|
|
|
25c7f1 |
+ (neg:GPF (mult:GPF
|
|
|
25c7f1 |
+ (match_operand:GPF 1 "register_operand" "w")
|
|
|
25c7f1 |
+ (match_operand:GPF 2 "register_operand" "w"))))]
|
|
|
25c7f1 |
"TARGET_FLOAT"
|
|
|
25c7f1 |
"fnmul\\t%<s>0, %<s>1, %<s>2"
|
|
|
25c7f1 |
[(set_attr "v8type" "fmul")
|
|
|
25c7f1 |
--- gcc/testsuite/gcc.target/aarch64/fnmul-1.c (nonexistent)
|
|
|
25c7f1 |
+++ gcc/testsuite/gcc.target/aarch64/fnmul-1.c (revision 226592)
|
|
|
25c7f1 |
@@ -0,0 +1,16 @@
|
|
|
25c7f1 |
+/* { dg-do compile } */
|
|
|
25c7f1 |
+/* { dg-options "-O2" } */
|
|
|
25c7f1 |
+
|
|
|
25c7f1 |
+double
|
|
|
25c7f1 |
+foo_d (double a, double b)
|
|
|
25c7f1 |
+{
|
|
|
25c7f1 |
+ /* { dg-final { scan-assembler "fnmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */
|
|
|
25c7f1 |
+ return -a * b;
|
|
|
25c7f1 |
+}
|
|
|
25c7f1 |
+
|
|
|
25c7f1 |
+float
|
|
|
25c7f1 |
+foo_s (float a, float b)
|
|
|
25c7f1 |
+{
|
|
|
25c7f1 |
+ /* { dg-final { scan-assembler "fnmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */
|
|
|
25c7f1 |
+ return -a * b;
|
|
|
25c7f1 |
+}
|
|
|
25c7f1 |
--- gcc/testsuite/gcc.target/aarch64/fnmul-2.c (nonexistent)
|
|
|
25c7f1 |
+++ gcc/testsuite/gcc.target/aarch64/fnmul-2.c (revision 226592)
|
|
|
25c7f1 |
@@ -0,0 +1,18 @@
|
|
|
25c7f1 |
+/* { dg-do compile } */
|
|
|
25c7f1 |
+/* { dg-options "-O2 -frounding-math" } */
|
|
|
25c7f1 |
+
|
|
|
25c7f1 |
+double
|
|
|
25c7f1 |
+foo_d (double a, double b)
|
|
|
25c7f1 |
+{
|
|
|
25c7f1 |
+ /* { dg-final { scan-assembler "fneg\\td\[0-9\]+, d\[0-9\]+" } } */
|
|
|
25c7f1 |
+ /* { dg-final { scan-assembler "fmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */
|
|
|
25c7f1 |
+ return -a * b;
|
|
|
25c7f1 |
+}
|
|
|
25c7f1 |
+
|
|
|
25c7f1 |
+float
|
|
|
25c7f1 |
+foo_s (float a, float b)
|
|
|
25c7f1 |
+{
|
|
|
25c7f1 |
+ /* { dg-final { scan-assembler "fneg\\ts\[0-9\]+, s\[0-9\]+" } } */
|
|
|
25c7f1 |
+ /* { dg-final { scan-assembler "fmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */
|
|
|
25c7f1 |
+ return -a * b;
|
|
|
25c7f1 |
+}
|
|
|
25c7f1 |
--- gcc/testsuite/gcc.target/aarch64/fnmul-3.c (nonexistent)
|
|
|
25c7f1 |
+++ gcc/testsuite/gcc.target/aarch64/fnmul-3.c (revision 226592)
|
|
|
25c7f1 |
@@ -0,0 +1,16 @@
|
|
|
25c7f1 |
+/* { dg-do compile } */
|
|
|
25c7f1 |
+/* { dg-options "-O2" } */
|
|
|
25c7f1 |
+
|
|
|
25c7f1 |
+double
|
|
|
25c7f1 |
+foo_d (double a, double b)
|
|
|
25c7f1 |
+{
|
|
|
25c7f1 |
+ /* { dg-final { scan-assembler "fnmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */
|
|
|
25c7f1 |
+ return -(a * b);
|
|
|
25c7f1 |
+}
|
|
|
25c7f1 |
+
|
|
|
25c7f1 |
+float
|
|
|
25c7f1 |
+foo_s (float a, float b)
|
|
|
25c7f1 |
+{
|
|
|
25c7f1 |
+ /* { dg-final { scan-assembler "fnmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */
|
|
|
25c7f1 |
+ return -(a * b);
|
|
|
25c7f1 |
+}
|
|
|
25c7f1 |
--- gcc/testsuite/gcc.target/aarch64/fnmul-4.c (nonexistent)
|
|
|
25c7f1 |
+++ gcc/testsuite/gcc.target/aarch64/fnmul-4.c (revision 226592)
|
|
|
25c7f1 |
@@ -0,0 +1,16 @@
|
|
|
25c7f1 |
+/* { dg-do compile } */
|
|
|
25c7f1 |
+/* { dg-options "-O2 -frounding-math" } */
|
|
|
25c7f1 |
+
|
|
|
25c7f1 |
+double
|
|
|
25c7f1 |
+foo_d (double a, double b)
|
|
|
25c7f1 |
+{
|
|
|
25c7f1 |
+ /* { dg-final { scan-assembler "fnmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */
|
|
|
25c7f1 |
+ return -(a * b);
|
|
|
25c7f1 |
+}
|
|
|
25c7f1 |
+
|
|
|
25c7f1 |
+float
|
|
|
25c7f1 |
+foo_s (float a, float b)
|
|
|
25c7f1 |
+{
|
|
|
25c7f1 |
+ /* { dg-final { scan-assembler "fnmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */
|
|
|
25c7f1 |
+ return -(a * b);
|
|
|
25c7f1 |
+}
|