[Bug middle-end/28690] [4.2 Regression] Performace problem with indexed load/stores on powerpc
bergner at vnet dot ibm dot com
gcc-bugzilla@gcc.gnu.org
Sat Aug 26 04:24:00 GMT 2006
------- Comment #3 from bergner at vnet dot ibm dot com 2006-08-26 04:24 -------
Ok, I tracked down where the expander is swapping the operands. It's occuring
at simplify-rtx.c:simplify_binary_operation() at line 1459:
/* Make sure the constant is second. */
if (GET_RTX_CLASS (code) == RTX_COMM_ARITH
&& swap_commutative_operands_p (op0, op1))
{
tem = op0, op0 = op1, op1 = tem;
}
In this particular case, op0 = (reg/v/f:SI 120 [ base ]) and
op1 = (mult:SI (reg/v:SI 121 [ offset ])
(const_int 4 [0x4]))
[src being: int indexedload (int *base, int offset) { return base[offset]; }]
swap_commutative_operands_p(op0,op1) simply returns:
commutative_operand_precedence (op0) < commutative_operand_precedence (op1),
which ends up being "-1 < 4", so we swap the operands. For powerpc, we'd
prefer the base pointer remain the first operand for performance reasons. I'd
like other people familar with this code to comment on how we can fix this.
One could simply bump up the priority of base pointers (ie, "case RTX_OBJ:"),
but I personally don't know how that would affect other platforms.
--
bergner at vnet dot ibm dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bonzini at gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28690
More information about the Gcc-bugs
mailing list