Skip to content

[RyuJIT Wasm] Implement i64/f32/f64 loads and adds#121933

Merged
kg merged 14 commits intodotnet:mainfrom
kg:ryujit-wasm-i64-and-floats
Nov 26, 2025
Merged

[RyuJIT Wasm] Implement i64/f32/f64 loads and adds#121933
kg merged 14 commits intodotnet:mainfrom
kg:ryujit-wasm-i64-and-floats

Conversation

@kg
Copy link
Copy Markdown
Member

@kg kg commented Nov 24, 2025

My first JIT PR so I'm keeping it simple.

Copilot AI review requested due to automatic review settings November 24, 2025 19:32
@kg kg added arch-wasm WebAssembly architecture area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Nov 24, 2025
@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.

@kg
Copy link
Copy Markdown
Member Author

kg commented Nov 24, 2025

@dotnet/jit-contrib

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements basic arithmetic operations (loads and adds) for i64, f32, and f64 types in the RyuJIT WebAssembly backend. The changes enable the JIT compiler to generate WebAssembly instructions for these fundamental operations across 64-bit integers, 32-bit floats, and 64-bit floats.

  • Implements register validation functions for integer and float registers based on WASM value types
  • Adds WASM instruction definitions for i64/f32/f64 load and add operations
  • Updates code generation to handle typed binary operations using a new helper function

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/coreclr/jit/targetwasm.h Replaces NYI stubs with actual implementations of register validation functions that check WASM value types (I32, I64, F32, F64)
src/coreclr/jit/instrswasm.h Adds instruction definitions for i64_load, f32_load, f64_load, i64_add, f32_add, and f64_add with their corresponding opcodes
src/coreclr/jit/instr.cpp Extends ins_Load to support TYP_LONG, TYP_FLOAT, and TYP_DOUBLE by mapping them to appropriate WASM load instructions
src/coreclr/jit/codegenwasm.cpp Introduces OperAndType helper to combine operation and type into a switch value, refactors genCodeForBinary to handle GT_ADD for INT, LONG, FLOAT, and DOUBLE types
src/coreclr/jit/lower.cpp Adds workaround for NumSegments being 0 on WASM to prevent crashes when creating GT_PUTARG_STK nodes

Copy link
Copy Markdown
Contributor

@SingleAccretion SingleAccretion left a comment

Choose a reason for hiding this comment

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

LGTM with one comment. Nice!

Copy link
Copy Markdown
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

Let's merge this and I will fix up my control flow PR to build on it.

@kg kg enabled auto-merge (squash) November 26, 2025 19:39
@kg kg merged commit 3b3270b into dotnet:main Nov 26, 2025
110 of 112 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture 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.

5 participants