------- Comment #23 from bonzini at gnu dot org 2007-12-19 13:36 ------- Created an attachment (id=14794) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14794&action=view) teach combine that reg = op(reg, mem) is better
Since combine operates on the whole pattern, it can be taught the trick that swap_commutative_operands_with_target does in optabs.c. This is the "right way" to do the hack Uros proposed in comment #18. Note that optabs.c does not get it because it creates reg=subreg*subreg. Then CSE creates SImode memory loads from the subreg, and combine creates reg=mem*reg. With this patch, combine creates reg=reg*mem instead. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17236