-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
JIT: Wrong result with double comparison #112871
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
I checked in SharpLab, I don't see that happening. (Debug/Release switch is on top corner RHS) |
Can repro on godbolt (the one on the right) with
https://godbolt.org/z/er1G16Yx8 Interestingly, the issue will disappear if you turn on tiered compilation (the one on the left). |
This is another one exposed by #111595 Without AVX-512, we don't allow uint->floating casts directly -- they go through long:
With it, we don't force the intermediate cast:
In lowering, uint->floating casts where the base type is small get an intermediate uint->int cast inserted: runtime/src/coreclr/jit/lowerxarch.cpp Lines 1167 to 1173 in 509c12b
So we get this transform:
And we end up emitting the signed int conversion instruction instead of unsigned. |
That code just looks bogus, using the non-actual type of an operand to make any semantic changes in codegen is just wrong. |
Agreed, I can't figure out why that was there, because uint->floating casts shouldn't have made it past the front end in the first place before #111595. |
It was indeed bogus. One of the casts it was trying to insert (float->small -> float->int->small) was already handled in morph. The one for the other direction was unnecessary as long as Opened #112892 with the fix |
cc @dotnet/jit-contrib
The text was updated successfully, but these errors were encountered: