This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/66489] combine fails to merge insns if some are reused later on
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 10 Jun 2015 14:53:59 +0000
- Subject: [Bug rtl-optimization/66489] combine fails to merge insns if some are reused later on
- Auto-submitted: auto-generated
- References: <bug-66489-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66489
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For floating point, tree-ssa-math-opts.c handles the FMA and then expand is
supposed to handle the neg inside the FMA_EXPR but for some reason on this
testcase it is not.
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;
if (def0 && def2
&& optab_handler (fnms_optab, mode) != CODE_FOR_nothing)
{
opt = fnms_optab;
op0 = expand_normal (gimple_assign_rhs1 (def0));
op2 = expand_normal (gimple_assign_rhs1 (def2));
}
else if (def0
&& optab_handler (fnma_optab, mode) != CODE_FOR_nothing)
{
opt = fnma_optab;
op0 = expand_normal (gimple_assign_rhs1 (def0));
}
else if (def2
&& optab_handler (fms_optab, mode) != CODE_FOR_nothing)
{
opt = fms_optab;
op2 = expand_normal (gimple_assign_rhs1 (def2));
}
So you are going to need to debug why expr.c is not handling this case for
floating point.
Again for integer, it is a different story. And I doubt for integer it shows
up that often and if it did, the neg could most likely schedule with some other
instruction.