From a9038686093a1516ebebc95a9670dde9a5278fdb Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Wed, 1 Jul 2026 15:37:37 -0700 Subject: [PATCH] [wasm] Bail R2R for SIMD16 store-indirect and SIMD16 parameters Vector128 parameters are lowered to i32 in the wasm signature and a SIMD16 store-indirect emits v128.store with an i32 operand, both of which produce invalid modules; bail such methods to the interpreter via NYI_WASM_SIMD until SIMD16 is properly supported. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/coreclr/jit/codegenwasm.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/codegenwasm.cpp b/src/coreclr/jit/codegenwasm.cpp index 2dc4f79bbeddf0..03386420966faf 100644 --- a/src/coreclr/jit/codegenwasm.cpp +++ b/src/coreclr/jit/codegenwasm.cpp @@ -105,6 +105,18 @@ 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 + // 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) + { + NYI_WASM_SIMD("SIMD16 parameter"); + } + } + GetEmitter()->emitIns(INS_code_size); FuncInfoDsc* const func = m_compiler->funGetFunc(ROOT_FUNC_IDX); @@ -2748,8 +2760,15 @@ void CodeGen::genCodeForStoreInd(GenTreeStoreInd* tree) } else // A normal store, not a WriteBarrier store { - var_types type = tree->TypeGet(); - instruction ins = ins_Store(type); + var_types type = tree->TypeGet(); + if (type == TYP_SIMD16) + { + // Storing a SIMD16 value emits v128.store, but the data operand is not + // materialized as a v128 (it comes through as an i32), producing an invalid + // module. Bail until SIMD16 store is properly supported. + NYI_WASM_SIMD("SIMD16 store indirect"); + } + instruction ins = ins_Store(type); // TODO-WASM: Memory barriers