-
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
Issues with the Crc32 intrinsic in the Jit #62692
Comments
Tagging subscribers to this area: @JulieLeeMSFT Issue Details1): The assert here is wrong because it does not account for small types. Reproduction: static uint Problem(byte* pSrc, uint data)
{
return Sse42.Crc32(*pSrc, data);
} 2) The same assert is also wrong because in lowering we purposefully remove narrowing static uint Problem(uint crc, ulong data)
{
return Sse42.Crc32(crc, (uint)(data >> 16));
} 3) The code in lowering is also wrong because it can discard meaningful casts. Reproduction ( static uint Problem(uint crc, uint data)
{
return Sse42.Crc32(crc, (uint)(byte)data);
}
|
The LSRA assert is the 4th case? |
Yep. |
@EgorBo Do you know approximately when you're going to get around to looking at this issue? It's probably nothing big, but the issue is blocking me (but nothing critical) :) |
Looking at it now, sorry for the delay |
no problem. thanks |
1): The assert here is wrong because it does not account for small types. Reproduction:
2) The same assert is also wrong because in lowering we purposefully remove narrowing
long
->int
casts to avoid generating redundantmov
s. Reproduction:3) The code in lowering is wrong because it can discard meaningful casts. Reproduction (
data
here will not be zero-extended):4) The code in lowering is also wrong because it can discard
long
->int
casts on x86, and end up with aGT_LONG
operand, which is not handled downstream. Reproduction, run on x86:5) The code in lowering is also wrong because it can discard
double/float -> int
casts. Applies to all use sites ofTryRemoveCastIfPresent
. Reproduction:Curiously enough, if we disable asserts, this will happily emit
crc32 eax, xmm1
.6) The code in lowering is also wrong because it can discard checked casts. Applies to all use sites of
TryRemoveCastIfPresent
. Reproduction (observe the generated code will have no check):The text was updated successfully, but these errors were encountered: