--- gcc/modulo-sched.c (/gcc-local/trunk) (revision 30596) +++ gcc/modulo-sched.c (/gcc-local/export-ddg) (revision 30596) @@ -652,10 +653,19 @@ generate_prolog_epilog (partial_schedule /* Generate the prolog, inserting its insns on the loop-entry edge. */ start_sequence (); - if (count_reg) /* Generate a subtract instruction at the beginning of the prolog to adjust the loop count by STAGE_COUNT. */ - emit_insn (gen_sub2_insn (count_reg, GEN_INT (last_stage))); + if (count_reg) + { + rtx sub_reg = NULL_RTX; + + sub_reg = expand_simple_binop (GET_MODE (count_reg), MINUS, + count_reg, GEN_INT (last_stage), + count_reg, 1, OPTAB_DIRECT); + gcc_assert (REG_P (sub_reg)); + if (REGNO (sub_reg) != REGNO (count_reg)) + emit_move_insn (count_reg, sub_reg); + } for (i = 0; i < last_stage; i++) duplicate_insns_of_cycles (ps, 0, i, 1);