Landing: 60b27d915e14
Project / Subsystem
gcc / i386
Date
2026-07-17
Author
Uros Bizjak
Commit
60b27d915e14748a627deb1a4616da419b1e24b2
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- i386
- patch_id
- —
- commit_hash
- 60b27d915e14748a627deb1a4616da419b1e24b2
- source_type
- github
- headline
- i386: Add ROLW %r,8 alternative to bswaphi2 patterns
- tldr
- Improves 16-bit byte swap implementation on i386 by preferring ROLW over XCHGB.
- author
- Uros Bizjak
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • i386
- • optimization
- • instruction selection
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-17T00:00:00.000Z
The i386 backend now favors the ROLW %r,8 instruction for 16-bit byte swaps (bswaphi2), overing the XCHGB instruction. This change allows the compiler to use a wider range of registers and enables better instruction scheduling by leaving the choice to the preferred_for_* machinery. Additionally, it ensures that all 16-bit rotates by 8 bits are converted to the bswap pattern, which can utilize the MOVBE instruction when available.