fix(asm): ADDQ imm8 frame adjust for 128-255 byte frames
This commit is contained in:
@@ -261,6 +261,11 @@ func subSP(size int) []byte { // SUBQ $size, SP
|
|||||||
if size >= -128 && size <= 127 {
|
if size >= -128 && size <= 127 {
|
||||||
return []byte{0x48, 0x83, 0xEC, byte(int8(size))}
|
return []byte{0x48, 0x83, 0xEC, byte(int8(size))}
|
||||||
}
|
}
|
||||||
|
// 128..255 do not fit SUB's unsigned imm8, but the Go assembler
|
||||||
|
// switches to ADDQ $-size, SP whose sign-extended imm8 does.
|
||||||
|
if size >= -255 && size <= 255 {
|
||||||
|
return []byte{0x48, 0x83, 0xC4, byte(int8(-size))}
|
||||||
|
}
|
||||||
return append([]byte{0x48, 0x81, 0xEC}, le32(int64(size))...)
|
return append([]byte{0x48, 0x81, 0xEC}, le32(int64(size))...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user