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