-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
arm64: Optimise GT/GE/LT/LE comparisons in return statements #112863
base: main
Are you sure you want to change the base?
arm64: Optimise GT/GE/LT/LE comparisons in return statements #112863
Conversation
jonathandavies-arm
commented
Feb 24, 2025
•
edited
Loading
edited
- Contributes to Review the multi-op instruction usage for Arm64 #68028
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SupportsSettingZeroFlag
should be renamed to something that indicates the set of flags needed by these comparisons.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be arm64 specific change? seems there are some test failures on x64 as well.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.)
@@ -5,13 +5,13 @@ | |||
using System.Runtime.CompilerServices; | |||
using Xunit; | |||
|
|||
namespace TestBitwiseClearShift | |||
namespace TestBic |
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.
Also need to update corresponding .csproj
file to reflect the new file name.
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.
Fixed
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? |
src/coreclr/jit/gentree.cpp
Outdated
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |