Skip to content

x64: Fix sinking loads band/bor/bxor#13071

Merged
alexcrichton merged 1 commit intobytecodealliance:mainfrom
alexcrichton:load-fewer-bytes-again
Apr 15, 2026
Merged

x64: Fix sinking loads band/bor/bxor#13071
alexcrichton merged 1 commit intobytecodealliance:mainfrom
alexcrichton:load-fewer-bytes-again

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit fixes the x64 backend in Cranelift when sinking loads into band/bor/bxor instructions. If this happens for scalar types like f32 and f64 this means that the generated instruction will load too many bytes, similar to #13011 for example. These rules aren't reachable from WebAssembly but are still good to have fixed.

This commit fixes the x64 backend in Cranelift when sinking loads into
band/bor/bxor instructions. If this happens for scalar types like `f32`
and `f64` this means that the generated instruction will load too many
bytes, similar to bytecodealliance#13011 for example. These rules aren't reachable from
WebAssembly but are still good to have fixed.
@alexcrichton alexcrichton requested a review from a team as a code owner April 13, 2026 18:51
@alexcrichton alexcrichton requested review from uweigand and removed request for a team April 13, 2026 18:51
@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator cranelift:area:x64 Issues related to x64 codegen labels Apr 13, 2026
Copy link
Copy Markdown
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

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

Seems sensible to me.

@alexcrichton alexcrichton requested review from fitzgen and removed request for uweigand April 14, 2026 21:24
Copy link
Copy Markdown
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

This one might make sense to have wast tests for that do the operation at the end of memory, so that if our memory access is too wide, we will (incorrectly) trap.

@alexcrichton
Copy link
Copy Markdown
Member Author

Agreed! However I haven't added those here because I don't think I can insofar as wasm can't reach these rules (bitops on floats). Given that I'm going to go ahead and merge but if you know of how these are reachable from wasm @fitzgen lemme know

@alexcrichton alexcrichton added this pull request to the merge queue Apr 15, 2026
Merged via the queue into bytecodealliance:main with commit d3f444c Apr 15, 2026
61 checks passed
@alexcrichton alexcrichton deleted the load-fewer-bytes-again branch April 15, 2026 15:06
@fitzgen
Copy link
Copy Markdown
Member

fitzgen commented Apr 15, 2026

Agreed! However I haven't added those here because I don't think I can insofar as wasm can't reach these rules (bitops on floats). Given that I'm going to go ahead and merge but if you know of how these are reachable from wasm @fitzgen lemme know

I don't I was just thinking out loud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:area:x64 Issues related to x64 codegen cranelift Issues related to the Cranelift code generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants