https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61231
Alan Modra <amodra at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2014-05-21 CC| |amodra at gmail dot com Assignee|unassigned at gcc dot gnu.org |amodra at gmail dot com Ever confirmed|0 |1 --- Comment #9 from Alan Modra <amodra at gmail dot com> --- So, what's happening here on the testcase is that before r210519, from the ira dump for pseudo reg 171 we have a15 (r171,l0) best GENERAL_REGS, allocno GENERAL_REGS a15(r171,l0) costs: BASE_REGS:0,0 GENERAL_REGS:0,0 NON_SPECIAL_REGS:3264,3264 LINK_REGS:1224,1224 CTR_REGS:1224,1224 LINK_OR_CTR_REGS:1224,1224 SPECIAL_REGS:1224,1224 SPEC_OR_GEN_REGS:1224,1224 NON_FLOAT_REGS:4896,4896 ALL_REGS:4896,4896 MEM:0,0 and after a15 (r171,l0) best NO_REGS, allocno NO_REGS a15(r171,l0) costs: BASE_REGS:0,0 GENERAL_REGS:0,0 NON_SPECIAL_REGS:1224,1224 LINK_REGS:1224,1224 CTR_REGS:1224,1224 LINK_OR_CTR_REGS:1224,1224 SPECIAL_REGS:1224,1224 SPEC_OR_GEN_REGS:1224,1224 NON_FLOAT_REGS:2448,2448 ALL_REGS:2448,2448 MEM:-320,-320 (hmm, negative cost, is that really allowed??) Going into reload, both before and after r210519, we have (insn 57 60 59 10 (set (reg:SI 171 [ MEM[(char * {ref-all})data_p_9(D) + 2B] ]) (mem:SI (plus:DI (reg/v/f:DI 151 [ data_p ]) (const_int 2 [0x2])) [0 MEM[(char * {ref-all})data_p_9(D) + 2B]+0 S4 A8])) /src/tmp/pr61231.ii:68 442 {*movsi_internal1} (expr_list:REG_EQUIV (mem:SI (plus:DI (reg/v/f:DI 151 [ data_p ]) (const_int 2 [0x2])) [0 MEM[(char * {ref-all})data_p_9(D) + 2B]+0 S4 A8]) (nil))) (insn 59 57 61 10 (set (reg:DI 3 3) (sign_extend:DI (reg:SI 171 [ MEM[(char * {ref-all})data_p_9(D) + 2B] ]))) /src/tmp/pr61231.ii:68 29 {*extendsidi2_nocell} (expr_list:REG_DEAD (reg:SI 171 [ MEM[(char * {ref-all})data_p_9(D) + 2B] ]) (nil))) So before r210519, reload puts reg 171 into a gpr and we keep both insn 57 (which results in lwz) and insn 59 (which results in extsw). After r210519, insn 57 is deleted because reg 171 has an equivalent mem, and the mem from insn 57 is inserted into insn 59. This matches the "m" constraint on extendsidi2_nocell so reload thinks everything is good. THE lwa_operand PREDICATE IS NOT CHECKED AGAIN! Which is standard reload behaviour.. This is a bug in rs6000.md. extendsidi2_nocell ought to be using the "Y" constraint, and there needs to be a small modification to mem_operand_gpr to make it work with SImode.