Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Rewrite math jit helpers to managed code #98858
Rewrite math jit helpers to managed code #98858
Changes from 7 commits
5968f8d
dfbcf22
c665079
d150f78
49c110d
878b573
ef4868b
08eaa08
a96f68a
2b4b795
06cd46c
64b9bbc
769d5eb
b4d0521
ab17973
6a525ee
da0b434
18565e4
a7e114b
070bead
d4fd66d
8efe9eb
9c97f32
7943ef7
334838b
1cdcf5e
e221809
2188fe8
b4a5511
ffabbe7
68c39a4
02c5335
1c36262
8fcb99f
f7769d7
be4c607
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
It would be better to leave this change to the Intel PRs too.
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.
The previous behaviour here was kinda a bug since
CORINFO_HELP_DBL2UINT
was bound toDbl2Lng
, it only worked fine cause X86 and ARM32 ABIs return the lower bits of the long same as an uint. Calling theDbl2UInt
helper here would be a performance regression which you said are better left to the Intel PRs.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.
Yes, I agree the existing code is a hack but there is no observable bug. There is no point in cleaning it up in this PR. It requires an extra throw away work to evaluate the impact. I suspect that this change may be changing the observable behavior. We want to have the changes of observable behavior centralized in the Intel PR.
This PR is 95% good and non-controversial, and it is just these few changes that are holding it back. If you would like it to merged soon, I would recommend reverting the few controversial changes that are holding it back.
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.
How so? Isn't casting a long to uint the same as taking the lower 4B from it?
You mean the change here and the
// unused
comments?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.
This is casting double to uint. This sort of change can be changing behavior in the overflow case. I do not know. I do not want to spend any time reviewing changes related to floating point to integer conversion in this PR. It would be throw-away work.
Ideally, anything related to floating point to integer conversions that are being completely redone in the Intel PR.
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.
I'd argue that cleaning things up here makes the Intel changes simpler since it reduces the amount of work they need to do there. If the Intel folks prefer it, I can remove those from here however cc @khushal1996
To avoid JIT changes in this PR, I've moveddouble -> uint
casts to a managed implementation that copies what LLVM does in the latest commit since it's faster on my machine anyway. It is a bit of a throwaway work like you said but this change makes the PR simpler and I'd argue that it's safe since LLVM uses this implementation. Also, I don't think the Intel PR will have some better implementation for the helper here, it'll just add overflow checks to it.Nevermind, the LLVM implementation returns different values for out of range
double
s, gonna revert it then. It should still be safe to use with overflow checks though I think.