aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2015-08-04 16:22:32 +0000
committerSzabolcs Nagy <nsz@gcc.gnu.org>2015-08-04 16:22:32 +0000
commitd318517df81e3d9afa44dadc8f81aa4a566af392 (patch)
tree46be3af317802164fb32ee503cdc9fef41630e42 /gcc
parent4b5ed6cf575f29f17bad46f10a7b1c3f4a7bdd08 (diff)
downloadgcc-d318517df81e3d9afa44dadc8f81aa4a566af392.zip
gcc-d318517df81e3d9afa44dadc8f81aa4a566af392.tar.gz
gcc-d318517df81e3d9afa44dadc8f81aa4a566af392.tar.bz2
[AArch64] PR target/66731 Fix fnmul insn with -frounding-math (rtx costs)
2015-08-04 Szabolcs Nagy <szabolcs.nagy@arm.com> PR target/66731 * config/aarch64/aarch64.c (aarch64_rtx_costs): Fix NEG cost for FNMUL. (aarch64_rtx_mult_cost): Fix MULT cost with -frounding-math. From-SVN: r226586
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/aarch64/aarch64.c22
2 files changed, 23 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c6dc552..7a3bf60 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-08-04 Szabolcs Nagy <szabolcs.nagy@arm.com>
+
+ PR target/66731
+ * config/aarch64/aarch64.c (aarch64_rtx_costs): Fix NEG cost for FNMUL.
+ (aarch64_rtx_mult_cost): Fix MULT cost with -frounding-math.
+
2015-08-04 Richard Biener <rguenther@suse.de>
* genmatch.c (dt_node::gen_kids_1): Use gassign and gcall in
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index a91fda8..1394ed7 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5465,11 +5465,17 @@ aarch64_rtx_mult_cost (rtx x, enum rtx_code code, int outer, bool speed)
if (speed)
{
/* Floating-point FMA/FMUL can also support negations of the
- operands. */
- if (GET_CODE (op0) == NEG)
- op0 = XEXP (op0, 0);
- if (GET_CODE (op1) == NEG)
- op1 = XEXP (op1, 0);
+ operands, unless the rounding mode is upward or downward in
+ which case FNMUL is different than FMUL with operand negation. */
+ bool neg0 = GET_CODE (op0) == NEG;
+ bool neg1 = GET_CODE (op1) == NEG;
+ if (compound_p || !flag_rounding_math || (neg0 && neg1))
+ {
+ if (neg0)
+ op0 = XEXP (op0, 0);
+ if (neg1)
+ op1 = XEXP (op1, 0);
+ }
if (compound_p)
/* FMADD/FNMADD/FNMSUB/FMSUB. */
@@ -5991,6 +5997,12 @@ aarch64_rtx_costs (rtx x, machine_mode mode, int outer ATTRIBUTE_UNUSED,
*cost = rtx_cost (op0, mode, NEG, 0, speed);
return true;
}
+ if (GET_CODE (op0) == MULT)
+ {
+ /* FNMUL. */
+ *cost = rtx_cost (op0, mode, NEG, 0, speed);
+ return true;
+ }
if (speed)
/* FNEG. */
*cost += extra_cost->fp[mode == DFmode].neg;