-
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: Behaviour of iadd_imm.i128
with negative constants
#4568
Comments
Backends should either sign extend, or the operand type should change to Uimm64 (which doesn't exist yet, unlike for some other sizes) I think. |
Backends actually never see the |
The InstBuilder function for But it looks like a use case that probably wasn't considered when adding these instructions initially so we should probably review this. |
My point is that the behaviour should be specified explicitly, and yes, I agree that sign-extending makes the most sense. |
I agree that sign-extension makes the most sense here. There is actually an equivalent issue with |
👋 Hey, the clif fuzzer reported this issue.
.clif
Test CaseSteps to Reproduce
clif-util test ./the-above.clif
Expected Results
I don't know.
The
iadd_imm.i128
takes a i64 constant.The interpreter sign extends the constant, the backend does not.
Actual Results
Interpreter sign extends and returns 0 passing the test.
Native returns
0x1_0000_0000_0000_0000
and fails.Versions and Environment
Cranelift version or commit: main
Operating system: windows
Architecture: x86
Extra Info
I'm pretty much seeking confirmation that we don't sign extend these constant values. I think it looks weird that we input -1, but get something completely different.
cc: @cfallin @jameysharp
The text was updated successfully, but these errors were encountered: