+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
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. */
*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;