diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 50a812624831da..c0d4c5a9c61a60 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -29356,6 +29356,9 @@ GenTree* Compiler::gtNewSimdShuffleNode( uint64_t value = 0; simd_t vecCns = {}; + // i8x16.swizzle indexes bytes, so expand each element-granular selector into elementSize + // consecutive byte indices. An out-of-range selector becomes 0xFF bytes so swizzle's native + // "index >= 16 -> 0" behavior zero-fills that element. for (size_t index = 0; index < elementCount; index++) { value = op2->GetIntegralVectorConstElement(index, simdBaseType); @@ -29369,8 +29372,6 @@ GenTree* Compiler::gtNewSimdShuffleNode( } else { - // Swizzle selects zero for any byte index that is out of range (>= 16), so mark every - // byte of an out-of-range element accordingly. for (uint32_t i = 0; i < elementSize; i++) { vecCns.u8[(index * elementSize) + i] = 0xFF; diff --git a/src/coreclr/jit/hwintrinsiccodegenwasm.cpp b/src/coreclr/jit/hwintrinsiccodegenwasm.cpp index da4666b5e5d3e5..f093018d9dcb8f 100644 --- a/src/coreclr/jit/hwintrinsiccodegenwasm.cpp +++ b/src/coreclr/jit/hwintrinsiccodegenwasm.cpp @@ -43,7 +43,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) if ((info.id == NI_PackedSimd_Swizzle) && node->Op(2)->isContained()) { // A constant, fully in-range mask was lowered to an immediate i8x16.shuffle. - // genConsumeMultiOpOperands left the source on the value stack once (the mask + // prior codegen left the source on the value stack once (the mask // operand is contained, so no v128.const was materialized). i8x16.shuffle // selects from two vectors, so push the source a second time and encode the // mask as the 16-byte shuffle immediate.