Landing: 2b367a1f0857
Project / Subsystem
gcc / match.pd
Date
2026-08-18
Author
Dominic P
Commit
2b367a1f0857d83b004292fecdb5c919858d0b3a
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- match.pd
- patch_id
- —
- commit_hash
- 2b367a1f0857d83b004292fecdb5c919858d0b3a
- source_type
- github
- headline
- Combine two single-bit tests into one masked compare
- tldr
- Optimizes combinations of two single-bit tests on the same operand into a single masked comparison.
- author
- Dominic P
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • arm
- • instruction reduction
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-08-18T00:00:00.000Z
This optimization simplifies pairs of single-bit tests on the same operand into a single masked comparison, reducing instruction count. For example, it transforms conditions like (X & C1) != 0 & (X & C2) != 0 into (X & M) == M, where M is the combined mask. This is particularly effective on architectures like ARM, reducing sequences from 4-8 instructions to a single compare-and-branch instruction.