Skip to content

Commit 70a9688

Browse files
authored
wazevo(amd64): reserve dx when calling memmove to support go 1.24 (#2378)
Signed-off-by: Anuraag Agrawal <[email protected]>
1 parent 88f3a0e commit 70a9688

File tree

1 file changed

+4
-0
lines changed
  • internal/engine/wazevo/backend/isa/amd64

1 file changed

+4
-0
lines changed

internal/engine/wazevo/backend/isa/amd64/machine.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,6 +1918,9 @@ func (m *machine) lowerCall(si *ssa.Instruction) {
19181918
for i := regalloc.RealReg(0); i < 16; i++ {
19191919
m.insert(m.allocateInstr().asDefineUninitializedReg(regInfo.RealRegToVReg[xmm0+i]))
19201920
}
1921+
// Since Go 1.24 it may also use DX, which is not reserved for the function call's 3 args.
1922+
// https://github.com/golang/go/blob/go1.24.0/src/runtime/memmove_amd64.s#L123
1923+
m.insert(m.allocateInstr().asDefineUninitializedReg(regInfo.RealRegToVReg[rdx]))
19211924
}
19221925

19231926
if isDirectCall {
@@ -1933,6 +1936,7 @@ func (m *machine) lowerCall(si *ssa.Instruction) {
19331936
for i := regalloc.RealReg(0); i < 16; i++ {
19341937
m.insert(m.allocateInstr().asNopUseReg(regInfo.RealRegToVReg[xmm0+i]))
19351938
}
1939+
m.insert(m.allocateInstr().asNopUseReg(regInfo.RealRegToVReg[rdx]))
19361940
}
19371941

19381942
var index int

0 commit comments

Comments
 (0)