Skip to content

[RyuJIT Wasm] Handle all codegen cases for PackedSimd.Shuffle#130991

Draft
adamperlin wants to merge 7 commits into
dotnet:mainfrom
adamperlin:adamperlin/wasm-basic-shuffle-codegen
Draft

[RyuJIT Wasm] Handle all codegen cases for PackedSimd.Shuffle#130991
adamperlin wants to merge 7 commits into
dotnet:mainfrom
adamperlin:adamperlin/wasm-basic-shuffle-codegen

Conversation

@adamperlin

@adamperlin adamperlin commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Stacked on #130822

Copilot AI review requested due to automatic review settings July 17, 2026 18:48
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 17, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
10 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@adamperlin adamperlin changed the title Adamperlin/wasm basic shuffle codegen wasm basic shuffle codegen Jul 17, 2026
@adamperlin adamperlin changed the title wasm basic shuffle codegen [RyuJIT Wasm] Handle all codegen cases for PackedSimd.Shuffle Jul 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds/extends WebAssembly SIMD intrinsic lowering and codegen in CoreCLR RyuJIT, primarily to enable PackedSimd.Shuffle codegen and to move lane load/store intrinsics into the table-driven pipeline.

Changes:

  • Add LowerHWIntrinsicNativeShuffle to support NI_PackedSimd_Shuffle (emit native shuffle for constant masks; rewrite non-constant masks to swizzle+swizzle+or).
  • Introduce HW_Flag_HasImmediateOperand for WASM and use it to drive lowering/codegen decisions (lane immediates, jump-table fallback, containment).
  • Reclassify/enable WASM lane load/store intrinsics as HW_Category_MemoryLoad/MemoryStore and update codegen + OperIsMemoryLoad/Store to recognize WASM.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/coreclr/jit/lowerwasm.cpp Adds shuffle lowering; uses HasImmediateOperand to drive immediate-lane lowering and containment.
src/coreclr/jit/lower.h Declares the new WASM lowering helper LowerHWIntrinsicNativeShuffle.
src/coreclr/jit/hwintrinsicwasm.cpp Removes special-import handling for some lane-load intrinsics now handled table-driven; keeps immediate upper-bound logic for lane ops.
src/coreclr/jit/hwintrinsiclistwasm.h Reclassifies lane load/store intrinsics to memory categories; adds immediate-operand flags for relevant intrinsics.
src/coreclr/jit/hwintrinsiccodegenwasm.cpp Emits v128 immediates for shuffle; adds table-driven codegen for WASM memory load/store categories and jump-table support for lane memops.
src/coreclr/jit/hwintrinsic.h Adds WASM HW_Flag_HasImmediateOperand, updates HasImmediateOperand, and adds shuffle imm-op position + immediate vector accessor.
src/coreclr/jit/gentree.cpp Extends OperIsMemoryLoad/OperIsMemoryStore to include WASM.
src/coreclr/jit/codegenwasm.cpp Removes NYI guard for SIMD16 store-indirect to allow emitting stores.

Comment on lines +921 to +922
// These intrinsics don't a required immediate operand
assert(!hasImmOp);
Comment on lines +1336 to +1337
// (v128, v128, lane_imm)
*imm1Pos = 3;
Comment on lines +1312 to +1316
GenTree* Lowering::LowerHWIntrinsicNativeShuffle(GenTreeHWIntrinsic* node)
{
assert(node->GetHWIntrinsicId() == NI_PackedSimd_Shuffle);

GenTree* op1 = node->Op(1);
Copilot AI review requested due to automatic review settings July 17, 2026 19:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

case NI_PackedSimd_LoadScalarVector128:
case NI_PackedSimd_LoadWideningVector128:
{
// These intrinsics don't a required immediate operand
Comment on lines +1330 to +1335
// No extra work to do if the shuffle is a constant vector, it can be contained as an immediate and emitted.
if (shuffleMask->IsCnsVec())
{
ContainCheckHWIntrinsic(node);
return node->gtNext;
}
Comment on lines +1336 to +1337
// (v128, v128, lane_imm)
*imm1Pos = 3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants