From: Szabolcs Nagy Date: Tue, 4 Aug 2015 16:22:32 +0000 (+0000) Subject: [AArch64] PR target/66731 Fix fnmul insn with -frounding-math (rtx costs) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d318517df81e3d9afa44dadc8f81aa4a566af392;p=gcc.git [AArch64] PR target/66731 Fix fnmul insn with -frounding-math (rtx costs) 2015-08-04 Szabolcs Nagy 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c6dc552e755..7a3bf601828 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-08-04 Szabolcs Nagy + + 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 * 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 a91fda8db3d..1394ed7decc 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;