Implement @mod and fix bugs with divFloor for wasm#16899
Merged
Luukdegram merged 2 commits intoziglang:masterfrom Aug 24, 2023
Merged
Implement @mod and fix bugs with divFloor for wasm#16899Luukdegram merged 2 commits intoziglang:masterfrom
@mod and fix bugs with divFloor for wasm#16899Luukdegram merged 2 commits intoziglang:masterfrom
Conversation
Luukdegram
suggested changes
Aug 21, 2023
Contributor
Luukdegram
left a comment
There was a problem hiding this comment.
Thank you for your contribution. I'd like to see a behavior test enabled that triggers this instruction as part of this PR before accepting. The rest is just some minor aesthetic changes, which aren't necessarily blocking this PR from being merged.
Implement lowering code for `@mod` on integers in the stage2 wasm backend Fix invalid wasm being produced for `@divFloor` on signed integers by the stage2 wasm backend
Replace `@panic` with `unreachable` in stage2 wasm `@divFloor` implementation Add test for division and remainder operations for stage2 wasm
Contributor
Author
|
I've added a test (copied from |
Contributor
|
Thank you, great work! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement lowering code for
@modon integers in the stage2 wasm backend (@modon floats remains unimplemented).Fix invalid wasm being produced for
@divFlooron signed integers by the stage2 wasm backend. wasm comparison instructions (e.g., less than) always output ani32, andselecttakes ani32as the condition, but the previous@divFloorimplementation assumed that when comparing or selecting betweeni64, the output / condition would be ani64.This pull request also renames
signAbsValueinwasm/CodeGen.zigtosignExtendInt, as I found the previous name misleading.The new
@divFloorimplementation 0 extends its result when used on typeiNwhereN < 64, N != 32- see #16807 (comment).