-
Notifications
You must be signed in to change notification settings - Fork 5.1k
arm64: Add support for Bitwise OR NOT & XOR NOT #111893
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
Merged
kunalspathak
merged 5 commits into
dotnet:main
from
jonathandavies-arm:upstream/compact-encodings-eon
Feb 3, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3b4225d
arm64: Add support for Bitwise XOR NOT
jonathandavies-arm fc2359a
arm64: Add support for Bitwise OR NOT
jonathandavies-arm c2ca777
Update comments & add a tests that takes ints
jonathandavies-arm 41fbac9
Add swap tests that take a int & uint
jonathandavies-arm 4cbc61c
Merge branch 'main' into upstream/compact-encodings-eon
jonathandavies-arm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8271,8 +8271,8 @@ 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); | ||
// We shouldn't find AND_NOT, OR_NOT or XOR_NOT nodes since it should only be produced in lowering | ||
assert((oper != GT_AND_NOT) && (oper != GT_OR_NOT) && (oper != GT_XOR_NOT)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here. please update the comment in this file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
if (varTypeIsMask(type)) | ||
{ | ||
|
@@ -8415,7 +8415,7 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary( | |
genTreeOps oper = tree->GetOperForHWIntrinsicId(&isScalar); | ||
|
||
// 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)); | ||
|
||
if (isScalar) | ||
{ | ||
|
@@ -8903,7 +8903,7 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary( | |
genTreeOps oper = tree->GetOperForHWIntrinsicId(&isScalar); | ||
|
||
// 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)); | ||
|
||
if (isScalar) | ||
{ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
using Xunit; | ||
|
||
namespace TestEon | ||
{ | ||
public class Program | ||
{ | ||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
[Fact] | ||
public static int CheckEon() | ||
{ | ||
bool fail = false; | ||
|
||
if (Eon(5, 1) != 0xFFFFFFFB) | ||
{ | ||
fail = true; | ||
} | ||
|
||
if (EonLSL(0x12345678, 0xA) != 0xEDC92987) | ||
{ | ||
fail = true; | ||
} | ||
|
||
if (EonLSLSwapInt(0x12345678, 0xA) != -0x1236d679) | ||
{ | ||
fail = true; | ||
} | ||
|
||
if (EonLSLSwapUint(0xFDFDFDFD, 0xB) != 0x200C202) | ||
{ | ||
fail = true; | ||
} | ||
|
||
if (EonLSR(0x87654321, 0xFEDCBA) != 0x789D4A3B) | ||
{ | ||
fail = true; | ||
} | ||
|
||
if (EonASR(0x2468, 0xFEDCBA) != -0x246C) | ||
{ | ||
fail = true; | ||
} | ||
|
||
if (EonLargeShift(0x87654321, 0x12345678) != 0xB89ABCDE) | ||
{ | ||
fail = true; | ||
} | ||
|
||
if (EonLargeShift64Bit(0x1357135713571357, 0x123456789ABCDEF0) != 0xECA8ECA8ECE03DF1) | ||
{ | ||
fail = true; | ||
} | ||
|
||
if (fail) | ||
{ | ||
return 101; | ||
} | ||
return 100; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static uint Eon(uint a, uint b) | ||
{ | ||
//ARM64-FULL-LINE: eon {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}} | ||
return a ^ ~b; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static uint EonLSL(uint a, uint b) | ||
{ | ||
//ARM64-FULL-LINE: eon {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, LSL #14 | ||
return a ^ ~(b<<14); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static int EonLSLSwapInt(int a, int b) | ||
{ | ||
//ARM64-FULL-LINE: eon {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, LSL #14 | ||
return ~(b<<14) ^ a; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static uint EonLSLSwapUint(uint a, uint b) | ||
{ | ||
//ARM64-FULL-LINE: eon {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, LSL #14 | ||
return ~(b<<14) ^ a; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static uint EonLSR(uint a, uint b) | ||
{ | ||
//ARM64-FULL-LINE: eon {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, LSR #5 | ||
return a ^ ~(b>>5); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static int EonASR(int a, int b) | ||
{ | ||
//ARM64-FULL-LINE: eon {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, ASR #22 | ||
return a ^ ~(b>>22); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static uint EonLargeShift(uint a, uint b) | ||
{ | ||
//ARM64-FULL-LINE: eon {{w[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, LSL #27 | ||
return a ^ ~(b<<123); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static ulong EonLargeShift64Bit(ulong a, ulong b) | ||
{ | ||
//ARM64-FULL-LINE: eon {{x[0-9]+}}, {{x[0-9]+}}, {{x[0-9]+}}, LSR #38 | ||
return a ^ ~(b>>166); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<!-- Needed for CLRTestEnvironmentVariable --> | ||
<RequiresProcessIsolation>true</RequiresProcessIsolation> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DebugType>None</DebugType> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="Eon.cs"> | ||
<HasDisasmCheck>true</HasDisasmCheck> | ||
</Compile> | ||
<CLRTestEnvironmentVariable Include="DOTNET_TieredCompilation" Value="0" /> | ||
<CLRTestEnvironmentVariable Include="DOTNET_JITMinOpts" Value="0" /> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
update the above comment.
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.
Done