-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Implement various SVE2 Right Shift intrinsics #116914
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
Conversation
Includes: * ShiftRightAndInsert * ShiftRightArithmeticAdd * ShiftRightArithmeticNarrowingSaturateEven * ShiftRightArithmeticNarrowingSaturateOdd * ShiftRightArithmeticNarrowingSaturateUnsignedEven * ShiftRightArithmeticNarrowingSaturateUnsignedOdd * ShiftRightArithmeticRounded * ShiftRightArithmeticRoundedAdd * ShiftRightArithmeticRoundedNarrowingSaturateEven * ShiftRightArithmeticRoundedNarrowingSaturateOdd * ShiftRightArithmeticRoundedNarrowingSaturateUnsignedEven * ShiftRightArithmeticRoundedNarrowingSaturateUnsignedOdd * ShiftRightLogicalAdd * ShiftRightLogicalNarrowingEven * ShiftRightLogicalNarrowingOdd * ShiftRightLogicalRounded * ShiftRightLogicalRoundedAdd * ShiftRightLogicalRoundedNarrowingEven * ShiftRightLogicalRoundedNarrowingOdd * ShiftRightLogicalRoundedNarrowingSaturateOdd * ShiftRightLogicalRoundedNarrowingSaturateEven
|
Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics |
|
|
||
| /// <summary> | ||
| /// svint16_t svqrshrnt[_n_s32](svint16_t even, svint32_t op1, uint64_t imm2) | ||
| /// SQRSHRNT Ztied.H, Zop1.S, #imm2 |
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.
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 destination register is used as a source here because this instruction only writes the odd numbered elements and leaves the even elements unchanged. The ACLE intrinsic has the even parameter which is the initial state of the destination register.
| public static Vector<byte> ShiftRightAndInsert(Vector<byte> left, Vector<byte> right, [ConstantExpected] byte shift) => ShiftRightAndInsert(left, right, shift); | ||
|
|
||
| /// <summary> | ||
| /// svint16_t svsri[_n_s16](svint16_t op1, svint16_t op2, uint64_t imm3) |
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.
| HARDWARE_INTRINSIC(Sve2, ShiftRightArithmeticRoundedNarrowingSaturateUnsignedEven, -1, 2, {INS_invalid, INS_sve_sqrshrunb, INS_invalid, INS_sve_sqrshrunb, INS_invalid, INS_sve_sqrshrunb, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_ShiftRightByImmediate, HW_Flag_Scalable|HW_Flag_HasImmediateOperand) | ||
| HARDWARE_INTRINSIC(Sve2, ShiftRightArithmeticRoundedNarrowingSaturateUnsignedOdd, -1, 3, {INS_invalid, INS_sve_sqrshrunt, INS_invalid, INS_sve_sqrshrunt, INS_invalid, INS_sve_sqrshrunt, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_ShiftRightByImmediate, HW_Flag_Scalable|HW_Flag_HasImmediateOperand|HW_Flag_HasRMWSemantics) | ||
| HARDWARE_INTRINSIC(Sve2, ShiftRightLogicalAdd, -1, 3, {INS_invalid, INS_sve_usra, INS_invalid, INS_sve_usra, INS_invalid, INS_sve_usra, INS_invalid, INS_sve_usra, INS_invalid, INS_invalid}, HW_Category_ShiftRightByImmediate, HW_Flag_Scalable|HW_Flag_HasImmediateOperand|HW_Flag_HasRMWSemantics) | ||
| HARDWARE_INTRINSIC(Sve2, ShiftRightLogicalNarrowingEven, -1, 2, {INS_sve_shrnb, INS_sve_shrnb, INS_sve_shrnb, INS_sve_shrnb, INS_sve_shrnb, INS_sve_shrnb, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_ShiftRightByImmediate, HW_Flag_Scalable|HW_Flag_HasImmediateOperand) |
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.
shrnb just operates on unsigned integer value. @a74nh - do you know why we are exposing ShiftRightLogicalNarrowingEven for signed and unsigned? Similar argument goes for other APIs.
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.
Signed and unsigned versions exist in the ACLE: https://developer.arm.com/architectures/instruction-sets/intrinsics/#f:@navigationhierarchiessimdisa=[sve2]&q=svshrnb
I don't think the signedness of the input really matters, just that everything gets shifted right and narrowed.
If we just had one version, I can imagine it creating lots of casting when used with the wrong type. Similar to how were looking at adding additional type for SVE APIs we did last year.
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.
added some questions about signed/unsigned values of APIs
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.
LGTM. @a74nh just confirm about #116914 (comment)
|
/ba-g failures unrelated |
Includes:
Contributing towards #115479
@a74nh @kunalspathak