https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104639
--- Comment #5 from denis.campredon at gmail dot com --- That peace of code seems related but does not need a loop unlike the original one. ------------------ int foo(unsigned i) { return i ? i % 2 : 0; } ------------------ With trunk 12 ------------------------ foo(unsigned int): mov eax, edi xor edx, edx and eax, 1 test edi, edi cmove eax, edx ret ----------------------- With 11.2 ----------------------- foo(unsigned int): mov eax, edi and eax, 1 ret -----------------------