Landing: e46d96d20bbf
Project / Subsystem
gcc / middle-end
Date
2026-07-15
Author
Roger Sayle
Commit
e46d96d20bbfa786d30c9371631da00939845f05
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- middle-end
- patch_id
- —
- commit_hash
- e46d96d20bbfa786d30c9371631da00939845f05
- source_type
- github
- headline
- Simplify bit shifts involving type truncation
- tldr
- Fixes incorrect 64-bit shifts after type truncation by enabling 32-bit shift simplification.
- author
- Roger Sayle
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • x86
- • rtl
- discussion_id_link
- github:gcc-mirror/gcc#123236
- bugzilla_pr
- —
- date
- 2026-07-15T00:00:00.000Z
A regression in the RTL optimizer caused unnecessary 64-bit shifts in code that should have used 32-bit shifts, related to PR 123236. This patch simplifies expressions like (int)((long long)x >> 4) by correctly identifying that a 32-bit shift is sufficient after the truncation. The change in simplify-rtx.cc handles new simplifications for TRUNCATE(ZERO_EXTRACT) and TRUNCATE(SIGN_EXTRACT) equivalent to existing TRUNCATE(ZERO_EXTEND) and TRUNCATE(SIGN_EXTEND) cases.