[Bug middle-end/28690] [4.2 Regression] Performace problem with indexed load/stores on powerpc

bonzini at gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Sep 3 13:51:00 GMT 2006

------- Comment #4 from bonzini at gnu dot org  2006-09-03 13:51 -------
> 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.

Very much.  The canonical form enforced by swap_commutative_operands_p is
relied upon by all the code for simplifications, that expects for example a
(plus (mult A B) C) and not a (plus C (mult A B)).

If one took care to fix all of them, it could work, but it's no easy feat. :-(

I think the best solution (if it works) is to put this transformation in
rs6000's legitimize_address. Given a (plus (mult A B) C), force the mult into a
pseudo (let's call it D) and then return (plus C D) with the operands swapped.



More information about the Gcc-bugs mailing list