diff --git a/src/coreclr/jit/hwintrinsiclistarm64sve.h b/src/coreclr/jit/hwintrinsiclistarm64sve.h index 96e5fce158a93a..d85703ca955707 100644 --- a/src/coreclr/jit/hwintrinsiclistarm64sve.h +++ b/src/coreclr/jit/hwintrinsiclistarm64sve.h @@ -313,6 +313,9 @@ HARDWARE_INTRINSIC(Sve2, BitwiseClearXor, 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) 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) 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) +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) +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) +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) 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) 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) 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) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.PlatformNotSupported.cs index 4d246a4758191c..34226550337778 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.PlatformNotSupported.cs @@ -231,6 +231,88 @@ internal Arm64() { } /// public static Vector BitwiseSelectRightInverted(Vector select, Vector left, Vector right) { throw new PlatformNotSupportedException(); } + + // Rounding shift left + + /// + /// svint16_t svrshl[_s16]_m(svbool_t pg, svint16_t op1, svint16_t op2) + /// SRSHL Ztied1.H, Pg/M, Ztied1.H, Zop2.H + /// + public static unsafe Vector ShiftArithmeticRounded(Vector value, Vector count) { throw new PlatformNotSupportedException(); } + + /// + /// svint32_t svrshl[_s32]_m(svbool_t pg, svint32_t op1, svint32_t op2) + /// SRSHL Ztied1.S, Pg/M, Ztied1.S, Zop2.S + /// + public static unsafe Vector ShiftArithmeticRounded(Vector value, Vector count) { throw new PlatformNotSupportedException(); } + + /// + /// svint64_t svrshl[_s64]_m(svbool_t pg, svint64_t op1, svint64_t op2) + /// SRSHL Ztied1.D, Pg/M, Ztied1.D, Zop2.D + /// + public static unsafe Vector ShiftArithmeticRounded(Vector value, Vector count) { throw new PlatformNotSupportedException(); } + + /// + /// svint8_t svrshl[_s8]_m(svbool_t pg, svint8_t op1, svint8_t op2) + /// SRSHL Ztied1.B, Pg/M, Ztied1.B, Zop2.B + /// + public static unsafe Vector ShiftArithmeticRounded(Vector value, Vector count) { throw new PlatformNotSupportedException(); } + + + // Saturating rounding shift left + + /// + /// svint16_t svqrshl[_s16]_m(svbool_t pg, svint16_t op1, svint16_t op2) + /// SQRSHL Ztied1.H, Pg/M, Ztied1.H, Zop2.H + /// + public static unsafe Vector ShiftArithmeticRoundedSaturate(Vector value, Vector count) { throw new PlatformNotSupportedException(); } + + /// + /// svint32_t svqrshl[_s32]_m(svbool_t pg, svint32_t op1, svint32_t op2) + /// SQRSHL Ztied1.S, Pg/M, Ztied1.S, Zop2.S + /// + public static unsafe Vector ShiftArithmeticRoundedSaturate(Vector value, Vector count) { throw new PlatformNotSupportedException(); } + + /// + /// svint64_t svqrshl[_s64]_m(svbool_t pg, svint64_t op1, svint64_t op2) + /// SQRSHL Ztied1.D, Pg/M, Ztied1.D, Zop2.D + /// + public static unsafe Vector ShiftArithmeticRoundedSaturate(Vector value, Vector count) { throw new PlatformNotSupportedException(); } + + /// + /// svint8_t svqrshl[_s8]_m(svbool_t pg, svint8_t op1, svint8_t op2) + /// SQRSHL Ztied1.B, Pg/M, Ztied1.B, Zop2.B + /// + public static unsafe Vector ShiftArithmeticRoundedSaturate(Vector value, Vector count) { throw new PlatformNotSupportedException(); } + + + // Saturating shift left + + /// + /// svint16_t svqshl[_s16]_m(svbool_t pg, svint16_t op1, svint16_t op2) + /// SQSHL Ztied1.H, Pg/M, Ztied1.H, Zop2.H + /// + public static unsafe Vector ShiftArithmeticSaturate(Vector value, Vector count) { throw new PlatformNotSupportedException(); } + + /// + /// svint32_t svqshl[_s32]_m(svbool_t pg, svint32_t op1, svint32_t op2) + /// SQSHL Ztied1.S, Pg/M, Ztied1.S, Zop2.S + /// + public static unsafe Vector ShiftArithmeticSaturate(Vector value, Vector count) { throw new PlatformNotSupportedException(); } + + /// + /// svint64_t svqshl[_s64]_m(svbool_t pg, svint64_t op1, svint64_t op2) + /// SQSHL Ztied1.D, Pg/M, Ztied1.D, Zop2.D + /// + public static unsafe Vector ShiftArithmeticSaturate(Vector value, Vector count) { throw new PlatformNotSupportedException(); } + + /// + /// svint8_t svqshl[_s8]_m(svbool_t pg, svint8_t op1, svint8_t op2) + /// SQSHL Ztied1.B, Pg/M, Ztied1.B, Zop2.B + /// + public static unsafe Vector ShiftArithmeticSaturate(Vector value, Vector count) { throw new PlatformNotSupportedException(); } + + // Shift left and insert /// diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.cs index f1cf44fdf9e0bb..cbfa21c1c91b36 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.cs @@ -231,6 +231,88 @@ internal Arm64() { } /// public static unsafe Vector BitwiseSelectRightInverted(Vector select, Vector left, Vector right) => BitwiseSelectRightInverted(select, left, right); + + // Rounding shift left + + /// + /// svint16_t svrshl[_s16]_m(svbool_t pg, svint16_t op1, svint16_t op2) + /// SRSHL Ztied1.H, Pg/M, Ztied1.H, Zop2.H + /// + public static unsafe Vector ShiftArithmeticRounded(Vector value, Vector count) => ShiftArithmeticRounded(value, count); + + /// + /// svint32_t svrshl[_s32]_m(svbool_t pg, svint32_t op1, svint32_t op2) + /// SRSHL Ztied1.S, Pg/M, Ztied1.S, Zop2.S + /// + public static unsafe Vector ShiftArithmeticRounded(Vector value, Vector count) => ShiftArithmeticRounded(value, count); + + /// + /// svint64_t svrshl[_s64]_m(svbool_t pg, svint64_t op1, svint64_t op2) + /// SRSHL Ztied1.D, Pg/M, Ztied1.D, Zop2.D + /// + public static unsafe Vector ShiftArithmeticRounded(Vector value, Vector count) => ShiftArithmeticRounded(value, count); + + /// + /// svint8_t svrshl[_s8]_m(svbool_t pg, svint8_t op1, svint8_t op2) + /// SRSHL Ztied1.B, Pg/M, Ztied1.B, Zop2.B + /// + public static unsafe Vector ShiftArithmeticRounded(Vector value, Vector count) => ShiftArithmeticRounded(value, count); + + + // Saturating rounding shift left + + /// + /// svint16_t svqrshl[_s16]_m(svbool_t pg, svint16_t op1, svint16_t op2) + /// SQRSHL Ztied1.H, Pg/M, Ztied1.H, Zop2.H + /// + public static unsafe Vector ShiftArithmeticRoundedSaturate(Vector value, Vector count) => ShiftArithmeticRoundedSaturate(value, count); + + /// + /// svint32_t svqrshl[_s32]_m(svbool_t pg, svint32_t op1, svint32_t op2) + /// SQRSHL Ztied1.S, Pg/M, Ztied1.S, Zop2.S + /// + public static unsafe Vector ShiftArithmeticRoundedSaturate(Vector value, Vector count) => ShiftArithmeticRoundedSaturate(value, count); + + /// + /// svint64_t svqrshl[_s64]_m(svbool_t pg, svint64_t op1, svint64_t op2) + /// SQRSHL Ztied1.D, Pg/M, Ztied1.D, Zop2.D + /// + public static unsafe Vector ShiftArithmeticRoundedSaturate(Vector value, Vector count) => ShiftArithmeticRoundedSaturate(value, count); + + /// + /// svint8_t svqrshl[_s8]_m(svbool_t pg, svint8_t op1, svint8_t op2) + /// SQRSHL Ztied1.B, Pg/M, Ztied1.B, Zop2.B + /// + public static unsafe Vector ShiftArithmeticRoundedSaturate(Vector value, Vector count) => ShiftArithmeticRoundedSaturate(value, count); + + + // Saturating shift left + + /// + /// svint16_t svqshl[_s16]_m(svbool_t pg, svint16_t op1, svint16_t op2) + /// SQSHL Ztied1.H, Pg/M, Ztied1.H, Zop2.H + /// + public static unsafe Vector ShiftArithmeticSaturate(Vector value, Vector count) => ShiftArithmeticSaturate(value, count); + + /// + /// svint32_t svqshl[_s32]_m(svbool_t pg, svint32_t op1, svint32_t op2) + /// SQSHL Ztied1.S, Pg/M, Ztied1.S, Zop2.S + /// + public static unsafe Vector ShiftArithmeticSaturate(Vector value, Vector count) => ShiftArithmeticSaturate(value, count); + + /// + /// svint64_t svqshl[_s64]_m(svbool_t pg, svint64_t op1, svint64_t op2) + /// SQSHL Ztied1.D, Pg/M, Ztied1.D, Zop2.D + /// + public static unsafe Vector ShiftArithmeticSaturate(Vector value, Vector count) => ShiftArithmeticSaturate(value, count); + + /// + /// svint8_t svqshl[_s8]_m(svbool_t pg, svint8_t op1, svint8_t op2) + /// SQSHL Ztied1.B, Pg/M, Ztied1.B, Zop2.B + /// + public static unsafe Vector ShiftArithmeticSaturate(Vector value, Vector count) => ShiftArithmeticSaturate(value, count); + + // Shift left and insert /// diff --git a/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs b/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs index 8913388d3b2cea..d8e81f7525f8a3 100644 --- a/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs +++ b/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs @@ -6071,6 +6071,18 @@ internal Arm64() { } public static System.Numerics.Vector BitwiseSelectRightInverted(System.Numerics.Vector select, System.Numerics.Vector left, System.Numerics.Vector right) { throw null; } public static System.Numerics.Vector BitwiseSelectRightInverted(System.Numerics.Vector select, System.Numerics.Vector left, System.Numerics.Vector right) { throw null; } public static System.Numerics.Vector BitwiseSelectRightInverted(System.Numerics.Vector select, System.Numerics.Vector left, System.Numerics.Vector right) { throw null; } + public static System.Numerics.Vector ShiftArithmeticRounded(System.Numerics.Vector value, System.Numerics.Vector count) { throw null; } + public static System.Numerics.Vector ShiftArithmeticRounded(System.Numerics.Vector value, System.Numerics.Vector count) { throw null; } + public static System.Numerics.Vector ShiftArithmeticRounded(System.Numerics.Vector value, System.Numerics.Vector count) { throw null; } + public static System.Numerics.Vector ShiftArithmeticRounded(System.Numerics.Vector value, System.Numerics.Vector count) { throw null; } + public static System.Numerics.Vector ShiftArithmeticRoundedSaturate(System.Numerics.Vector value, System.Numerics.Vector count) { throw null; } + public static System.Numerics.Vector ShiftArithmeticRoundedSaturate(System.Numerics.Vector value, System.Numerics.Vector count) { throw null; } + public static System.Numerics.Vector ShiftArithmeticRoundedSaturate(System.Numerics.Vector value, System.Numerics.Vector count) { throw null; } + public static System.Numerics.Vector ShiftArithmeticRoundedSaturate(System.Numerics.Vector value, System.Numerics.Vector count) { throw null; } + public static System.Numerics.Vector ShiftArithmeticSaturate(System.Numerics.Vector value, System.Numerics.Vector count) { throw null; } + public static System.Numerics.Vector ShiftArithmeticSaturate(System.Numerics.Vector value, System.Numerics.Vector count) { throw null; } + public static System.Numerics.Vector ShiftArithmeticSaturate(System.Numerics.Vector value, System.Numerics.Vector count) { throw null; } + public static System.Numerics.Vector ShiftArithmeticSaturate(System.Numerics.Vector value, System.Numerics.Vector count) { throw null; } public static System.Numerics.Vector ShiftLeftAndInsert(System.Numerics.Vector left, System.Numerics.Vector right, [ConstantExpected] byte shift) { throw null; } public static System.Numerics.Vector ShiftLeftAndInsert(System.Numerics.Vector left, System.Numerics.Vector right, [ConstantExpected] byte shift) { throw null; } public static System.Numerics.Vector ShiftLeftAndInsert(System.Numerics.Vector left, System.Numerics.Vector right, [ConstantExpected] byte shift) { throw null; } diff --git a/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs b/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs index 227d44b5d49ea3..8032cd0e780672 100644 --- a/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs +++ b/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs @@ -4772,6 +4772,19 @@ ("SveVecTernOpTest.template", new Dictionary { ["TestName"] = "Sve2_BitwiseSelectRightInverted_uint", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "BitwiseSelectRightInverted", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "UInt32", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "UInt32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt32()", ["NextValueOp3"] = "TestLibrary.Generator.GetUInt32()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != Helpers.BitwiseSelectRightInverted(firstOp[i], secondOp[i], thirdOp[i])", ["GetIterResult"] = "Helpers.BitwiseSelectRightInverted(firstOp[i], secondOp[i], thirdOp[i])"}), ("SveVecTernOpTest.template", new Dictionary { ["TestName"] = "Sve2_BitwiseSelectRightInverted_ulong", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "BitwiseSelectRightInverted", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "UInt64", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "UInt64", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt64()", ["NextValueOp3"] = "TestLibrary.Generator.GetUInt64()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != Helpers.BitwiseSelectRightInverted(firstOp[i], secondOp[i], thirdOp[i])", ["GetIterResult"] = "Helpers.BitwiseSelectRightInverted(firstOp[i], secondOp[i], thirdOp[i])"}), + ("SveVecBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftArithmeticRounded_sbyte", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftArithmeticRounded", ["RetVectorType"] = "Vector", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSByte()", ["NextValueOp2"] = "TestLibrary.Generator.GetSByte()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != (sbyte)Helpers.SveShiftArithmeticRounded(left[i], right[i])", ["GetIterResult"] = "(sbyte)Helpers.SveShiftArithmeticRounded(leftOp[i], rightOp[i])"}), + ("SveVecBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftArithmeticRounded_short", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftArithmeticRounded", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt16()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt16()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != (short)Helpers.SveShiftArithmeticRounded(left[i], right[i])", ["GetIterResult"] = "(short)Helpers.SveShiftArithmeticRounded(leftOp[i], rightOp[i])"}), + ("SveVecBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftArithmeticRounded_int", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftArithmeticRounded", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt32()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != (int) Helpers.SveShiftArithmeticRounded(left[i], right[i])", ["GetIterResult"] = "(int) Helpers.SveShiftArithmeticRounded(leftOp[i], rightOp[i])"}), + ("SveVecBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftArithmeticRounded_long", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftArithmeticRounded", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt64()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != (long) Helpers.SveShiftArithmeticRounded(left[i], right[i])", ["GetIterResult"] = "(long) Helpers.SveShiftArithmeticRounded(leftOp[i], rightOp[i])"}), + ("SveVecBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftArithmeticRoundedSaturate_sbyte", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftArithmeticRoundedSaturate", ["RetVectorType"] = "Vector", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSByte()", ["NextValueOp2"] = "TestLibrary.Generator.GetSByte()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != (sbyte)Helpers.SveShiftArithmeticRoundedSaturate(left[i], right[i])", ["GetIterResult"] = "(sbyte)Helpers.SveShiftArithmeticRoundedSaturate(leftOp[i], rightOp[i])"}), + ("SveVecBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftArithmeticRoundedSaturate_short", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftArithmeticRoundedSaturate", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt16()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt16()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != (short)Helpers.SveShiftArithmeticRoundedSaturate(left[i], right[i])", ["GetIterResult"] = "(short)Helpers.SveShiftArithmeticRoundedSaturate(leftOp[i], rightOp[i])"}), + ("SveVecBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftArithmeticRoundedSaturate_int", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftArithmeticRoundedSaturate", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt32()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != (int) Helpers.SveShiftArithmeticRoundedSaturate(left[i], right[i])", ["GetIterResult"] = "(int) Helpers.SveShiftArithmeticRoundedSaturate(leftOp[i], rightOp[i])"}), + ("SveVecBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftArithmeticRoundedSaturate_long", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftArithmeticRoundedSaturate", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt64()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != (long) Helpers.SveShiftArithmeticRoundedSaturate(left[i], right[i])", ["GetIterResult"] = "(long) Helpers.SveShiftArithmeticRoundedSaturate(leftOp[i], rightOp[i])"}), + ("SveVecBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftArithmeticSaturate_sbyte", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftArithmeticSaturate", ["RetVectorType"] = "Vector", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSByte()", ["NextValueOp2"] = "TestLibrary.Generator.GetSByte()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != (sbyte)Helpers.SveShiftArithmeticSaturate(left[i], right[i])", ["GetIterResult"] = "(sbyte)Helpers.SveShiftArithmeticSaturate(leftOp[i], rightOp[i])"}), + ("SveVecBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftArithmeticSaturate_short", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftArithmeticSaturate", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt16()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt16()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != (short)Helpers.SveShiftArithmeticSaturate(left[i], right[i])", ["GetIterResult"] = "(short)Helpers.SveShiftArithmeticSaturate(leftOp[i], rightOp[i])"}), + ("SveVecBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftArithmeticSaturate_int", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftArithmeticSaturate", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt32()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != (int) Helpers.SveShiftArithmeticSaturate(left[i], right[i])", ["GetIterResult"] = "(int) Helpers.SveShiftArithmeticSaturate(leftOp[i], rightOp[i])"}), + ("SveVecBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftArithmeticSaturate_long", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftArithmeticSaturate", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt64()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != (long) Helpers.SveShiftArithmeticSaturate(left[i], right[i])", ["GetIterResult"] = "(long) Helpers.SveShiftArithmeticSaturate(leftOp[i], rightOp[i])"}), + ("SveVecImmBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftLeftAndInsert_sbyte", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftLeftAndInsert", ["RetVectorType"] = "Vector", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "SByte", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSByte()", ["NextValueOp2"] = "TestLibrary.Generator.GetSByte()", ["NextValueMask"] = "Helpers.getMaskSByte()", ["Imm"] = "5", ["InvalidImm"] = "8", ["ValidateIterResult"] = "result[i] != Helpers.ShiftLeftAndInsert(firstOp[i], secondOp[i], Imm)", ["GetIterResult"] = "Helpers.ShiftLeftAndInsert(firstOp[i], secondOp[i], Imm)"}), ("SveVecImmBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftLeftAndInsert_short", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftLeftAndInsert", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int16", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt16()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt16()", ["NextValueMask"] = "Helpers.getMaskInt16()", ["Imm"] = "12", ["InvalidImm"] = "16", ["ValidateIterResult"] = "result[i] != Helpers.ShiftLeftAndInsert(firstOp[i], secondOp[i], Imm)", ["GetIterResult"] = "Helpers.ShiftLeftAndInsert(firstOp[i], secondOp[i], Imm)"}), ("SveVecImmBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftLeftAndInsert_int", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftLeftAndInsert", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int32", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt32()", ["NextValueMask"] = "Helpers.getMaskInt32()", ["Imm"] = "23", ["InvalidImm"] = "32", ["ValidateIterResult"] = "result[i] != Helpers.ShiftLeftAndInsert(firstOp[i], secondOp[i], Imm)", ["GetIterResult"] = "Helpers.ShiftLeftAndInsert(firstOp[i], secondOp[i], Imm)"}), diff --git a/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs b/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs index ff3c2608c17e30..97cbaba2e907bb 100644 --- a/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs +++ b/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs @@ -3862,6 +3862,35 @@ public static uint ShiftRightLogicalNarrowingSaturate(ulong op1, byte op2) return result; } + private static long GetShift(long shift, long size, bool shiftSat) + { + if (shiftSat) + { + // SVE shifts are saturated to element size + shift = (int)ShiftSat(shift, size); + } + else + { + // NEON shifts are truncated to bottom byte + shift = (sbyte)shift; + } + return shift; + } + + public static long ShiftSat(long shift, long size) + { + if (shift > size + 1) + { + return size + 1; + } + else if (shift < -(size + 1)) + { + return -(size + 1); + } + + return shift; + } + public static int ShiftRightLogicalNarrowingSaturateUpper(int[] op1, long[] op2, byte op3, int i) => i < op1.Length ? op1[i] : (int)ShiftRightLogicalNarrowingSaturate(op2[i - op1.Length], op3); public static uint ShiftRightLogicalNarrowingSaturateUpper(uint[] op1, ulong[] op2, byte op3, int i) => i < op1.Length ? op1[i] : (uint)ShiftRightLogicalNarrowingSaturate(op2[i - op1.Length], op3); @@ -3878,9 +3907,9 @@ public static uint ShiftRightLogicalNarrowingSaturate(ulong op1, byte op2) public static sbyte ShiftArithmeticRoundedSaturate(sbyte op1, sbyte op2) => SignedShift(op1, op2, rounding: true, saturating: true); - private static sbyte SignedShift(sbyte op1, sbyte op2, bool rounding = false, bool saturating = false) + private static sbyte SignedShift(sbyte op1, sbyte op2, bool rounding = false, bool saturating = false, bool shiftSat = false) { - int shift = (sbyte)(op2 & 0xFF); + int shift = (int)GetShift(op2, 8, shiftSat); sbyte rndCns = 0; @@ -3916,7 +3945,7 @@ private static sbyte SignedShift(sbyte op1, sbyte op2, bool rounding = false, bo { if (shiftOvf) { - result = sbyte.MaxValue; + result = op2 < 0 ? sbyte.MinValue : sbyte.MaxValue; } } } @@ -4192,9 +4221,9 @@ public static byte SubtractSaturate(byte op1, byte op2) public static short ShiftArithmeticRoundedSaturate(short op1, short op2) => SignedShift(op1, op2, rounding: true, saturating: true); - private static short SignedShift(short op1, short op2, bool rounding = false, bool saturating = false) + private static short SignedShift(short op1, short op2, bool rounding = false, bool saturating = false, bool shiftSat = false) { - int shift = (sbyte)(op2 & 0xFF); + int shift = (int)GetShift(op2, 16, shiftSat); short rndCns = 0; @@ -4230,7 +4259,7 @@ private static short SignedShift(short op1, short op2, bool rounding = false, bo { if (shiftOvf) { - result = short.MaxValue; + result = op1 < 0 ? short.MinValue : short.MaxValue; } } } @@ -4460,9 +4489,9 @@ public static ushort SubtractSaturate(ushort op1, ushort op2) public static int ShiftArithmeticRoundedSaturate(int op1, int op2) => SignedShift(op1, op2, rounding: true, saturating: true); - private static int SignedShift(int op1, int op2, bool rounding = false, bool saturating = false) + private static int SignedShift(int op1, int op2, bool rounding = false, bool saturating = false, bool shiftSat = false) { - int shift = (sbyte)(op2 & 0xFF); + int shift = (int)GetShift(op2, 32, shiftSat); int rndCns = 0; @@ -4498,7 +4527,7 @@ private static int SignedShift(int op1, int op2, bool rounding = false, bool sat { if (shiftOvf) { - result = int.MaxValue; + result = op1 < 0 ? int.MinValue : int.MaxValue; } } } @@ -4728,9 +4757,9 @@ public static uint SubtractSaturate(uint op1, uint op2) public static long ShiftArithmeticRoundedSaturate(long op1, long op2) => SignedShift(op1, op2, rounding: true, saturating: true); - private static long SignedShift(long op1, long op2, bool rounding = false, bool saturating = false) + private static long SignedShift(long op1, long op2, bool rounding = false, bool saturating = false, bool shiftSat = false) { - int shift = (sbyte)(op2 & 0xFF); + int shift = (int)GetShift(op2, 64, shiftSat); long rndCns = 0; @@ -4766,7 +4795,7 @@ private static long SignedShift(long op1, long op2, bool rounding = false, bool { if (shiftOvf) { - result = long.MaxValue; + result = op1 < 0 ? long.MinValue : long.MaxValue; } } } @@ -9887,5 +9916,29 @@ public static T XorRotateRight(T op1, T op2, int shift) where T : IBinaryInte { return T.RotateRight(Xor(op1, op2), shift); } + + public static sbyte SveShiftArithmeticRounded(sbyte op1, sbyte op2) => SignedShift(op1, op2, rounding: true, shiftSat: true); + + public static sbyte SveShiftArithmeticSaturate(sbyte op1, sbyte op2) => SignedShift(op1, op2, saturating: true, shiftSat: true); + + public static sbyte SveShiftArithmeticRoundedSaturate(sbyte op1, sbyte op2) => SignedShift(op1, op2, rounding: true, saturating: true, shiftSat: true); + + public static short SveShiftArithmeticRounded(short op1, short op2) => SignedShift(op1, op2, rounding: true, shiftSat: true); + + public static short SveShiftArithmeticSaturate(short op1, short op2) => SignedShift(op1, op2, saturating: true, shiftSat: true); + + public static short SveShiftArithmeticRoundedSaturate(short op1, short op2) => SignedShift(op1, op2, rounding: true, saturating: true, shiftSat: true); + + public static int SveShiftArithmeticRounded(int op1, int op2) => SignedShift(op1, op2, rounding: true, shiftSat: true); + + public static int SveShiftArithmeticSaturate(int op1, int op2) => SignedShift(op1, op2, saturating: true, shiftSat: true); + + public static int SveShiftArithmeticRoundedSaturate(int op1, int op2) => SignedShift(op1, op2, rounding: true, saturating: true, shiftSat: true); + + public static long SveShiftArithmeticRounded(long op1, long op2) => SignedShift(op1, op2, rounding: true, shiftSat: true); + + public static long SveShiftArithmeticSaturate(long op1, long op2) => SignedShift(op1, op2, saturating: true, shiftSat: true); + + public static long SveShiftArithmeticRoundedSaturate(long op1, long op2) => SignedShift(op1, op2, rounding: true, saturating: true, shiftSat: true); } }