https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69403
--- Comment #2 from ktkachov at gcc dot gnu.org --- I agree that the pattern is buggy but I can't get the bad codegen to trigger on any of 4.9, 5 or trunk. I get a branch over lines 26 and 27: bug: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 cmp r0, r2 push {r3, r4, r5, r6, r7, lr} bcc .L9 mvn r0, #-2147483648 pop {r3, r4, r5, r6, r7, pc} .L9: mov r7, r2 mov r5, r1 mov r4, r0 bl FT_MSB rsb r2, r0, #31 adds r6, r0, #1 lsl r3, r4, r2 lsr r1, r5, r6 orrs r3, r3, r1 lsl r1, r5, r2 udiv r0, r3, r7 mls r3, r7, r0, r3 .L4: lsrs r2, r1, #31 lsls r0, r0, #1 orr r3, r2, r3, lsl #1 lsls r1, r1, #1 cmp r7, r3 bhi .L3 subs r3, r3, r7 orr r0, r0, #1 .L3: subs r6, r6, #1 bne .L4 pop {r3, r4, r5, r6, r7, pc} I'll fix the *thumb2_ior_scc_strict_it. I believe the first alternative should just be deleted and operand 0 be made an earlyclobber, but an executable testcase triggering this problem would be useful for the testsuite. Are there any implicit tuning options that are used? i.e. some particular --with-tune or --with-cpu configure option?