------- Comment #29 from steven at gcc dot gnu dot org 2008-11-30 21:32 ------- The insns 8 in comment #0 show the regmove transformation that matters here:
With regmove disabled:: (insn:HI 8 7 14 2 ../../include/mmintrin.h:300 (set (reg:V2SI 61) (plus:V2SI (reg:V2SI 63 [ x ]) (mem/c/i:V2SI (symbol_ref:DI ("y") <var_decl 0x7f66abfb5c80 y>) [2 y +0 S8 A64]))) 992 {*mmx_addv2si3} (expr_list:REG_DEAD (reg:V2SI 63 [ x ]) (nil))) vs. with regmove enabled: (insn:HI 8 7 14 2 ../../include/mmintrin.h:300 (set (reg:V2SI 63 [ x ]) (plus:V2SI (reg:V2SI 63 [ x ]) (mem/c/i:V2SI (symbol_ref:DI ("y") <var_decl 0x7fd36e03cc80 y>) [2 y+0 S8 A64]))) 992 {*mmx_addv2si3} (nil)) This is a "textbook" example of a regmove transformation (where the use of the word "textbook" is an insult to all textbooks ever written, since nothing in regmove is "textbook", but oh well...). It's turned a 3-address instruction into a 2-address instruction, and this is precisely the transformation that regmove was originally written for. In IRA, I would've expected reg 61 and reg 63 to be coalesced to give the same result. Vlad already commented on this in comment #6. It's clear from his description why IRA did not coalesce reg 61 and reg 63. Other compilers do this kind of transformation via reverse copy propagation. GCC could perhaps add something like that too, when it transforms a 3-address insn to a 2-address insn. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37364