Landing: baf658d80576
Project / Subsystem
gcc / i386
Date
2026-07-28
Author
Uros Bizjak
Commit
baf658d80576de061320f136945fff90359ff7fd
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- i386
- patch_id
- —
- commit_hash
- baf658d80576de061320f136945fff90359ff7fd
- source_type
- github
- headline
- i386: Avoid XCHGB %rH, %rL in bswaphi2 on non-Pentium4
- tldr
- Avoids high-latency XCHGB instruction for bswaphi2 on targets other than Pentium 4.
- author
- Uros Bizjak
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • i386
- • optimization
- • instruction-selection
- • performance
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-28T00:00:00.000Z
For i386 targets prior to Pentium 4, the XCHGB %rH, %rL instruction has higher latency than ROLW. This commit changes the instruction selection for the bswaphi2 (byte swap for half-word) and related patterns to avoid XCHGB. It utilizes the enabled attribute to hard-disable the unwanted XCHGB alternatives, replacing the previous use of preferred_for_size and preferred_for_speed attributes.