https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43908
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|rtl-optimization |target Summary|Redundant conditionals [4.5 |Unnecessary mov of a |only] - unnecessary mov of |constant after unrolling. |a constant after unrolling. | Last reconfirmed|2021-07-26 00:00:00 |2024-11-19 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- I can still see the redundant load of #1 with a trunk compiler build in April 2024: sigh: @ Function supports interworking. @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. mov r3, #1 tst r1, #1 streq r3, [r0, #4] strne r3, [r0] mov r3, #1 tst r1, #2 streq r3, [r0, #4] strne r3, [r0] mov r3, #1 tst r1, #4 streq r3, [r0, #4] strne r3, [r0] mov r3, #1 tst r1, #8 streq r3, [r0, #4] strne r3, [r0] mov r3, #1 tst r1, #16 streq r3, [r0, #4] strne r3, [r0] mov r3, #1 tst r1, #32 streq r3, [r0, #4] strne r3, [r0] mov r3, #1 tst r1, #64 streq r3, [r0, #4] strne r3, [r0] mov r3, #1 tst r1, #128 strne r3, [r0] streq r3, [r0, #4] bx lr in particular we also fail to apply conditional store-motion (we refuse because the access can trap). Enabling that makes somewhat a mess out of the code though. I'm quite sure the mov issue is a target issue.