fix(asm): compress the riscv64 two-operand arithmetic and immediate tail

Assisted-by: GLM 5.3
This commit is contained in:
petrbalvin committed 2026-10-07 13:51:02 +02:00
1 parent f0318d2c99
commit da35883633
2 files changed
+66 -22

No files matched your search

+1 -1
View File
@@ -344,7 +344,7 @@ func riscvGuard(fi riscvFrameInfo) ([]byte, Reloc, error) {
off := int32(fi.autosize - stackSmall)
mov := encodeRISCVLoadImm(7, off)
out = append(out, mov...)
addiLen := riscvItypeImmediateSize("ADDI", -off)
addiLen := riscvItypeImmediateSize("ADDI", 7, 2, -off)
out = append(out, wordLE(riscvBType(riscvEnc{0x63, 0x06, 0x00}, 2, 7, int32(addiLen+8)))...)
addi, err := encodeRISCVItypeImmediate("ADDI", riscvEnc{0x13, 0x0, 0x00}, 7, 2, -off)
if err != nil {