Landing: 85c39785487e

Project / Subsystem

gcc / gcc/loongarch

Date

2026-08-31

Author

Xi Ruoyao

Commit

85c39785487e242162cdc28675b334ad23951edb

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
gcc/loongarch
patch_id
—
commit_hash
85c39785487e242162cdc28675b334ad23951edb
source_type
github
headline
Fix LoongArch miscompile for `both_non_zero` with matching operands.
tldr
Corrects LoongArch code generation for `both_non_zero` when operands[0] equals operands[2].
author
Xi Ruoyao
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • loongarch
  • • register allocation
  • • PR127153
discussion_id_link
github:gcc-mirror/gcc#127153
bugzilla_pr
—
date
2026-08-31T00:00:00.000Z

A miscompilation on LoongArch occurred in both_non_zero and both_non_zero_subreg instructions when operands[0] was identical to operands[2]. This is because operands[0] was being written before operands[2] was fully used, necessitating an early-clobber designation. The fix defers register splitting until after reload and ensures operands[0] and operands[2] reside in distinct hard registers.