arm64: Optimise GT/GE/LT/LE comparisons in return statements#112863
arm64: Optimise GT/GE/LT/LE comparisons in return statements#112863jonathandavies-arm wants to merge 18 commits intodotnet:mainfrom
Conversation
|
@a74nh @kunalspathak @dotnet/arm64-contrib |
src/coreclr/jit/lower.cpp
Outdated
| if (cmp->OperIs(GT_EQ, GT_NE) && op2->IsIntegralConst(0) && op1->SupportsSettingZeroFlag() && | ||
| BlockRange().TryGetUse(cmp, &use)) | ||
| if (cmp->OperIs(GT_EQ, GT_NE, GT_GT, GT_GE, GT_LT, GT_LE) && op2->IsIntegralConst(0) && | ||
| op1->SupportsSettingZeroFlag() && BlockRange().TryGetUse(cmp, &use)) |
There was a problem hiding this comment.
SupportsSettingZeroFlag should be renamed to something that indicates the set of flags needed by these comparisons.
kunalspathak
left a comment
There was a problem hiding this comment.
Can you fix the test errors in CI?
src/coreclr/jit/lower.cpp
Outdated
| if (cmp->OperIs(GT_EQ, GT_NE) && op2->IsIntegralConst(0) && op1->SupportsSettingZeroFlag() && | ||
| BlockRange().TryGetUse(cmp, &use)) | ||
| if (cmp->OperIs(GT_EQ, GT_NE, GT_GT, GT_GE, GT_LT, GT_LE) && op2->IsIntegralConst(0) && | ||
| op1->SupportsSettingFlags() && BlockRange().TryGetUse(cmp, &use)) |
There was a problem hiding this comment.
should this be arm64 specific change? seems there are some test failures on x64 as well.
There was a problem hiding this comment.
Why make this arm64 specific? We should figure out why this would not work for x64 and what would be different between x64 and arm64 in those cases before we just disable this.
There was a problem hiding this comment.
I wanted to have this focused change for arm64. We should have separate PR if we want to enable it for x64.
There was a problem hiding this comment.
That's ok with me -- in that case I think we should introduce a new SupportsSettingResultFlags that returns false on all platforms but arm64, and then make the check something like
(cmp->OperIs(GT_EQ, GT_NE) && op1->SupportsSettingZeroFlag()) || (cmp->OperIs(GT_GT, GT_GE, GT_LT, GT_LE) && op1->SupportsSettingResultFlags())
(The rename to SupportsSettingFlags does not look right for xarch, since that function currently queries emitter::DoesWriteZeroFlag for hardware intrinsics. That might be the cause of the failures.)
| using Xunit; | ||
|
|
||
| namespace TestBitwiseClearShift | ||
| namespace TestBic |
There was a problem hiding this comment.
Also need to update corresponding .csproj file to reflect the new file name.
|
Were you able to find out the other failing tests? |
Change-Id: I0dbd2de796a11badde063684761cec93fc1c8355
* Update SupportsSettingResultFlags() comments Change-Id: I6c1f9ad86933329575442ce212b322650ac71b34
Change-Id: I76753a9b034934aa0f1c765854421ce9e7b970d3
|
Thanks, looks good to me now. Can you also update the title of the PR to be accurate? |
| // The backend expects any node for which the flags will be consumed to be | ||
| // marked with GTF_SET_FLAGS. | ||
| // | ||
| bool GenTree::SupportsSettingResultFlags() |
There was a problem hiding this comment.
The build is failing because this was already defined above
Change-Id: I18402694c3a8b63f71b9cb2b810a0d4db05f4aaf
|
@jonathandavies-arm - did you verify the latest CI failures? |
|
|
Hi @kunalspathak , I'm having trouble running the test that is failing in the pipeline. Please can you see if what I'm trying in correct? I'm trying to run the System.Diagnostics.StackTrace.Tests locally in order to investigate the current failure. I've tried:
The last one seems most like how the tests are run on the GitHub build. I get this error when I use I'm running this on an x64 machine and will run it on an arm64 once I can run this test. |
let me sync-up with you offline. |
|
This pull request has been automatically marked |
|
We won't be working on it right away. |
Uh oh!
There was an error while loading. Please reload this page.