Support for select instructions on vector values (#696)

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
Takeshi Yoneda
2022-07-14 14:45:17 +09:00
committed by GitHub
parent 48d6e6f2e1
commit 0ae4254f21
14 changed files with 327 additions and 13 deletions

View File

@@ -15,6 +15,8 @@ var ctx = context.Background()
var (
//go:embed testdata/695.wasm
case695 []byte
//go:embed testdata/696.wasm
case696 []byte
)
func newRuntimeCompiler() wazero.Runtime {
@@ -52,3 +54,36 @@ func Test695(t *testing.T) {
})
}
}
func Test696(t *testing.T) {
if !platform.CompilerSupported() {
return
}
functionNames := [4]string{
"select with 0 / after calling dummy",
"select with 0",
"typed select with 1 / after calling dummy",
"typed select with 1",
}
for _, tc := range []struct {
name string
r wazero.Runtime
}{
{name: "compiler", r: newRuntimeCompiler()},
{name: "interpreter", r: newRuntimeInterpreter()},
} {
tc := tc
t.Run(tc.name, func(t *testing.T) {
defer tc.r.Close(ctx)
module, err := tc.r.InstantiateModuleFromBinary(ctx, case696)
require.NoError(t, err)
for _, name := range functionNames {
_, err := module.ExportedFunction(name).Call(ctx)
require.NoError(t, err)
}
})
}
}