- Notifications
You must be signed in to change notification settings - Fork 2.6k
Optimize u>=1 to u!=0 and u<1 to u==0 #25458
Conversation
Any diffs? |
@mikedn is there a doc on how to do it properly for the whole coreclr/corefx? I am only using |
For diffs you need jit-diff from the jitutils repository: https://github.com/dotnet/jitutils/blob/master/doc/diffs.md Running jit-diff itself shouldn't be too difficult but you need a coreclr "baseline". The docs recommend using a separate coreclr clone but I find that to be overkill. I normally just build master and save the clrjit.dll in a "base" folder and pass that to jit-diff. |
Here's the x64 FX diff:
|
// will still compute the same value as before | ||
tree->SetOper(oper, GenTree::PRESERVE_VN); | ||
cns2->gtIntCon.gtIconVal = 0; | ||
SET_OPER: |
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.
Maybe better replace it to outside of else if (!tree->IsUnsigned() && cns2->IsIntegralConst(-1))
scope and also its end of if (op2->gtOper == GT_CNS_INT)
?
@dotnet/jit-contrib |
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 change looks good, thank you!
Sorry , it took me longer than I expected to reach that PR.
Could you please rebase/fix the conflicts and we will merge that?
@sandreenko sure! |
ac7842b
to 55619df
Compare …comp-fixes # Conflicts: # src/jit/morph.cpp
55619df
to 5ea3065
Compare @EgorBo could you please clone https://github.com/dotnet/jitutils, run bootstrap.cmd and then run jit-format to fix the formatting errors, like:
|
JIT already applies these tricks for signed types. This PR adds support for unsigned (extends existing logic). The diff looks big because I removed the surrounding if-else block
/cc: @mikedn