Postreload may transform (set (REGX) (CONST_INT A)) ... (set (REGX) (CONST_INT B)) to (set (REGX) (CONST_INT A)) ... (set (STRICT_LOW_PART (REGX)) (CONST_INT B)), but it should do that only if the latter is cheaper. On m68k, a full word load of a small constant with moveq is cheaper than doing a byte load with move.b.
Tested on m68k-suse-linux and x86_64-suse-linux. In both cases the size of cc1* becomes smaller with this change. Andreas. PR rtl-optimization/54555 * postreload.c (move2add_use_add2_insn): Only substitute STRICT_LOW_PART if it is cheaper. --- gcc/postreload.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gcc/postreload.c b/gcc/postreload.c index 9d71649..89f0c84 100644 --- a/gcc/postreload.c +++ b/gcc/postreload.c @@ -1805,10 +1805,14 @@ move2add_use_add2_insn (rtx reg, rtx sym, rtx off, rtx insn) gen_rtx_STRICT_LOW_PART (VOIDmode, narrow_reg), narrow_src); - changed = validate_change (insn, &PATTERN (insn), - new_set, 0); - if (changed) - break; + get_full_set_rtx_cost (new_set, &newcst); + if (costs_lt_p (&newcst, &oldcst, speed)) + { + changed = validate_change (insn, &PATTERN (insn), + new_set, 0); + if (changed) + break; + } } } } -- 2.0.0 -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."