Repository: tetratelabs/wazero
Pull request #1989 (2024-01-31 18:01:17)

wazevo(amd64): bitcast, fpromote, fdemote
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>


mathetake: could you enable `memory` test? That uses bitcast.
```diff
diff --git a/internal/engine/wazevo/e2e_test.go b/internal/engine/wazevo/e2e_test.go
index ce5bc3af..3a8d66cd 100644
--- a/internal/engine/wazevo/e2e_test.go
+++ b/internal/engine/wazevo/e2e_test.go
@@ -1303,7 +1303,7 @@ func TestSpectestV1(t *testing.T) {
                //{name: "local_get"},
                //{name: "local_set"},
                //{name: "local_tee"},
-               //{name: "memory"},
+               {name: "memory"},
                {name: "memory_size"},
                {name: "memory_grow"},
                {name: "memory_redundancy"},

```

Patch:
diff --git a/.github/workflows/commit.yaml b/.github/workflows/commit.yaml
index 76310aa5..5c95eadf 100644
--- a/.github/workflows/commit.yaml
+++ b/.github/workflows/commit.yaml
@@ -57,13 +57,21 @@ jobs:
 
       - run: make check
 
-  test_amd64:
-    name: amd64, ${{ matrix.os }}, Go-${{ matrix.go-version }}
-    runs-on: ${{ matrix.os }}
+  test:
+    name: ${{ matrix.platform.arch }}, ${{ matrix.platform.os }}, Go-${{ matrix.go-version }}
+    runs-on: ${{ matrix.platform.os }}
     strategy:
       fail-fast: false  # don't fail fast as sometimes failures are arch/OS specific
       matrix:  # Use versions consistent with wazero's Go support policy.
-        os: [ubuntu-22.04, macos-12, windows-2022]
+        platform:
+        - os: ubuntu-22.04
+          arch: amd64
+        - os: macos-12
+          arch: amd64
+        - os: windows-2022
+          arch: amd64
+        - os: macos-14
+          arch: arm64
         go-version:
           - "1.21"  # Current Go version
           - "1.19"  # Floor Go version of wazero (current - 2)
@@ -172,8 +180,16 @@ jobs:
   # This ensures that internal/integration_test/fuzz is runnable, and is not intended to
   # run full-length fuzzing while trying to find low-hanging frontend bugs.
   fuzz:
-    name: Minimal Fuzzing
-    runs-on: ubuntu-22.04
+    name: Minimal Fuzzing (${{ matrix.platform.os }}, ${{ matrix.platform.arch }} )
+    runs-on: ${{ matrix.platform.os }}
+    strategy:
+      fail-fast: false  # don't fail fast as sometimes failures are arch/OS specific
+      matrix:  # Use versions consistent with wazero's Go support policy.
+        platform:
+          - os: ubuntu-22.04
+            arch: amd64
+          - os: macos-14
+            arch: arm64
 
     steps:
       - uses: actions/checkout@v3
@@ -194,7 +210,7 @@ jobs:
             internal/integration_test/fuzz/target
             internal/integration_test/fuzz/fuzz/artifacts
             internal/integration_test/fuzz/fuzz/corpus
