fix(asm): reject the offset on the loong64 register-indexed memory form
Assisted-by: GLM 5.3
This commit is contained in:
1 parent
b54547c08d
commit
e5035d92e9
1 file changed
+9
@@ -1422,6 +1422,11 @@ func encodeLOONG64Mov(instr *ast.Instr, mnem string, fi loong64FrameInfo, relocs
|
||||
|
||||
// Register-offset addressing: MOVx (rj)(rk), rd / MOVx rd, (rj)(rk).
|
||||
if src.Addr.Index != "" && !isMemOperand(dst) {
|
||||
if src.Addr.HasOff {
|
||||
// The toolchain rejects off(rj)(rk) with an illegal
|
||||
// combination; the offset would be silently dropped here.
|
||||
return nil, fmt.Errorf("%s: the register-indexed form takes no offset", mnem)
|
||||
}
|
||||
rd := l64Reg(dst)
|
||||
rj, rk := loong64RegNum(src.Addr.Base), loong64RegNum(src.Addr.Index)
|
||||
if rd < 0 || rj < 0 || rk < 0 {
|
||||
@@ -1434,6 +1439,10 @@ func encodeLOONG64Mov(instr *ast.Instr, mnem string, fi loong64FrameInfo, relocs
|
||||
return l64wordLE(l64rrr(op.ld, rk, rj, rd)), nil
|
||||
}
|
||||
if dst.Addr.Index != "" && !isMemOperand(src) {
|
||||
if dst.Addr.HasOff {
|
||||
// The store twin of the load rejection above.
|
||||
return nil, fmt.Errorf("%s: the register-indexed form takes no offset", mnem)
|
||||
}
|
||||
rs := l64Reg(src)
|
||||
rj, rk := loong64RegNum(dst.Addr.Base), loong64RegNum(dst.Addr.Index)
|
||||
if rs < 0 || rj < 0 || rk < 0 {
|
||||
|
||||
Reference in new issue
Block a user