https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77308
--- Comment #5 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- Now I try to clear the out register when the shift < 32 Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c (revision 239624) +++ gcc/config/arm/arm.c (working copy) @@ -29159,6 +29159,7 @@ arm_emit_coreregs_64bit_shift (enum rtx_code code, /* Shifts by a constant less than 32. */ rtx reverse_amount = GEN_INT (32 - INTVAL (amount)); + emit_insn (SET (out, const0_rtx)); emit_insn (SET (out_down, LSHIFT (code, in_down, amount))); emit_insn (SET (out_down, ORR (REV_LSHIFT (code, in_up, reverse_amount), @@ -29170,12 +29171,11 @@ arm_emit_coreregs_64bit_shift (enum rtx_code code, /* Shifts by a constant greater than 31. */ rtx adj_amount = GEN_INT (INTVAL (amount) - 32); + emit_insn (SET (out, const0_rtx)); emit_insn (SET (out_down, SHIFT (code, in_up, adj_amount))); if (code == ASHIFTRT) emit_insn (gen_ashrsi3 (out_up, in_up, GEN_INT (31))); - else - emit_insn (SET (out_up, const0_rtx)); } } else result: the stack use goes down from 2960 to 2320 note: this SET is simply redundant, but it makes the out well-defined from the beginning.