On April 29, 2025 1:12:48 PM PDT, Linus Torvalds <torva...@linux-foundation.org> wrote: >On Tue, 29 Apr 2025 at 12:13, Andrew Cooper <andrew.coop...@citrix.com> wrote: >> >> That would improve code generation for 32bit, but generally regress 64bit. >> >> Preloading the destination register with -1 is better than the CMOV form >> emitted by the builtin; BSF's habit of conditionally not writing the >> destination register *is* a CMOV of sorts. > >Right you are. So we'd need to do this just for the x86-32 case. Oh >well. Ugly, but still prettier than what we have now, I guess. > > Linus
Could you file a gcc bug? Gcc shouldn't generate worse code than inline asm ...