From 2b3fe2e9506bc21ea0846d26251d73bf1d5351cd Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Mon, 6 Jul 2015 11:00:03 +0000 Subject: [PATCH] [AArch64] PR target/66731 Fix fnmul insn with -frounding-math gcc/Changelog: 2015-07-03 Szabolcs Nagy PR target/66731 * config/aarch64/aarch64.md (fnmul3): Handle -frounding-math. gcc/testsuite/Changelog: 2015-07-03 Szabolcs Nagy * 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 | 5 +++++ gcc/config/aarch64/aarch64.md | 10 ++++++++++ gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.target/aarch64/fnmul-1.c | 16 ++++++++++++++++ gcc/testsuite/gcc.target/aarch64/fnmul-2.c | 18 ++++++++++++++++++ gcc/testsuite/gcc.target/aarch64/fnmul-3.c | 16 ++++++++++++++++ gcc/testsuite/gcc.target/aarch64/fnmul-4.c | 16 ++++++++++++++++ 7 files changed, 88 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/fnmul-1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/fnmul-2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/fnmul-3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/fnmul-4.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5e7108a6479..9ee91ff2df2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-07-06 Szabolcs Nagy + + PR target/66731 + * config/aarch64/aarch64.md (fnmul3): Handle -frounding-math. + 2015-07-06 Richard Biener PR middle-end/66759 diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 2d56a75b43f..1e343faecd0 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -4175,6 +4175,16 @@ (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%0, %1, %2" + [(set_attr "type" "fmul")] +) + +(define_insn "*fnmul3" + [(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%0, %1, %2" [(set_attr "type" "fmul")] diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index efe389df056..1f328c7a383 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2015-07-06 Szabolcs Nagy + + * 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 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 index 00000000000..7ec38e0f101 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/fnmul-1.c @@ -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 index 00000000000..f05ee79c843 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/fnmul-2.c @@ -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 index 00000000000..301e9cda3b6 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/fnmul-3.c @@ -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 index 00000000000..9b9bf1bca39 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/fnmul-4.c @@ -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); +} -- 2.30.2