From 5a9263111026c7939467295a98368b6f6b87c31f Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Wed, 8 Jul 2026 20:27:00 -0500 Subject: [PATCH] [wasm] Bail R2R for all SIMD parameter sizes, not just SIMD16 Vector2 (TYP_SIMD8) and Vector3 (TYP_SIMD12) parameters are lowered to i32 in the wasm signature, the same as Vector128 (TYP_SIMD16), but the argument-spill prolog only bailed R2R for TYP_SIMD16. As a result a method with an 8-byte SIMD parameter (e.g. System.Numerics.Matrix3x2 .CreateRotation(float, Vector2)) emitted an f64.store fed by the i32 parameter local, producing an invalid module that fails wasm validation ("type mismatch: expected f64, found i32"). Broaden the parameter bail in genBeginFnProlog from `== TYP_SIMD16` to `varTypeIsSIMD(...)` so SIMD8/SIMD12/SIMD16 parameters are all sent to the interpreter until SIMD parameters are supported in the wasm calling convention. This is a follow-up to the SIMD16 bail added in #130101 and lets System.Private.CoreLib produce a valid R2R image. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/coreclr/jit/codegenwasm.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/coreclr/jit/codegenwasm.cpp b/src/coreclr/jit/codegenwasm.cpp index ba5d414bff3c21..ff09c497df5ed9 100644 --- a/src/coreclr/jit/codegenwasm.cpp +++ b/src/coreclr/jit/codegenwasm.cpp @@ -105,15 +105,15 @@ void CodeGen::genMarkLabelsForCodegen() // void CodeGen::genBeginFnProlog() { - // SIMD16 (Vector128) parameters are lowered to i32 in the wasm signature, so any - // v128 operation performed on them produces an invalid module (e.g. a v128 op with - // an i32 operand). Bail such methods to the interpreter until SIMD16 parameters are + // SIMD (Vector2/3/4, Vector128) parameters are lowered to i32 in the wasm signature, so any + // vector operation performed on them produces an invalid module (e.g. a v128/f64 op with + // an i32 operand). Bail such methods to the interpreter until SIMD parameters are // properly supported in the wasm calling convention. for (unsigned lclNum = 0; lclNum < m_compiler->info.compArgsCount; lclNum++) { - if (m_compiler->lvaGetDesc(lclNum)->TypeGet() == TYP_SIMD16) + if (varTypeIsSIMD(m_compiler->lvaGetDesc(lclNum)->TypeGet())) { - NYI_WASM_SIMD("SIMD16 parameter"); + NYI_WASM_SIMD("SIMD parameter"); } }