Skip to content

Commit a7f0b3e

Browse files
Implement SVE2 ShiftArithmeticRounded, ShiftArithmeticRoundedSaturate, ShiftArithmeticSaturate (#115774)
* Implement SVE2 ShiftArithmeticRounded, ShiftArithmeticRoundedSaturate, ShiftArithmeticSaturate * Improve formatting * Add correction for range of predicate registers
1 parent d47f2b9 commit a7f0b3e

6 files changed

Lines changed: 257 additions & 12 deletions

File tree

src/coreclr/jit/hwintrinsiclistarm64sve.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,9 @@ HARDWARE_INTRINSIC(Sve2, BitwiseClearXor,
316316
HARDWARE_INTRINSIC(Sve2, BitwiseSelect, -1, 3, {INS_sve_bsl, INS_sve_bsl, INS_sve_bsl, INS_sve_bsl, INS_sve_bsl, INS_sve_bsl, INS_sve_bsl, INS_sve_bsl, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialCodeGen|HW_Flag_HasRMWSemantics)
317317
HARDWARE_INTRINSIC(Sve2, BitwiseSelectLeftInverted, -1, 3, {INS_sve_bsl1n, INS_sve_bsl1n, INS_sve_bsl1n, INS_sve_bsl1n, INS_sve_bsl1n, INS_sve_bsl1n, INS_sve_bsl1n, INS_sve_bsl1n, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialCodeGen|HW_Flag_HasRMWSemantics)
318318
HARDWARE_INTRINSIC(Sve2, BitwiseSelectRightInverted, -1, 3, {INS_sve_bsl2n, INS_sve_bsl2n, INS_sve_bsl2n, INS_sve_bsl2n, INS_sve_bsl2n, INS_sve_bsl2n, INS_sve_bsl2n, INS_sve_bsl2n, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialCodeGen|HW_Flag_HasRMWSemantics)
319+
HARDWARE_INTRINSIC(Sve2, ShiftArithmeticRounded, -1, -1, {INS_sve_srshl, INS_invalid, INS_sve_srshl, INS_invalid, INS_sve_srshl, INS_invalid, INS_sve_srshl, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_EmbeddedMaskedOperation|HW_Flag_HasRMWSemantics|HW_Flag_LowMaskedOperation)
320+
HARDWARE_INTRINSIC(Sve2, ShiftArithmeticRoundedSaturate, -1, -1, {INS_sve_sqrshl, INS_invalid, INS_sve_sqrshl, INS_invalid, INS_sve_sqrshl, INS_invalid, INS_sve_sqrshl, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_EmbeddedMaskedOperation|HW_Flag_HasRMWSemantics|HW_Flag_LowMaskedOperation)
321+
HARDWARE_INTRINSIC(Sve2, ShiftArithmeticSaturate, -1, -1, {INS_sve_sqshl, INS_invalid, INS_sve_sqshl, INS_invalid, INS_sve_sqshl, INS_invalid, INS_sve_sqshl, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_EmbeddedMaskedOperation|HW_Flag_HasRMWSemantics|HW_Flag_LowMaskedOperation)
319322
HARDWARE_INTRINSIC(Sve2, ShiftLeftAndInsert, -1, 3, {INS_sve_sli, INS_sve_sli, INS_sve_sli, INS_sve_sli, INS_sve_sli, INS_sve_sli, INS_sve_sli, INS_sve_sli, INS_invalid, INS_invalid}, HW_Category_ShiftLeftByImmediate, HW_Flag_Scalable|HW_Flag_HasImmediateOperand|HW_Flag_HasRMWSemantics)
320323
HARDWARE_INTRINSIC(Sve2, Xor, -1, 3, {INS_sve_eor3, INS_sve_eor3, INS_sve_eor3, INS_sve_eor3, INS_sve_eor3, INS_sve_eor3, INS_sve_eor3, INS_sve_eor3, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialCodeGen|HW_Flag_HasRMWSemantics)
321324
HARDWARE_INTRINSIC(Sve2, XorRotateRight, -1, 3, {INS_sve_xar, INS_sve_xar, INS_sve_xar, INS_sve_xar, INS_sve_xar, INS_sve_xar, INS_sve_xar, INS_sve_xar, INS_invalid, INS_invalid}, HW_Category_ShiftRightByImmediate, HW_Flag_Scalable|HW_Flag_HasRMWSemantics|HW_Flag_HasImmediateOperand)

src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.PlatformNotSupported.cs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,88 @@ internal Arm64() { }
357357
/// </summary>
358358
public static Vector<ulong> BitwiseSelectRightInverted(Vector<ulong> select, Vector<ulong> left, Vector<ulong> right) { throw new PlatformNotSupportedException(); }
359359

360+
361+
// Rounding shift left
362+
363+
/// <summary>
364+
/// svint16_t svrshl[_s16]_m(svbool_t pg, svint16_t op1, svint16_t op2)
365+
/// SRSHL Ztied1.H, Pg/M, Ztied1.H, Zop2.H
366+
/// </summary>
367+
public static unsafe Vector<short> ShiftArithmeticRounded(Vector<short> value, Vector<short> count) { throw new PlatformNotSupportedException(); }
368+
369+
/// <summary>
370+
/// svint32_t svrshl[_s32]_m(svbool_t pg, svint32_t op1, svint32_t op2)
371+
/// SRSHL Ztied1.S, Pg/M, Ztied1.S, Zop2.S
372+
/// </summary>
373+
public static unsafe Vector<int> ShiftArithmeticRounded(Vector<int> value, Vector<int> count) { throw new PlatformNotSupportedException(); }
374+
375+
/// <summary>
376+
/// svint64_t svrshl[_s64]_m(svbool_t pg, svint64_t op1, svint64_t op2)
377+
/// SRSHL Ztied1.D, Pg/M, Ztied1.D, Zop2.D
378+
/// </summary>
379+
public static unsafe Vector<long> ShiftArithmeticRounded(Vector<long> value, Vector<long> count) { throw new PlatformNotSupportedException(); }
380+
381+
/// <summary>
382+
/// svint8_t svrshl[_s8]_m(svbool_t pg, svint8_t op1, svint8_t op2)
383+
/// SRSHL Ztied1.B, Pg/M, Ztied1.B, Zop2.B
384+
/// </summary>
385+
public static unsafe Vector<sbyte> ShiftArithmeticRounded(Vector<sbyte> value, Vector<sbyte> count) { throw new PlatformNotSupportedException(); }
386+
387+
388+
// Saturating rounding shift left
389+
390+
/// <summary>
391+
/// svint16_t svqrshl[_s16]_m(svbool_t pg, svint16_t op1, svint16_t op2)
392+
/// SQRSHL Ztied1.H, Pg/M, Ztied1.H, Zop2.H
393+
/// </summary>
394+
public static unsafe Vector<short> ShiftArithmeticRoundedSaturate(Vector<short> value, Vector<short> count) { throw new PlatformNotSupportedException(); }
395+
396+
/// <summary>
397+
/// svint32_t svqrshl[_s32]_m(svbool_t pg, svint32_t op1, svint32_t op2)
398+
/// SQRSHL Ztied1.S, Pg/M, Ztied1.S, Zop2.S
399+
/// </summary>
400+
public static unsafe Vector<int> ShiftArithmeticRoundedSaturate(Vector<int> value, Vector<int> count) { throw new PlatformNotSupportedException(); }
401+
402+
/// <summary>
403+
/// svint64_t svqrshl[_s64]_m(svbool_t pg, svint64_t op1, svint64_t op2)
404+
/// SQRSHL Ztied1.D, Pg/M, Ztied1.D, Zop2.D
405+
/// </summary>
406+
public static unsafe Vector<long> ShiftArithmeticRoundedSaturate(Vector<long> value, Vector<long> count) { throw new PlatformNotSupportedException(); }
407+
408+
/// <summary>
409+
/// svint8_t svqrshl[_s8]_m(svbool_t pg, svint8_t op1, svint8_t op2)
410+
/// SQRSHL Ztied1.B, Pg/M, Ztied1.B, Zop2.B
411+
/// </summary>
412+
public static unsafe Vector<sbyte> ShiftArithmeticRoundedSaturate(Vector<sbyte> value, Vector<sbyte> count) { throw new PlatformNotSupportedException(); }
413+
414+
415+
// Saturating shift left
416+
417+
/// <summary>
418+
/// svint16_t svqshl[_s16]_m(svbool_t pg, svint16_t op1, svint16_t op2)
419+
/// SQSHL Ztied1.H, Pg/M, Ztied1.H, Zop2.H
420+
/// </summary>
421+
public static unsafe Vector<short> ShiftArithmeticSaturate(Vector<short> value, Vector<short> count) { throw new PlatformNotSupportedException(); }
422+
423+
/// <summary>
424+
/// svint32_t svqshl[_s32]_m(svbool_t pg, svint32_t op1, svint32_t op2)
425+
/// SQSHL Ztied1.S, Pg/M, Ztied1.S, Zop2.S
426+
/// </summary>
427+
public static unsafe Vector<int> ShiftArithmeticSaturate(Vector<int> value, Vector<int> count) { throw new PlatformNotSupportedException(); }
428+
429+
/// <summary>
430+
/// svint64_t svqshl[_s64]_m(svbool_t pg, svint64_t op1, svint64_t op2)
431+
/// SQSHL Ztied1.D, Pg/M, Ztied1.D, Zop2.D
432+
/// </summary>
433+
public static unsafe Vector<long> ShiftArithmeticSaturate(Vector<long> value, Vector<long> count) { throw new PlatformNotSupportedException(); }
434+
435+
/// <summary>
436+
/// svint8_t svqshl[_s8]_m(svbool_t pg, svint8_t op1, svint8_t op2)
437+
/// SQSHL Ztied1.B, Pg/M, Ztied1.B, Zop2.B
438+
/// </summary>
439+
public static unsafe Vector<sbyte> ShiftArithmeticSaturate(Vector<sbyte> value, Vector<sbyte> count) { throw new PlatformNotSupportedException(); }
440+
441+
360442
// Shift left and insert
361443

362444
/// <summary>

src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.cs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,88 @@ internal Arm64() { }
357357
/// </summary>
358358
public static unsafe Vector<ulong> BitwiseSelectRightInverted(Vector<ulong> select, Vector<ulong> left, Vector<ulong> right) => BitwiseSelectRightInverted(select, left, right);
359359

360+
361+
// Rounding shift left
362+
363+
/// <summary>
364+
/// svint16_t svrshl[_s16]_m(svbool_t pg, svint16_t op1, svint16_t op2)
365+
/// SRSHL Ztied1.H, Pg/M, Ztied1.H, Zop2.H
366+
/// </summary>
367+
public static unsafe Vector<short> ShiftArithmeticRounded(Vector<short> value, Vector<short> count) => ShiftArithmeticRounded(value, count);
368+
369+
/// <summary>
370+
/// svint32_t svrshl[_s32]_m(svbool_t pg, svint32_t op1, svint32_t op2)
371+
/// SRSHL Ztied1.S, Pg/M, Ztied1.S, Zop2.S
372+
/// </summary>
373+
public static unsafe Vector<int> ShiftArithmeticRounded(Vector<int> value, Vector<int> count) => ShiftArithmeticRounded(value, count);
374+
375+
/// <summary>
376+
/// svint64_t svrshl[_s64]_m(svbool_t pg, svint64_t op1, svint64_t op2)
377+
/// SRSHL Ztied1.D, Pg/M, Ztied1.D, Zop2.D
378+
/// </summary>
379+
public static unsafe Vector<long> ShiftArithmeticRounded(Vector<long> value, Vector<long> count) => ShiftArithmeticRounded(value, count);
380+
381+
/// <summary>
382+
/// svint8_t svrshl[_s8]_m(svbool_t pg, svint8_t op1, svint8_t op2)
383+
/// SRSHL Ztied1.B, Pg/M, Ztied1.B, Zop2.B
384+
/// </summary>
385+
public static unsafe Vector<sbyte> ShiftArithmeticRounded(Vector<sbyte> value, Vector<sbyte> count) => ShiftArithmeticRounded(value, count);
386+
387+
388+
// Saturating rounding shift left
389+
390+
/// <summary>
391+
/// svint16_t svqrshl[_s16]_m(svbool_t pg, svint16_t op1, svint16_t op2)
392+
/// SQRSHL Ztied1.H, Pg/M, Ztied1.H, Zop2.H
393+
/// </summary>
394+
public static unsafe Vector<short> ShiftArithmeticRoundedSaturate(Vector<short> value, Vector<short> count) => ShiftArithmeticRoundedSaturate(value, count);
395+
396+
/// <summary>
397+
/// svint32_t svqrshl[_s32]_m(svbool_t pg, svint32_t op1, svint32_t op2)
398+
/// SQRSHL Ztied1.S, Pg/M, Ztied1.S, Zop2.S
399+
/// </summary>
400+
public static unsafe Vector<int> ShiftArithmeticRoundedSaturate(Vector<int> value, Vector<int> count) => ShiftArithmeticRoundedSaturate(value, count);
401+
402+
/// <summary>
403+
/// svint64_t svqrshl[_s64]_m(svbool_t pg, svint64_t op1, svint64_t op2)
404+
/// SQRSHL Ztied1.D, Pg/M, Ztied1.D, Zop2.D
405+
/// </summary>
406+
public static unsafe Vector<long> ShiftArithmeticRoundedSaturate(Vector<long> value, Vector<long> count) => ShiftArithmeticRoundedSaturate(value, count);
407+
408+
/// <summary>
409+
/// svint8_t svqrshl[_s8]_m(svbool_t pg, svint8_t op1, svint8_t op2)
410+
/// SQRSHL Ztied1.B, Pg/M, Ztied1.B, Zop2.B
411+
/// </summary>
412+
public static unsafe Vector<sbyte> ShiftArithmeticRoundedSaturate(Vector<sbyte> value, Vector<sbyte> count) => ShiftArithmeticRoundedSaturate(value, count);
413+
414+
415+
// Saturating shift left
416+
417+
/// <summary>
418+
/// svint16_t svqshl[_s16]_m(svbool_t pg, svint16_t op1, svint16_t op2)
419+
/// SQSHL Ztied1.H, Pg/M, Ztied1.H, Zop2.H
420+
/// </summary>
421+
public static unsafe Vector<short> ShiftArithmeticSaturate(Vector<short> value, Vector<short> count) => ShiftArithmeticSaturate(value, count);
422+
423+
/// <summary>
424+
/// svint32_t svqshl[_s32]_m(svbool_t pg, svint32_t op1, svint32_t op2)
425+
/// SQSHL Ztied1.S, Pg/M, Ztied1.S, Zop2.S
426+
/// </summary>
427+
public static unsafe Vector<int> ShiftArithmeticSaturate(Vector<int> value, Vector<int> count) => ShiftArithmeticSaturate(value, count);
428+
429+
/// <summary>
430+
/// svint64_t svqshl[_s64]_m(svbool_t pg, svint64_t op1, svint64_t op2)
431+
/// SQSHL Ztied1.D, Pg/M, Ztied1.D, Zop2.D
432+
/// </summary>
433+
public static unsafe Vector<long> ShiftArithmeticSaturate(Vector<long> value, Vector<long> count) => ShiftArithmeticSaturate(value, count);
434+
435+
/// <summary>
436+
/// svint8_t svqshl[_s8]_m(svbool_t pg, svint8_t op1, svint8_t op2)
437+
/// SQSHL Ztied1.B, Pg/M, Ztied1.B, Zop2.B
438+
/// </summary>
439+
public static unsafe Vector<sbyte> ShiftArithmeticSaturate(Vector<sbyte> value, Vector<sbyte> count) => ShiftArithmeticSaturate(value, count);
440+
441+
360442
// Shift left and insert
361443

362444
/// <summary>

src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6094,6 +6094,18 @@ internal Arm64() { }
60946094
public static System.Numerics.Vector<ushort> BitwiseSelectRightInverted(System.Numerics.Vector<ushort> select, System.Numerics.Vector<ushort> left, System.Numerics.Vector<ushort> right) { throw null; }
60956095
public static System.Numerics.Vector<uint> BitwiseSelectRightInverted(System.Numerics.Vector<uint> select, System.Numerics.Vector<uint> left, System.Numerics.Vector<uint> right) { throw null; }
60966096
public static System.Numerics.Vector<ulong> BitwiseSelectRightInverted(System.Numerics.Vector<ulong> select, System.Numerics.Vector<ulong> left, System.Numerics.Vector<ulong> right) { throw null; }
6097+
public static System.Numerics.Vector<short> ShiftArithmeticRounded(System.Numerics.Vector<short> value, System.Numerics.Vector<short> count) { throw null; }
6098+
public static System.Numerics.Vector<int> ShiftArithmeticRounded(System.Numerics.Vector<int> value, System.Numerics.Vector<int> count) { throw null; }
6099+
public static System.Numerics.Vector<long> ShiftArithmeticRounded(System.Numerics.Vector<long> value, System.Numerics.Vector<long> count) { throw null; }
6100+
public static System.Numerics.Vector<sbyte> ShiftArithmeticRounded(System.Numerics.Vector<sbyte> value, System.Numerics.Vector<sbyte> count) { throw null; }
6101+
public static System.Numerics.Vector<short> ShiftArithmeticRoundedSaturate(System.Numerics.Vector<short> value, System.Numerics.Vector<short> count) { throw null; }
6102+
public static System.Numerics.Vector<int> ShiftArithmeticRoundedSaturate(System.Numerics.Vector<int> value, System.Numerics.Vector<int> count) { throw null; }
6103+
public static System.Numerics.Vector<long> ShiftArithmeticRoundedSaturate(System.Numerics.Vector<long> value, System.Numerics.Vector<long> count) { throw null; }
6104+
public static System.Numerics.Vector<sbyte> ShiftArithmeticRoundedSaturate(System.Numerics.Vector<sbyte> value, System.Numerics.Vector<sbyte> count) { throw null; }
6105+
public static System.Numerics.Vector<short> ShiftArithmeticSaturate(System.Numerics.Vector<short> value, System.Numerics.Vector<short> count) { throw null; }
6106+
public static System.Numerics.Vector<int> ShiftArithmeticSaturate(System.Numerics.Vector<int> value, System.Numerics.Vector<int> count) { throw null; }
6107+
public static System.Numerics.Vector<long> ShiftArithmeticSaturate(System.Numerics.Vector<long> value, System.Numerics.Vector<long> count) { throw null; }
6108+
public static System.Numerics.Vector<sbyte> ShiftArithmeticSaturate(System.Numerics.Vector<sbyte> value, System.Numerics.Vector<sbyte> count) { throw null; }
60976109
public static System.Numerics.Vector<byte> ShiftLeftAndInsert(System.Numerics.Vector<byte> left, System.Numerics.Vector<byte> right, [ConstantExpected] byte shift) { throw null; }
60986110
public static System.Numerics.Vector<short> ShiftLeftAndInsert(System.Numerics.Vector<short> left, System.Numerics.Vector<short> right, [ConstantExpected] byte shift) { throw null; }
60996111
public static System.Numerics.Vector<int> ShiftLeftAndInsert(System.Numerics.Vector<int> left, System.Numerics.Vector<int> right, [ConstantExpected] byte shift) { throw null; }

0 commit comments

Comments
 (0)