Skip to content
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: Add support for Bitwise OR NOT & XOR NOT #111893

Merged

Conversation

jonathandavies-arm
Copy link
Contributor

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jan 28, 2025
@jonathandavies-arm
Copy link
Contributor Author

@a74nh @kunalspathak @dotnet/arm64-contrib

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jan 28, 2025
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@danmoseley danmoseley requested a review from Copilot January 28, 2025 16:42
@jonathandavies-arm jonathandavies-arm changed the title arm64: Add support for Bitwise XOR NOT arm64: Add support for Bitwise OR NOT & XOR NOT Jan 29, 2025
Copy link
Member

@kunalspathak kunalspathak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good overall. Added some minor comments.

@@ -31029,7 +31030,9 @@ bool GenTree::IsVectorPerElementMask(var_types simdBaseType, unsigned simdSize)
case GT_AND:
case GT_AND_NOT:
case GT_OR:
case GT_OR_NOT:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need change here? Isn't this just for base instructions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is checking that a node is a mask. If this node is AND/AND_NOT/OR/XOR and both of it's children are masks, then it is also a mask. OR_NOT/XOR_NOT also fit into that pattern. I don't think any hwintrinsics today are going to end up there, but we do have predicate OR_NOT/XOR_NOT for SVE, so I think we might end up using it later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it.

@@ -9925,7 +9925,7 @@ GenTree* Compiler::fgOptimizeHWIntrinsic(GenTreeHWIntrinsic* node)
genTreeOps oper = actualOper;

// We shouldn't find AND_NOT nodes since it should only be produced in lowering
assert(oper != GT_AND_NOT);
assert((oper != GT_AND_NOT) && (oper != GT_OR_NOT) && (oper != GT_XOR_NOT));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the above comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -8272,7 +8272,7 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(
if (oper != GT_NONE)
{
// We shouldn't find AND_NOT nodes since it should only be produced in lowering
assert(oper != GT_AND_NOT);
assert((oper != GT_AND_NOT) && (oper != GT_OR_NOT) && (oper != GT_XOR_NOT));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. please update the comment in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}

[MethodImpl(MethodImplOptions.NoInlining)]
static uint EonLSLSwap(uint a, uint b)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add one example for int version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@@ -72,7 +72,7 @@ static uint EonLSL(uint a, uint b)
}

[MethodImpl(MethodImplOptions.NoInlining)]
static uint EonLSLSwap(uint a, uint b)
static int EonLSLSwap(int a, int b)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i meant in addition to uint, add a new test for int. Same for Orn.

@kunalspathak
Copy link
Member

Please resolve the merge conflict and then we should be good to go.

@jonathandavies-arm
Copy link
Contributor Author

@jakobbotsch
Copy link
Member

/azp run runtime

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@kunalspathak kunalspathak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for your contribution.

@kunalspathak kunalspathak merged commit 3a99c64 into dotnet:main Feb 3, 2025
120 of 122 checks passed
grendello added a commit to grendello/runtime that referenced this pull request Feb 4, 2025
* main: (30 commits)
  JIT: Optimize bit-wise AND with a constant mask in combination with a left shift in a compare (dotnet#111979)
  Change how we build the cross-OS DAC to support building in the VMR (dotnet#111927)
  Add Windows Server 2025 to test configurations (dotnet#111938)
  [PERF] Move performance testing YAML from dotnet/runtime to dotnet/performance (dotnet#111454)
  arm64: Add support for Bitwise OR NOT & XOR NOT (dotnet#111893)
  JIT: Fix cross crossgen comparison failures (dotnet#112078)
  Bump `StyleCop.Analyzers` to `1.2.0-beta.556` (dotnet#111278)
  Remove `RequiresProcessIsolation` on InterfaceFolding tests (dotnet#112098)
  Use hardlinks in helixpublishwitharcade (dotnet#112091)
  Update breaking change rules regarding byref/objref fields. (dotnet#112087)
  [daccess] Do not use USE_DAC_TABLE_RVA on Apple platforms (dotnet#112076)
  use collection syntax in illink (dotnet#108458)
  Include PDB for all TfmRuntimeSpecificPackageFile (dotnet#111879)
  [main] Update dependencies from dotnet/emsdk (dotnet#111690)
  Enable Mono tests (dotnet#111981)
  Let the debugger knows DATAS is on (dotnet#107115)
  Tests ran counter (dotnet#111145)
  Some System.Decimal performance improvements (dotnet#99212)
  [mono][mini] Remove support for the Xamarin.iOS and Xamarin.Mac assemblies in the AOT compiler. (dotnet#108886)
  Remove one usage of `Unsafe.AsPointer`. (dotnet#112079)
  ...
@jonathandavies-arm jonathandavies-arm deleted the upstream/compact-encodings-eon branch February 13, 2025 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants