Skip to content

Implement SVE2 BitwiseSelect, BitwiseSelectLeftInverted, BitwiseSelectRightInverted #115775

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
merged 4 commits into from
May 22, 2025

Conversation

snickolls-arm
Copy link
Contributor

@snickolls-arm snickolls-arm commented May 20, 2025

@a74nh @kunalspathak

Contributes to #115479

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label May 20, 2025
case NI_Sve2_BitwiseSelectRightInverted:
// op1: select, op2: left, op3: right
// Operation is destructive on the 'left' operand.
if (targetReg != op2Reg)
Copy link
Member

Choose a reason for hiding this comment

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

this should be op1Reg because 1st operand has RMW semantics, not 2nd.

Copy link
Member

Choose a reason for hiding this comment

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

@kunalspathak this didn't need addressing because the logic was already correct, right?

The instruction is BSL <Zdn>.D, <Zdn>.D, <Zm>.D, <Zk>.D and the operation is:

CheckSVEEnabled();
constant integer VL = CurrentVL;
bits(VL) operand1 = Z[dn, VL];
bits(VL) operand2 = Z[m, VL];
bits(VL) operand3 = Z[k, VL];

Z[dn, VL] = (operand1 AND operand3) OR (operand2 AND NOT(operand3));

So we end up emitting mov tgt, op2; BSL tgt, op3, op1

Copy link
Member

Choose a reason for hiding this comment

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

right, it was already resolved in #115775 (comment)

@kunalspathak kunalspathak added the needs-author-action An issue or pull request that requires more info or actions from the author. label May 20, 2025
@dotnet-policy-service dotnet-policy-service bot removed the needs-author-action An issue or pull request that requires more info or actions from the author. label May 21, 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.

LGTM

@snickolls-arm
Copy link
Contributor Author

For the merge conflicts from this one and #115774, I've just pushed the implementation of Xor/XorRotateRight (#115891) which are the last on the list. Hopefully this improves the chance of automatic merge in future as the changes aren't contending on the definition of LAST_NI_Sve2.

@kunalspathak
Copy link
Member

/ba-g failures unrelated

1 similar comment
@kunalspathak
Copy link
Member

/ba-g failures unrelated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Runtime.Intrinsics 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.

3 participants