-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
cranelift: Fix bint
implementation on interpreter
#4299
Conversation
The interpreter was returning -1 instead of 1 for positive values. This also extends the bint test suite to cover all types.
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.
@afonso360, good to see you again! I think this is mostly good to go except for SIMD types: bint
is a valid instruction for SIMD but it is not clear what the result should be. Should it be all ones/zeroes to match the Wasm SIMD specification for booleans? Or should it be a single one or zero (per lane) to match the CLIF instruction description? I think there is more context about this in #3205.
Because of this, I think the right thing to do here is to prevent using bint
with vector types. This would mean changing the allowed operands_in
in cranelift/codegen/meta/src/shared/instructions.rs
. From searching through this repository, I believe bint
is only ever used for scalar values so, unless some external consumer of bint
is using the vector version (not implemented in any backend, I think), then this change should be a safe one to make.
Also, as a side note, could this PR close #2237? Or is that issue already effectively done?
The |
I didn't realize
That is my understanding of it as well.
No, that issue I think is mostly related to the trampoline generating the wrong code when loading / storing booleans, and its why I had to do duplicate some code in this PR in order to not have boolean arguments to the test cases. |
I think restricting vectors from this instruction is the easiest path for now.
Yes, primarily it is about representations, but @cfallin mentions
👍 |
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.
LGTM! (@cfallin, you might want to take a look at this when you get back; we can always add back support for vector bint
but until we have lowerings for this case this seemed the safest approach).
Hey,
The interpreter was returning -1 instead of 1 for positive values on the
bint
instruction.This also extends the
bint
test suite to cover all types.