[LoongArch] Incorrect register allocation for [G]CSRXCHG
- rj must not be R0 ro R1
#140842
Labels
[G]CSRXCHG
- rj must not be R0 ro R1
#140842
In the LoongArch target, the
[G]CSRXCHG
instruction has a special encoding constraint:If the
rj
operand is assigned to register R0 or R1, the instruction encoding will be interpreted as[G]CSRRD
or[G]CSRWR
respectively, not[G]CSRXCHG
.Currently, LLVM’s register allocator may assign R0 or R1 to the
rj
operand of a[G]CSRXCHG
instruction, which leads to incorrect code generation and unintended semantics.Reproduce case:
The text was updated successfully, but these errors were encountered: