https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77499
--- Comment #13 from kugan at gcc dot gnu.org --- (In reply to avieira from comment #12) > I heard Kugan was working on getting rid of superfluous zero_extends. Adding > him to the watch list. > > @Kugan: Could your work help this case? And when do you plan to have it > submitted? Thanks for the testcase. With my type promotion pass, I am getting: cmp r1, r2 ble .L10 - push {r4, r5, r6, r7} - ldr r7, .L14 + push {r4, r5, r6, lr} + ldr r5, .L14 movw r6, #45345 .L4: - smull r5, r4, r7, r1 + smull lr, r4, r5, r1 lsrs r0, r0, #1 sub r4, r4, r1, asr #31 - eor r5, r0, r6 add r4, r4, r4, lsl #1 cmp r1, r4 sub r1, r1, r3 it ne - uxthne r0, r5 + eorne r0, r0, r6 cmp r2, r1 blt .L4 - pop {r4, r5, r6, r7} - bx lr + uxth r0, r0 + pop {r4, r5, r6, pc} .L10: + uxth r0, r0 bx lr .L15: .align 2 .L14: .word 1431655766 .size foo, .-foo Even though, extension is removed from loop, it has an extra uxth. I have some cases like this to look at before I post the patch again. I am afraid, I will not be able to do it during this stage1.