https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95529
Gabriel Ravier <gabravier at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Failure to reuse flags |Failure to reuse flags |generated by trailing zeros |generated by TZCNT for |instruction for cmovcc |cmovcc on BMI-capable | |targets Resolution|WONTFIX |--- Status|RESOLVED |UNCONFIRMED --- Comment #3 from Gabriel Ravier <gabravier at gmail dot com> --- Also, I misread your message, so I can see that LLVM doesn't seem to have invalid behaviour (unless I misread it twice), but I don't think it should make the bug report invalid altogether. I've reopened the bug report and changed the name to make it clearer. GCC emits this for -O3 -mbmi : f(int): xor eax, eax mov edx, 24 tzcnt eax, edi test edi, edi cmove eax, edx ret LLVM emits this : f(int): # @f(int) tzcnt ecx, edi mov eax, 24 cmovae eax, ecx ret If you believe that GCC shouldn't consider it safe to assume the processor is BMI-capable when -mbmi is used (which seems rather odd but ok), feel free to close this bug report again, otherwise I believe it should stay open.