-          key: build-fuzz-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum', 'Makefile', '**/Cargo.lock', '**/Cargo.toml', '**/*.rs') }}
+          key: build-fuzz-${{ matrix.platform.os }}-${{ matrix.platform.arch }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum', 'Makefile', '**/Cargo.lock', '**/Cargo.toml', '**/*.rs') }}
 
       - run: cargo install cargo-fuzz
         if: steps.cache.outputs.cache-hit != 'true'
diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml
index 073d671b..20b01b6f 100644
--- a/.github/workflows/integration.yaml
+++ b/.github/workflows/integration.yaml
@@ -100,8 +100,8 @@ jobs:
         arch:     [amd64]
         include:
           - os:
-              version: ubuntu-22.04
-              name: Ubuntu
+              version: macos-14
+              name: macOS
             compiler: optimizing
             arch:     "arm64"
 
@@ -124,44 +124,16 @@ jobs:
         with:
           go-version: ${{ env.GO_VERSION }}
 
-      - if: ${{ matrix.compiler == 'optimizing' }}
-        name: Build wazero
-        run: go build -o ./wazerocli ./cmd/wazero
-        env:
-          GOARCH: ${{ matrix.arch }}
-
-      - name: Set up QEMU
-        if: ${{ matrix.compiler == 'optimizing' && matrix.arch == 'arm64' }}
-        uses: docker/setup-qemu-action@v2
-        with: # Avoid docker.io rate-limits; built with internal-images.yml
-          image: ghcr.io/tetratelabs/wazero/internal-binfmt
-          platforms: ${{ matrix.arch }}
-
-      - name: Build scratch container
-        if: ${{ matrix.compiler == 'optimizing' }}
-        run: |
-          echo 'FROM scratch' >> Dockerfile
-          echo 'CMD ["/test"]' >> Dockerfile
-          docker buildx build -t wazero:test --platform linux/${{ matrix.arch }} .
-
-
       # The following two steps run the previously compiled Zig tests with wazero.
       # If you need to troubleshoot any of the test, you can add "-hostlogging=filesystem" after
       # adding filter argument either to step "Run built test binaries" or
       # "Run built test binaries (container)".
       # e.g. --test-filter "Dir.Iterator but dir is deleted during iteration"
 
-      - name: Run built test binaries (container)
-        if: ${{ matrix.compiler == 'optimizing' }}
-        run: |
-          docker run --platform linux/${{ matrix.arch }} -v $(pwd)/${{ env.STDLIB_TESTS }}/testdata/zig:/test -v $(pwd)/wazerocli:/wazero -e WAZEROCLI=/wazero --tmpfs /tmp --rm -t wazero:test \
-            /wazero run -optimizing-compiler -mount=:/ ./test/test.wasm
-
       - name: Run built test binaries
-        if: ${{ matrix.compiler != 'optimizing' }}
         run: |
           cd ${{ env.STDLIB_TESTS }}
-          go test -bench='BenchmarkZig' -benchtime=1x
+          go test -bench='BenchmarkZig/${{ matrix.compiler }}' -benchtime=1x
 
   build_tinygo_test_binary:
     name: Build TinyGo test binary
@@ -224,8 +196,8 @@ jobs:
         arch:     [amd64]
         include:
           - os:
-              version: ubuntu-22.04
-              name: Ubuntu
+              version: macos-14
+              name: macOS
             compiler: optimizing
             arch:     "arm64"
 
@@ -248,47 +220,15 @@ jobs:
         with:
           go-version: ${{ env.GO_VERSION }}
 
-      - if: ${{ matrix.compiler == 'optimizing' }}
-        name: Build wazero
-        run: go build -o ~/wazerocli ./cmd/wazero
-        env:
-          GOARCH: ${{ matrix.arch }}
-
-      - name: Set up QEMU
-        if: ${{ matrix.compiler == 'optimizing' && matrix.arch == 'arm64' }}
-        uses: docker/setup-qemu-action@v2
-        with: # Avoid docker.io rate-limits; built with internal-images.yml
-          image: ghcr.io/tetratelabs/wazero/internal-binfmt
-          platforms: ${{ matrix.arch }}
-
-      - name: Build scratch container
-        if: ${{ matrix.compiler == 'optimizing' }}
-        run: |
-          echo 'FROM scratch' >> Dockerfile
-          echo 'CMD ["/test"]' >> Dockerfile
-          docker buildx build -t wazero:test --platform linux/${{ matrix.arch }} .
-
       # The following steps run the previously compiled TinyGo tests with wazero. If you need
       # to troubleshoot one, you can add "-hostlogging=filesystem" and also a
       # trailing argument narrowing which test to execute.
       # e.g. "-test.run '^TestStatBadDir$'"
 
-      - name: Run test binaries (container)
-        if: ${{ matrix.compiler == 'optimizing' }}
-        # This runs all tests compiled above in sequence. Note: This mounts /tmp to allow t.TempDir() in tests.
-        run: |
-          cd ${{ env.STDLIB_TESTS }}/testdata/tinygo
-          for bin in *.test; do
-            echo $bin
-            docker run --platform linux/${{ matrix.arch }} -v $(pwd):/test -v ~/wazerocli:/wazero -e WAZEROCLI=/wazero --tmpfs /tmp --rm -t wazero:test \
-              /wazero run -optimizing-compiler -mount=:/  /test/$bin -- -test.v
-          done
-
       - name: Run test binaries
-        if: ${{ matrix.compiler != 'optimizing' }}
         run: |
           cd ${{ env.STDLIB_TESTS }}
-          go test -bench='BenchmarkTinyGo' -benchtime=1x
+          go test -bench='BenchmarkTinyGo/${{ matrix.compiler }}' -benchtime=1x
 
   wasi-testsuite:
     name: wasi-testsuite
@@ -400,8 +340,8 @@ jobs:
           - "1.21"  # Current Go version && The only version that supports wasip1.
         include:
           - os:
-              version: ubuntu-22.04
-              name: Ubuntu
+              version: macos-14
+              name: macOS
             compiler:   optimizing
             arch:       "arm64"
             go-version: "1.21"
@@ -423,51 +363,13 @@ jobs:
           # Use precise Go version from setup-go as patch version differences can effect tests.
           key: go-wasip1-binaries-${{ matrix.os.version }}-${{ steps.setup-go.outputs.go-version }}-${{ matrix.arch }}
 
-      - if: ${{ matrix.compiler == 'optimizing' }}
-        name: Build wazero
-        run: go build -o ~/wazerocli ./cmd/wazero
-        env:
-          GOARCH: ${{ matrix.arch }}
-
       - if: ${{ steps.cache-go-test-binaries.outputs.cache-hit != 'true' }}
         name: Build Test Binaries
         run: |
           cd ${{ env.STDLIB_TESTS }}
           make build.gowasip1
 
-      - name: Set up QEMU
-        if: ${{ matrix.compiler == 'optimizing' && matrix.arch == 'arm64' }}
-        uses: docker/setup-qemu-action@v2
-        with: # Avoid docker.io rate-limits; built with internal-images.yml
-          image: ghcr.io/tetratelabs/wazero/internal-binfmt
-          platforms: ${{ matrix.arch }}
-
-      - name: Build scratch container
-        if: ${{ matrix.compiler == 'optimizing' }}
-        run: |
-          echo 'FROM scratch' >> Dockerfile
-          echo 'CMD ["/test"]' >> Dockerfile
-          docker buildx build -t wazero:test --platform linux/${{ matrix.arch }} .
-
-      - if: ${{ matrix.compiler == 'optimizing' }}
-        name: Run test binaries (container)
-        run: |
-          echo "Running $(find ${{ env.STDLIB_TESTS }}/testdata/go -name '*.test' | wc -l) test binaries"
-
-          # Skip tests that are hideously slow (mostly compilation time) for running inside QEMU.
-          skip_targets="src_encoding_json|src_runtime|src_os_exec|src_math_big|src_encoding_gob|src_time|src_archive_tar|src_math_rand|src_expvar|src_testing|src_os"
-          # Go tests often look for files relative to the source. Change to the corresponding directory.
-          for bin in $(find $PWD/${{ env.STDLIB_TESTS }}/testdata/go -name '*.test' | grep -vE "$skip_targets"); do
-            dir=$(basename $bin); dir=${dir%.test}; dir=${dir//_/\/}
-            pushd $(go env GOROOT)/$dir
-            # Mount / as /ROOT in docker and then remount /ROOT as / in wazero; $bin is now in /ROOT/$bin.
-            docker run --platform linux/arm64 -v /:/ROOT -v ~/wazerocli:/wazero -e WAZEROCLI=/wazero --tmpfs /tmp --rm -t wazero:test \
-              /wazero run -optimizing-compiler -mount=/ROOT:/ -mount=/tmp:/tmp -env PWD=$PWD /ROOT/$bin -- -test.short -test.v
-            popd
-          done
-
       - name: Run built test binaries
-        if: ${{ matrix.compiler != 'optimizing' }}
         run: |
           cd ${{ env.STDLIB_TESTS }}
-          go test -bench='BenchmarkWasip1' -benchtime=1x
+          go test -bench='BenchmarkWasip1/${{ matrix.compiler }}' -benchtime=1x
diff --git a/internal/engine/wazevo/backend/isa/amd64/instr.go b/internal/engine/wazevo/backend/isa/amd64/instr.go
index 7aa986bf..3ed6561a 100644
--- a/internal/engine/wazevo/backend/isa/amd64/instr.go
+++ b/internal/engine/wazevo/backend/isa/amd64/instr.go
@@ -200,7 +200,7 @@ func (i *instruction) String() string {
 	case xmmLoadConst:
 		panic("TODO")
 	case xmmToGpr:
-		panic("TODO")
+		return fmt.Sprintf("%s %s, %s", sseOpcode(i.u1), i.op1.format(i.b1), i.op2.format(i.b1))
 	case cvtUint64ToFloatSeq:
 		panic("TODO")
 	case cvtFloatToSintSeq:
@@ -253,7 +253,7 @@ func (i *instruction) Defs(regs *[]regalloc.VReg) []regalloc.VReg {
 	case defKindNone:
 	case defKindOp2:
 		if !i.op2.r.Valid() {
-			panic("BUG" + i.String())
+			panic("BUG " + i.op2.format(true) + " invalid in " + i.String())
 		}
 		*regs = append(*regs, i.op2.r)
 	case defKindCall:
@@ -923,6 +923,15 @@ func (i *instruction) sourceOffsetInfo() ssa.SourceOffset {
 	return ssa.SourceOffset(i.u1)
 }
 
+func (i *instruction) asXmmToGpr(op sseOpcode, rm, rd regalloc.VReg, _64 bool) *instruction {
+	i.kind = xmmToGpr
+	i.op1 = newOperandReg(rm)
+	i.op2 = newOperandReg(rd)
+	i.u1 = uint64(op)
+	i.b1 = _64
+	return i
+}
+
 func (i *instruction) asMovRM(rm regalloc.VReg, rd operand, size byte) *instruction {
 	if rd.kind != operandKindMem {
 		panic("BUG")
@@ -1779,6 +1788,7 @@ var defKinds = [instrMax]defKind{
 	movsxRmR:         defKindOp2,
 	movzxRmR:         defKindOp2,
 	gprToXmm:         defKindOp2,
+	xmmToGpr:         defKindOp2,
 	cmove:            defKindNone,
 	call:             defKindCall,
 	callIndirect:     defKindCall,
@@ -1851,6 +1861,7 @@ var useKinds = [instrMax]useKind{
 	movzxRmR:         useKindOp1,
 	movsxRmR:         useKindOp1,
 	gprToXmm:         useKindOp1,
+	xmmToGpr:         useKindOp1,
 	call:             useKindCall,
 	callIndirect:     useKindCallInd,
 	ud2:              useKindNone,
diff --git a/internal/engine/wazevo/backend/isa/amd64/instr_encoding.go b/internal/engine/wazevo/backend/isa/amd64/instr_encoding.go
index a213a642..d46eb08c 100644
--- a/internal/engine/wazevo/backend/isa/amd64/instr_encoding.go
+++ b/internal/engine/wazevo/backend/isa/amd64/instr_encoding.go
@@ -947,7 +947,34 @@ func (i *instruction) encode(c backend.Compiler) (needsLabelResolution bool) {
 	case xmmLoadConst:
 		panic("TODO")
 	case xmmToGpr:
-		panic("TODO")
+		var legPrefix legacyPrefixes
+		var opcode uint32
+		var argSwap bool
+		const opcodeNum = 2
+		switch sseOpcode(i.u1) {
+		case sseOpcodeMovd, sseOpcodeMovq:
+			legPrefix, opcode, argSwap = legacyPrefixes0x66, 0x0f7e, false
+		case sseOpcodeCvttss2si:
+			legPrefix, opcode, argSwap = legacyPrefixes0xF3, 0x0f2c, true
+		case sseOpcodeCvttsd2si:
+			legPrefix, opcode, argSwap = legacyPrefixes0xF2, 0x0f2c, true
+		default:
+			panic(fmt.Sprintf("Unsupported sseOpcode: %s", sseOpcode(i.u1)))
+		}
+
+		var rex rexInfo
+		if i.b1 {
+			rex = rex.setW()
+		} else {
+			rex = rex.clearW()
+		}
+		src := regEncodings[i.op1.r.RealReg()]
+		dst := regEncodings[i.op2.r.RealReg()]
+		if argSwap {
+			src, dst = dst, src
+		}
+		encodeRegReg(c, legPrefix, opcode, opcodeNum, src, dst, rex)
+
 	case cvtUint64ToFloatSeq:
 		panic("TODO")
 	case cvtFloatToSintSeq:
diff --git a/internal/engine/wazevo/backend/isa/amd64/machine.go b/internal/engine/wazevo/backend/isa/amd64/machine.go
index 910501bb..81f9c58a 100644
--- a/internal/engine/wazevo/backend/isa/amd64/machine.go
+++ b/internal/engine/wazevo/backend/isa/amd64/machine.go
@@ -335,8 +335,24 @@ func (m *machine) LowerInstr(instr *ssa.Instruction) {
 		m.lowerFminFmax(instr)
 	case ssa.OpcodeFcopysign:
 		m.lowerFcopysign(instr)
+	case ssa.OpcodeBitcast:
+		m.lowerBitcast(instr)
 	case ssa.OpcodeSqrt:
 		m.lowerSqrt(instr)
+	case ssa.OpcodeFpromote:
+		v := instr.Arg()
+		rn := m.getOperand_Reg(m.c.ValueDefinition(v))
+		rd := m.c.VRegOf(instr.Return())
+		cnt := m.allocateInstr()
+		cnt.asXmmUnaryRmR(sseOpcodeCvtss2sd, rn, rd)
+		m.insert(cnt)
+	case ssa.OpcodeFdemote:
+		v := instr.Arg()
+		rn := m.getOperand_Reg(m.c.ValueDefinition(v))
+		rd := m.c.VRegOf(instr.Return())
+		cnt := m.allocateInstr()
+		cnt.asXmmUnaryRmR(sseOpcodeCvtsd2ss, rn, rd)
+		m.insert(cnt)
 	case ssa.OpcodeUndefined:
 		m.insert(m.allocateInstr().asUD2())
 	case ssa.OpcodeExitWithCode:
@@ -1695,3 +1711,26 @@ func (m *machine) lowerFcopysign(instr *ssa.Instruction) {
 
 	m.copyTo(nonSignBitReg, rd)
 }
+
+func (m *machine) lowerBitcast(instr *ssa.Instruction) {
+	x, dstTyp := instr.BitcastData()
+	srcTyp := x.Type()
+	rn := m.getOperand_Reg(m.c.ValueDefinition(x))
+	rd := m.c.VRegOf(instr.Return())
+	switch {
+	case srcTyp == ssa.TypeF32 && dstTyp == ssa.TypeI32:
+		cvt := m.allocateInstr().asXmmToGpr(sseOpcodeMovd, rn.r, rd, false)
+		m.insert(cvt)
+	case srcTyp == ssa.TypeI32 && dstTyp == ssa.TypeF32:
+		cvt := m.allocateInstr().asGprToXmm(sseOpcodeMovd, rn, rd, false)
+		m.insert(cvt)
+	case srcTyp == ssa.TypeF64 && dstTyp == ssa.TypeI64:
+		cvt := m.allocateInstr().asXmmToGpr(sseOpcodeMovq, rn.r, rd, true)
+		m.insert(cvt)
+	case srcTyp == ssa.TypeI64 && dstTyp == ssa.TypeF64:
+		cvt := m.allocateInstr().asGprToXmm(sseOpcodeMovq, rn, rd, true)
+		m.insert(cvt)
+	default:
+		panic(fmt.Sprintf("invalid bitcast from %s to %s", srcTyp, dstTyp))
+	}
+}


Test patch:
diff --git a/experimental/opt/opt_test.go b/experimental/opt/opt_test.go
index 5b75f3ff..a1996f78 100644
--- a/experimental/opt/opt_test.go
+++ b/experimental/opt/opt_test.go
@@ -2,16 +2,16 @@ package opt_test
 
 import (
 	"context"
-	"runtime"
 	"testing"
 
 	"github.com/tetratelabs/wazero"
 	"github.com/tetratelabs/wazero/experimental/opt"
+	"github.com/tetratelabs/wazero/internal/platform"
 	"github.com/tetratelabs/wazero/internal/testing/require"
 )
 
 func TestUseOptimizingCompiler(t *testing.T) {
-	if runtime.GOARCH != "arm64" {
+	if !platform.CompilerSupported() {
 		return
 	}
 	c := opt.NewRuntimeConfigOptimizingCompiler()
diff --git a/internal/engine/wazevo/backend/isa/amd64/instr_encoding_test.go b/internal/engine/wazevo/backend/isa/amd64/instr_encoding_test.go
index 23f00cd5..394cf00f 100644
--- a/internal/engine/wazevo/backend/isa/amd64/instr_encoding_test.go
+++ b/internal/engine/wazevo/backend/isa/amd64/instr_encoding_test.go
@@ -1391,6 +1391,48 @@ func TestInstruction_format_encode(t *testing.T) {
 			want:       "f20f2ac7",
 			wantFormat: "cvtsi2sd %edi, %xmm0",
 		},
+		{
+			// This is actually equivalent to movq, because of _64=true.
+			setup:      func(i *instruction) { i.asXmmToGpr(sseOpcodeMovd, xmm0VReg, rdiVReg, true) },
+			want:       "66480f7ec7",
+			wantFormat: "movd %xmm0, %rdi",
+		},
+		{
+			setup:      func(i *instruction) { i.asXmmToGpr(sseOpcodeMovd, xmm0VReg, rdiVReg, false) },
+			want:       "660f7ec7",
+			wantFormat: "movd %xmm0, %edi",
+		},
+		{
+			setup:      func(i *instruction) { i.asXmmToGpr(sseOpcodeMovq, xmm0VReg, rdiVReg, true) },
+			want:       "66480f7ec7",
+			wantFormat: "movq %xmm0, %rdi",
+		},
+		// This is actually equivalent to movq, because of _64=false.
+		{
+			setup:      func(i *instruction) { i.asXmmToGpr(sseOpcodeMovq, xmm0VReg, rdiVReg, false) },
+			want:       "660f7ec7",
+			wantFormat: "movq %xmm0, %edi",
+		},
+		{
+			setup:      func(i *instruction) { i.asXmmToGpr(sseOpcodeCvttss2si, xmm0VReg, rdiVReg, true) },
+			want:       "f3480f2cf8",
+			wantFormat: "cvttss2si %xmm0, %rdi",
+		},
+		{
+			setup:      func(i *instruction) { i.asXmmToGpr(sseOpcodeCvttss2si, xmm0VReg, rdiVReg, false) },
+			want:       "f30f2cf8",
+			wantFormat: "cvttss2si %xmm0, %edi",
+		},
+		{
+			setup:      func(i *instruction) { i.asXmmToGpr(sseOpcodeCvttsd2si, xmm0VReg, rdiVReg, true) },
+			want:       "f2480f2cf8",
+			wantFormat: "cvttsd2si %xmm0, %rdi",
+		},
+		{
+			setup:      func(i *instruction) { i.asXmmToGpr(sseOpcodeCvttsd2si, xmm0VReg, rdiVReg, false) },
+			want:       "f20f2cf8",
+			wantFormat: "cvttsd2si %xmm0, %edi",
+		},
 		{
 			setup:      func(i *instruction) { i.asPop64(raxVReg) },
 			want:       "58",
diff --git a/internal/engine/wazevo/e2e_test.go b/internal/engine/wazevo/e2e_test.go
index 3b99cf10..79bbde23 100644
--- a/internal/engine/wazevo/e2e_test.go
+++ b/internal/engine/wazevo/e2e_test.go
@@ -1327,7 +1327,7 @@ func TestSpectestV1(t *testing.T) {
 		//{name: "local_get"},
 		//{name: "local_set"},
 		//{name: "local_tee"},
-		//{name: "memory"},
+		{name: "memory"},
 		{name: "memory_size"},
 		{name: "memory_grow"},
 		{name: "memory_redundancy"},
diff --git a/internal/engine/wazevo/engine_test.go b/internal/engine/wazevo/engine_test.go
index 555ef7a5..852992c6 100644
--- a/internal/engine/wazevo/engine_test.go
+++ b/internal/engine/wazevo/engine_test.go
@@ -73,7 +73,6 @@ func (f fakeFinalizer) setFinalizer(obj interface{}, finalizer interface{}) {
 }
 
 func TestEngine_CompileModule(t *testing.T) {
-	skipOnAmd64(t)
 	ctx := context.Background()
 	e := NewEngine(ctx, 0, nil).(*engine)
 	ff := fakeFinalizer{}
diff --git a/internal/engine/wazevo/wazevo_test.go b/internal/engine/wazevo/wazevo_test.go
index ffe74846..7a59a4b6 100644
--- a/internal/engine/wazevo/wazevo_test.go
+++ b/internal/engine/wazevo/wazevo_test.go
@@ -22,21 +22,12 @@ func TestMain(m *testing.M) {
 	os.Exit(m.Run())
 }
 
-// TODO: delete once we complete the implementation for amd64.
-func skipOnAmd64(t *testing.T) {
-	if runtime.GOARCH == "amd64" {
-		t.Skip("skip on amd64")
-	}
-}
-
 func TestNewEngine(t *testing.T) {
-	skipOnAmd64(t)
 	e := NewEngine(ctx, api.CoreFeaturesV1, nil)
 	require.NotNil(t, e)
 }
 
 func TestEngine_CompiledModuleCount(t *testing.T) {
-	skipOnAmd64(t)
 	e, ok := NewEngine(ctx, api.CoreFeaturesV1, nil).(*engine)
 	require.True(t, ok)
 	require.Equal(t, uint32(0), e.CompiledModuleCount())
@@ -45,7 +36,6 @@ func TestEngine_CompiledModuleCount(t *testing.T) {
 }
 
 func TestEngine_DeleteCompiledModule(t *testing.T) {
-	skipOnAmd64(t)
 	e, ok := NewEngine(ctx, api.CoreFeaturesV1, nil).(*engine)
 	require.True(t, ok)
 	id := wasm.ModuleID{0xaa}
diff --git a/internal/integration_test/fuzz/wazerolib/lib.go b/internal/integration_test/fuzz/wazerolib/lib.go
index ca6b5a83..a7087cf4 100644
--- a/internal/integration_test/fuzz/wazerolib/lib.go
+++ b/internal/integration_test/fuzz/wazerolib/lib.go
@@ -10,7 +10,6 @@ import (
 	"math"
 	"os"
 	"path"
-	"runtime"
 	"strings"
 
 	"github.com/tetratelabs/wazero"
@@ -92,9 +91,6 @@ func newCompilerConfig() wazero.RuntimeConfig {
 
 //export test_signal_stack
 func test_signal_stack() {
-	if runtime.GOARCH != "arm64" { // TODO: amd64.
-		return
-	}
 	// (module
 	//  (func (export "long_loop")
 	//    (loop