-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Disable VerifyFloatToUInt and VerifyFloatToNullableUInt tests #47380
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
/cc @tannergooding as its really annoying this failing in CI |
src/coreclr/jit/compiler.hpp
Outdated
#if defined(_MSC_VER) && defined(TARGET_X86) | ||
// MSVC x86 emits __ftoui3 call for (UINT32)d | ||
// and it returns 4294967295U for float.MaxValue instead of 0. | ||
if (d == 3.40282346638528859e+38) |
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.
Do we have tests covering these scenarios to ensure they are consistent across both current and future compilers?
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.
Is the same not needed for float
?
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.
float->uint casts are forced through double on x86
runtime/src/coreclr/jit/morph.cpp
Lines 175 to 180 in fdc8148
// x86: src = float, dst = uint32/int64/uint64 or overflow conversion. | |
&& (tree->gtOverflow() || varTypeIsLong(dstType) || (dstType == TYP_UINT)) | |
#endif | |
) | |
{ | |
oper = gtNewCastNode(TYP_DOUBLE, oper, false, TYP_DOUBLE); |
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.
Ah I see. I wonder if that's holdover from when we still used the x87 FPU stack
Should we log a bug on MSVC to see if this is something they want to fix in a future update, or if they need to keep the behavior for backcompat? |
After giving this some more thought, I am wondering if the best long-term solution would be to just disable folding for constants that invoke implementation-specified behavior. This should kill a few birds with one stone:
This is already the behavior for non-finite constants. @tannergooding what do you think? (To be clear, this is for a future PR, this fix to unblock CI looks good modulo the fact that I think we should check for |
@tannergooding my goal was to unblock the CI asap and fix those two failing tests. I was planning to add more test cases separately (e.g. these dotnet/roslyn#37527) to list all the edge cases/differences |
@EgorBo, I think it's likely better to disable the two tests right now and work on getting a fix up separately. As @SingleAccretion mentioned, this impacts more than just the value being handled in the PR and it would likely be good to get some validation tests up simultaneously. |
I think having a temporary fix, such as deciding to not fold (or at least not fold when in R2R scenarios) is fine. But I think, long term, we would be in a better place by having these cases handled and well known, just like Roslyn did.
I'm not super concerned with this. We will already need the first half of the table to know which values are edge cases and it would be good (IMO) to have some minor documentation on what values users can expect for these values and therefore how they will differ.
This is a drawback, IMO. At least for |
@tannergooding makes sense, I've disabled the tests. |
@EgorBo might want to take "Fixes" out of summary so it doesn't close the other issue (or reopen after merge) |
Merging to unblock CI. |
Can we backport this to the release/6.0-preview1 branch? I saw these tests failing there too. |
Disables two tests, see #47374.
Minimal repro for MSVC x86: #47374 (comment)
Godbolt with other compilers: https://godbolt.org/z/W74hTh