From: Richard Biener Date: Mon, 10 Nov 2014 14:06:56 +0000 (+0000) Subject: re PR tree-optimization/63798 (FAIL: gcc.target/powerpc/ppc-fmadd-1.c scan-assembler... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3090fa556b469453c5dcddf6617443d26365d9d0;p=gcc.git re PR tree-optimization/63798 (FAIL: gcc.target/powerpc/ppc-fmadd-1.c scan-assembler-not f(add|sub|mul|neg)) 2014-11-10 Richard Biener PR middle-end/63798 * expr.c (expand_expr_real_2): When expanding FMA_EXPRs properly treat the embedded multiplication as commutative when looking for feeding negates. From-SVN: r217287 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a8ecaeaebb2..a2157f63203 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-11-10 Richard Biener + + PR middle-end/63798 + * expr.c (expand_expr_real_2): When expanding FMA_EXPRs + properly treat the embedded multiplication as commutative + when looking for feeding negates. + 2014-11-10 Joern Rennecke * config/avr/avr.h (CPLUSPLUS_CPP_SPEC): Define. diff --git a/gcc/expr.c b/gcc/expr.c index 203e28f56d1..0ef06ea98ae 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -8621,6 +8621,19 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, } def0 = get_def_for_expr (treeop0, NEGATE_EXPR); + /* The multiplication is commutative - look at its 2nd operand + if the first isn't fed by a negate. */ + if (!def0) + { + def0 = get_def_for_expr (treeop1, NEGATE_EXPR); + /* Swap operands if the 2nd operand is fed by a negate. */ + if (def0) + { + tree tem = treeop0; + treeop0 = treeop1; + treeop1 = tem; + } + } def2 = get_def_for_expr (treeop2, NEGATE_EXPR); op0 = op2 = NULL;