Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement clz/ctz instructions #42

Closed
wants to merge 9 commits into from
Closed

Conversation

bitwalker
Copy link
Contributor

This PR builds on changes in #37, and adds implementations of clz and ctz for integral types up to 32 bits.

In this PR, a couple of small tweaks/fixes as well:

  • Add support for loc_store and loc_storew, which we use in one of the new intrinsics
  • Fix up and unify formatting of MASM opcodes
  • Automatically detect (and add to default link set) all intrinsic modules we define under codegen/masm/intrinsics
  • Remove rust-wasm-tests from workspace members, since it is compiled and run with a separate build profile via frontend-wasm's test suite. When added as a workspace member the profile rust-wasm-tests defines is ignored, so it's not going to do what we expect. We'll catch any issues with that crate when CI runs our tests anyway.

Closes #39

@bitwalker bitwalker requested a review from a team October 19, 2023 18:41
@bitwalker bitwalker self-assigned this Oct 19, 2023
@bitwalker bitwalker marked this pull request as draft October 19, 2023 23:23
@bitwalker
Copy link
Contributor Author

NOTE: I'm adding some tests for this, as found some issues (not with the intrinsics, but somewhere in the emulator I think when testing the behavior, something to do with how memory and the operand stack interoperate, I'll fix it tomorrow when I have a moment)

@greenhat
Copy link
Contributor

I made #44 for Wasm translation.

Copy link
Contributor

@greenhat greenhat left a comment

Choose a reason for hiding this comment

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

Looking good!
I could not check the MASM code of the intrinsics in my head due to its complexity. So having tests for them would be nice, but I'm recalling from the discord thread that these ops will be implemented in VM soon, so I guess we can afford to skip the tests for now.

I saw your note but missed the revert of the status to draft. I'll do another round when its ready.

Base automatically changed from bitwalker/i32 to main November 16, 2023 15:52
@bitwalker bitwalker closed this Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement clz/ctz instructions
2 participants