shrayjaiswal050-design opened PR #14798 from shrayjaiswal050-design:fix/x64-i64x2-narrow to bytecodealliance:main:
Fixes #4734.
The x64 backend was missing the general
snarrowandunarrowlowerings fori64x2inputs. As a result, validi64x2 -> i32x4operations failed during compilation.This adds SSE2-compatible lowerings that:
- Saturate signed values for
snarrow.- Treat
unarrowinputs as signedi64values and clamp them to[0, u32::MAX].- Preserve the expected lane order.
- Keep the existing optimized conversion-specific lowerings.
Tests cover saturation boundaries, negative values, lane ordering, loaded values, and live inputs.
Checks:
- 702 x64/runtime/egraph filetests passed.
- 204 Cranelift codegen unit tests passed.
cargo fmt -p cranelift-codegen -- --checkgit diff --check
shrayjaiswal050-design requested cfallin for a review on PR #14798.
shrayjaiswal050-design requested wasmtime-compiler-reviewers for a review on PR #14798.
github-actions[bot] added the label cranelift on PR #14798.
github-actions[bot] added the label cranelift:area:x64 on PR #14798.
:memo: cfallin submitted PR review:
Thanks! These lowerings look fine to me. Just a nit on the test below.
:speech_balloon: cfallin created PR review comment:
Can we add other architectures too if they support this instruction? And at least the Cranelift interpreter, too (and let's add support there if we're missing this case).
:memo: shrayjaiswal050-design submitted PR review.
:speech_balloon: shrayjaiswal050-design created PR review comment:
Thanks, good point. I’ll extend the test coverage to the other backends that support i64x2 snarrow/unarrow, and make sure the Cranelift interpreter handles and exercises these cases as well. I’ll update the test matrix and rerun the relevant file tests.
Last updated: Oct 31 2026 at 23:03 UTC