Skip to content

Commit

Permalink
wazevo(amd64): pass memory all stores / call_indirect tests (tetratel…
Browse files Browse the repository at this point in the history
  • Loading branch information
mathetake committed Jan 25, 2024
1 parent d3f919a commit d6ab95b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/engine/wazevo/backend/isa/amd64/instr_encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ func (ri rexInfo) encodeForIndex(c backend.Compiler, encR regEnc, encIndex regEn
x := encIndex.rexBit()
b := encBase.rexBit()
rex := byte(0x40) | w<<3 | r<<2 | x<<1 | b
if rex != 0x40 || ri&0x02 == 1 {
if rex != 0x40 || ri&0x02 != 0 {
c.EmitByte(rex)
}
}
Expand Down
32 changes: 32 additions & 0 deletions internal/engine/wazevo/backend/isa/amd64/instr_encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,30 @@ func TestInstruction_format_encode(t *testing.T) {
want: "4088b800001000",
wantFormat: "mov.b %rdi, 1048576(%rax)",
},
{
setup: func(i *instruction) {
a := newOperandMem(newAmodeRegRegShift(1, rcxVReg, rdxVReg, 0))
i.asMovRM(rsiVReg, a, 1)
},
want: "4088741101",
wantFormat: "mov.b %rsi, 1(%rcx,%rdx,1)",
},
{
setup: func(i *instruction) {
a := newOperandMem(newAmodeRegRegShift(1, rcxVReg, rdxVReg, 1))
i.asMovRM(rdiVReg, a, 1)
},
want: "40887c5101",
wantFormat: "mov.b %rdi, 1(%rcx,%rdx,2)",
},
{
setup: func(i *instruction) {
a := newOperandMem(newAmodeRegRegShift(1, rcxVReg, rdxVReg, 1))
i.asMovRM(rdiVReg, a, 2)
},
want: "66897c5101",
wantFormat: "mov.w %rdi, 1(%rcx,%rdx,2)",
},
{
setup: func(i *instruction) {
a := newOperandMem(newAmodeRegRegShift(1<<20, raxVReg, rcxVReg, 3))
Expand All @@ -1901,6 +1925,14 @@ func TestInstruction_format_encode(t *testing.T) {
want: "6689bcc800001000",
wantFormat: "mov.w %rdi, 1048576(%rax,%rcx,8)",
},
{
setup: func(i *instruction) {
a := newOperandMem(newAmodeRegRegShift(1<<20, rcxVReg, rdxVReg, 3))
i.asMovRM(rdiVReg, a, 2)
},
want: "6689bcd100001000",
wantFormat: "mov.w %rdi, 1048576(%rcx,%rdx,8)",
},
{
setup: func(i *instruction) {
a := newOperandMem(newAmodeRegRegShift(123, raxVReg, rcxVReg, 0))
Expand Down
2 changes: 0 additions & 2 deletions internal/engine/wazevo/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ func TestE2E(t *testing.T) {
name: "call_indirect",
m: testcases.CallIndirect.Module,
// parameter == table offset.
skipAMD64: true,
calls: []callCase{
{params: []uint64{0}, expErr: "indirect call type mismatch"},
{params: []uint64{1}, expResults: []uint64{10}},
Expand Down Expand Up @@ -538,7 +537,6 @@ func TestE2E_host_functions(t *testing.T) {
}

func TestE2E_stores(t *testing.T) {
skipOnAmd64(t)
config := newRuntimeConfigOptimizingCompiler()

ctx := context.Background()
Expand Down

0 comments on commit d6ab95b

Please sign in to comment.