Landing: 885ad73e630c
Project / Subsystem
gcc / match.pd
Date
2026-08-11
Author
Artemiy Volkov
Commit
885ad73e630ca23d1810d55fd480f6ff519d42bf
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- match.pd
- patch_id
- —
- commit_hash
- 885ad73e630ca23d1810d55fd480f6ff519d42bf
- source_type
- github
- headline
- Fold bitfield extraction and shifting expressions
- tldr
- Optimizes expressions like `((X >> C1) & C2) << C3` into simpler forms for better code generation.
- author
- Artemiy Volkov
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • code generation
- • aarch64
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-08-11T00:00:00.000Z
This patch introduces a new simplification rule in match.pd to optimize expressions of the form ((X >> C1) & C2) << C3. These expressions, which extract bits, mask them, and then shift them, are folded into equivalent, more efficient forms. The optimization applies to unsigned types under specific conditions related to shift amounts and bit precision, potentially generating more compact and faster machine code, as demonstrated by an example on aarch64.