Landing: 875a6c6192a6
Project / Subsystem
gcc / match.pd
Date
2026-04-09
Author
Daniel Barboza
Commit
875a6c6192a68f75ad213f2a1b3804e7724073e7
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- match.pd
- patch_id
- —
- commit_hash
- 875a6c6192a68f75ad213f2a1b3804e7724073e7
- source_type
- github
- headline
- match.pd: Canonicalize right shift comparisons.
- tldr
- Canonicalizes right shift comparisons with constants into left shifts.
- author
- Daniel Barboza
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • pattern matching
- • RISC-V
- • x86
- • aarch64
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-04-09T00:00:00.000Z
The match.pd pattern matching system now canonicalizes right shift non-equality comparisons involving constants. Expressions like (A >> CST1) CMP CST2 are transformed into equivalent comparisons involving left-shifted constants (A CMP (CST2 << CST1)), potentially simplifying the comparison to a single operation. This optimization aims to improve pattern matching and subsequent code generation by reducing complex shift-and-compare sequences.