Add support for binary/octal literals to ISLE#6234
Merged
alexcrichton merged 3 commits intoApr 18, 2023
Conversation
In a number of x64-changes recently some u8 immediates are interpreted as four bit-packed 2-bit numbers and I have a tough time going between hex and these bit-packed numbers. I've been writing `0xAA == 0b...` in comments to indicate the intent but I figured it'd be a bit clearer if the binary literal was accepted directly! This is a minor update to the ISLE lexer to allow for binary `0b00...` and octal `0o00...` literals in the same manner as hex literals. Some comments in the x64 backend are then removed to use the binary literal syntax directly.
cfallin
approved these changes
Apr 18, 2023
Member
There was a problem hiding this comment.
Nice improvement, thanks!
If it's not too much, would you mind adding uses of a binary and octal literal to the ISLE testsuite (the slightly-misnamed cranelift/isle/isle/isle_examples)? The run/iconst.isle / run/iconst_main.rs test does a bunch of assertions with hex literals so seems like a good place for this.
Member
|
Also a sentence somewhere in the language reference to note that binary + octal are accepted would be good, I think. |
Subscribe to Label ActionDetailsThis issue or pull request has been labeled: "cranelift", "cranelift:area:x64", "isle"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
eduardomourar
pushed a commit
to eduardomourar/wasmtime
that referenced
this pull request
Apr 28, 2023
* Add support for binary/octal literals to ISLE In a number of x64-changes recently some u8 immediates are interpreted as four bit-packed 2-bit numbers and I have a tough time going between hex and these bit-packed numbers. I've been writing `0xAA == 0b...` in comments to indicate the intent but I figured it'd be a bit clearer if the binary literal was accepted directly! This is a minor update to the ISLE lexer to allow for binary `0b00...` and octal `0o00...` literals in the same manner as hex literals. Some comments in the x64 backend are then removed to use the binary literal syntax directly. * Update ISLE reference for octal/binary * Update ISLE tests for octal/binary
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.
In a number of x64-changes recently some u8 immediates are interpreted as four bit-packed 2-bit numbers and I have a tough time going between hex and these bit-packed numbers. I've been writing
0xAA == 0b...in comments to indicate the intent but I figured it'd be a bit clearer if the binary literal was accepted directly!This is a minor update to the ISLE lexer to allow for binary
0b00...and octal0o00...literals in the same manner as hex literals. Some comments in the x64 backend are then removed to use the binary literal syntax directly.