Landing: 8ca1e887847e
Project / Subsystem
gcc / gcc
Date
2025-12-11
Author
Reshma Roy
Commit
8ca1e887847e2f51dabc9f49be8471ca10ee3cc8
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- gcc
- patch_id
- —
- commit_hash
- 8ca1e887847e2f51dabc9f49be8471ca10ee3cc8
- source_type
- github
- headline
- Enable POPCNT generation for 32-bit patterns from Hacker's Delight.
- tldr
- This commit enables the generation of the POPCNT instruction for several 32-bit bit counting patterns found in Hacker's Delight.
- author
- Reshma Roy
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • popcnt
- • bit manipulation
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2025-12-11T00:00:00.000Z
This commit enables the generation of the POPCNT (population count) instruction for specific 32-bit patterns used to count the number of set bits in a word, as described in Hacker’s Delight. By recognizing these patterns, the compiler can replace sequences of arithmetic and logical operations with a single, efficient POPCNT instruction, leading to significant performance improvements for bit counting operations. New test cases are added to verify the correct generation of the POPCNT instruction for these patterns.