Skip to content

Commit

Permalink
wazevo(amd64): pass basic memory store test (tetratelabs#1957)
Browse files Browse the repository at this point in the history
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
  • Loading branch information
mathetake committed Jan 24, 2024
1 parent a38b9f5 commit d3f919a
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 116 deletions.
5 changes: 2 additions & 3 deletions internal/engine/wazevo/backend/isa/amd64/instr.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (i *instruction) String() string {
return fmt.Sprintf("movl %s, %s", i.op1.format(false), i.op2.format(false))
}
case xmmRmR:
return fmt.Sprintf("%s %s, %s", sseOpcode(i.u1), i.op1.format(i.b1), i.op2.format(i.b1))
return fmt.Sprintf("%s %s, %s", sseOpcode(i.u1), i.op1.format(false), i.op2.format(false))
case gprToXmm:
return fmt.Sprintf("%s %s, %s", sseOpcode(i.u1), i.op1.format(i.b1), i.op2.format(i.b1))
case xmmUnaryRmR:
Expand Down Expand Up @@ -778,15 +778,14 @@ func (i *instruction) asAluRmiR(op aluRmiROpcode, rm operand, rd regalloc.VReg,
return i
}

func (i *instruction) asXmmRmR(op sseOpcode, rm operand, rd regalloc.VReg, _64 bool) *instruction {
func (i *instruction) asXmmRmR(op sseOpcode, rm operand, rd regalloc.VReg) *instruction {
if rm.kind != operandKindReg && rm.kind != operandKindMem {
panic("BUG")
}
i.kind = xmmRmR
i.op1 = rm
i.op2 = newOperandReg(rd)
i.u1 = uint64(op)
i.b1 = _64
return i
}

Expand Down
4 changes: 4 additions & 0 deletions internal/engine/wazevo/backend/isa/amd64/instr_encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ func (i *instruction) encode(c backend.Compiler) (needsLabelResolution bool) {
prefix, opcode, opcodeNum = legacyPrefixes0xF3, 0x0F51, 2
case sseOpcodeSqrtsd:
prefix, opcode, opcodeNum = legacyPrefixes0xF2, 0x0F51, 2
case sseOpcodeXorps:
prefix, opcode, opcodeNum = legacyPrefixesNone, 0x0F57, 2
case sseOpcodeXorpd:
prefix, opcode, opcodeNum = legacyPrefixes0x66, 0x0F57, 2
default:
panic(fmt.Sprintf("Unsupported sseOpcode: %s", op))
}
Expand Down
Loading

0 comments on commit d3f919a

Please sign in to comment.