Landing: c73b71d6bc7e
Project / Subsystem
gcc / middle-end
Date
2026-08-09
Author
Kael Andrew Alonzo Franco
Commit
c73b71d6bc7e106714bec94d13f877c6027d9531
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- middle-end
- patch_id
- —
- commit_hash
- c73b71d6bc7e106714bec94d13f877c6027d9531
- source_type
- github
- headline
- Use __builtin_bitreverse64 for emulation if supported.
- tldr
- Replaces naive bitreverse emulation with a faster intrinsic, improving performance and bootstrapping.
- author
- Kael Andrew Alonzo Franco
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • performance
- • optimization
- • builtins
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-08-09T00:00:00.000Z
The reflect_hwi function in hwint.cc previously used a slow loop to emulate __builtin_bitreverse64. This commit replaces that loop with a direct call to the intrinsic function when supported, offering a significant performance improvement. It also introduces STAGE0_CXX_HAS_BUILTIN in system.h to check for specific builtins, ensuring broader compatibility and better bootstrapping for GCC.