https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126973
Drea Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Worse X86 codegen for |__builtin_clzg could be
|arbitrary |improved by using bsrw
|__builtin_clzg/__builtin_ct |rather than bsrl or using a
|zg compared to clang. |shift rather than an
| |and/sub
Severity|normal |enhancement
Resolution|DUPLICATE |---
Keywords|ABI |
Last reconfirmed| |2026-08-21
Status|RESOLVED |NEW
Ever confirmed|0 |1
--- Comment #3 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Well __builtin_clzg could be improved slightly by using bsrw rather than
bsrl.
You could do also a shift for __builtin_clzg too.
But that is not always better:
https://godbolt.org/z/7hbcnGq9E