-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add support for binary/octal literals to ISLE #6234
Add support for binary/octal literals to ISLE #6234
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Also a sentence somewhere in the language reference to note that binary + octal are accepted would be good, I think. |
Subscribe to Label Action
This 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 |
* 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
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.