https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80929
--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> --- Created attachment 41861 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41861&action=edit time-i.c: C test case (In reply to Richard Biener from comment #4) > Fixed? No. The attached test case $ avr-gcc-8 time-i.c -mmcu=atmega168 -O2 -S -dp Still uses slow __[u]divmodhi when optimizing for speed. The code has 2 divisions and modulo with 60. The first mod is expanded as mul highpart (insn 25) but the second is expanded as __divmodhi4 call (insn 67): timeid_add: ... ldi r26,lo8(-119) ; 24 *movhi/5 [length = 2] ldi r27,lo8(-120) call __umulhisi3 ; 25 *umulhi3_highpart_call [length = 2] ... ldi r22,lo8(16) ; 61 *movhi/5 [length = 2] ldi r23,lo8(14) call __udivmodhi4 ; 62 *udivmodhi4_call [length = 2] std Z+2,r22 ; 34 movqi_insn/3 [length = 1] movw r24,r18 ; 65 *movhi/1 [length = 1] ldi r22,lo8(60) ; 66 *movhi/5 [length = 2] ldi r23,0 call __divmodhi4 ; 67 *divmodhi4_call [length = 2] std Z+1,r24 ; 50 movqi_insn/3 [length = 1] /* epilogue start */