diff --git a/src/coreclr/jit/hwintrinsiccodegenarm64.cpp b/src/coreclr/jit/hwintrinsiccodegenarm64.cpp index 1ce3b282f6673a..80adf05452c34c 100644 --- a/src/coreclr/jit/hwintrinsiccodegenarm64.cpp +++ b/src/coreclr/jit/hwintrinsiccodegenarm64.cpp @@ -2659,6 +2659,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) } case NI_Sve2_BitwiseClearXor: + case NI_Sve2_Xor: if (targetReg != op1Reg) { assert(targetReg != op2Reg && targetReg != op3Reg); diff --git a/src/coreclr/jit/hwintrinsiclistarm64sve.h b/src/coreclr/jit/hwintrinsiclistarm64sve.h index 639a9056a1b608..d381296ea268cf 100644 --- a/src/coreclr/jit/hwintrinsiclistarm64sve.h +++ b/src/coreclr/jit/hwintrinsiclistarm64sve.h @@ -314,7 +314,9 @@ HARDWARE_INTRINSIC(Sve2, BitwiseSelect, 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, 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) -#define LAST_NI_Sve2 NI_Sve2_ShiftLeftAndInsert +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) +#define LAST_NI_Sve2 NI_Sve2_XorRotateRight // *************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** // ISA Function name SIMD size NumArg Instructions Category Flags 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 9c6df34e53ea76..270022c9e91a54 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 @@ -280,5 +280,107 @@ internal Arm64() { } /// SLI Ztied1.D, Zop2.D, #imm3 /// public static Vector ShiftLeftAndInsert(Vector left, Vector right, [ConstantExpected] byte shift) { throw new PlatformNotSupportedException(); } + + + // Bitwise exclusive OR of three vectors + + /// + /// svuint8_t sveor3[_u8](svuint8_t op1, svuint8_t op2, svuint8_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) { throw new PlatformNotSupportedException(); } + + /// + /// svint16_t sveor3[_s16](svint16_t op1, svint16_t op2, svint16_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) { throw new PlatformNotSupportedException(); } + + /// + /// svint32_t sveor3[_s32](svint32_t op1, svint32_t op2, svint32_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) { throw new PlatformNotSupportedException(); } + + /// + /// svint64_t sveor3[_s64](svint64_t op1, svint64_t op2, svint64_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) { throw new PlatformNotSupportedException(); } + + /// + /// svint8_t sveor3[_s8](svint8_t op1, svint8_t op2, svint8_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) { throw new PlatformNotSupportedException(); } + + /// + /// svuint16_t sveor3[_u16](svuint16_t op1, svuint16_t op2, svuint16_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) { throw new PlatformNotSupportedException(); } + + /// + /// svuint32_t sveor3[_u32](svuint32_t op1, svuint32_t op2, svuint32_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) { throw new PlatformNotSupportedException(); } + + /// + /// svuint64_t sveor3[_u64](svuint64_t op1, svuint64_t op2, svuint64_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) { throw new PlatformNotSupportedException(); } + + + // Bitwise exclusive OR and rotate right + + /// + /// svuint8_t svxar[_n_u8](svuint8_t op1, svuint8_t op2, uint64_t imm3) + /// XAR Ztied1.B, Ztied1.B, Zop2.B, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) { throw new PlatformNotSupportedException(); } + + /// + /// svint16_t svxar[_n_s16](svint16_t op1, svint16_t op2, uint64_t imm3) + /// XAR Ztied1.H, Ztied1.H, Zop2.H, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) { throw new PlatformNotSupportedException(); } + + /// + /// svint32_t svxar[_n_s32](svint32_t op1, svint32_t op2, uint64_t imm3) + /// XAR Ztied1.S, Ztied1.S, Zop2.S, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) { throw new PlatformNotSupportedException(); } + + /// + /// svint64_t svxar[_n_s64](svint64_t op1, svint64_t op2, uint64_t imm3) + /// XAR Ztied1.D, Ztied1.D, Zop2.D, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) { throw new PlatformNotSupportedException(); } + + /// + /// svint8_t svxar[_n_s8](svint8_t op1, svint8_t op2, uint64_t imm3) + /// XAR Ztied1.B, Ztied1.B, Zop2.B, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) { throw new PlatformNotSupportedException(); } + + /// + /// svuint16_t svxar[_n_u16](svuint16_t op1, svuint16_t op2, uint64_t imm3) + /// XAR Ztied1.H, Ztied1.H, Zop2.H, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) { throw new PlatformNotSupportedException(); } + + /// + /// svuint32_t svxar[_n_u32](svuint32_t op1, svuint32_t op2, uint64_t imm3) + /// XAR Ztied1.S, Ztied1.S, Zop2.S, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) { throw new PlatformNotSupportedException(); } + + /// + /// svuint64_t svxar[_n_u64](svuint64_t op1, svuint64_t op2, uint64_t imm3) + /// XAR Ztied1.D, Ztied1.D, Zop2.D, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) { throw new PlatformNotSupportedException(); } } } 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 8d60560a197143..f1cf44fdf9e0bb 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 @@ -280,5 +280,107 @@ internal Arm64() { } /// SLI Ztied1.D, Zop2.D, #imm3 /// public static Vector ShiftLeftAndInsert(Vector left, Vector right, [ConstantExpected] byte shift) => ShiftLeftAndInsert(left, right, shift); + + + // Bitwise exclusive OR of three vectors + + /// + /// svuint8_t sveor3[_u8](svuint8_t op1, svuint8_t op2, svuint8_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) => Xor(value1, value2, value3); + + /// + /// svint16_t sveor3[_s16](svint16_t op1, svint16_t op2, svint16_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) => Xor(value1, value2, value3); + + /// + /// svint32_t sveor3[_s32](svint32_t op1, svint32_t op2, svint32_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) => Xor(value1, value2, value3); + + /// + /// svint64_t sveor3[_s64](svint64_t op1, svint64_t op2, svint64_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) => Xor(value1, value2, value3); + + /// + /// svint8_t sveor3[_s8](svint8_t op1, svint8_t op2, svint8_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) => Xor(value1, value2, value3); + + /// + /// svuint16_t sveor3[_u16](svuint16_t op1, svuint16_t op2, svuint16_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) => Xor(value1, value2, value3); + + /// + /// svuint32_t sveor3[_u32](svuint32_t op1, svuint32_t op2, svuint32_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) => Xor(value1, value2, value3); + + /// + /// svuint64_t sveor3[_u64](svuint64_t op1, svuint64_t op2, svuint64_t op3) + /// EOR3 Ztied1.D, Ztied1.D, Zop2.D, Zop3.D + /// + public static Vector Xor(Vector value1, Vector value2, Vector value3) => Xor(value1, value2, value3); + + + // Bitwise exclusive OR and rotate right + + /// + /// svuint8_t svxar[_n_u8](svuint8_t op1, svuint8_t op2, uint64_t imm3) + /// XAR Ztied1.B, Ztied1.B, Zop2.B, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) => XorRotateRight(left, right, count); + + /// + /// svint16_t svxar[_n_s16](svint16_t op1, svint16_t op2, uint64_t imm3) + /// XAR Ztied1.H, Ztied1.H, Zop2.H, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) => XorRotateRight(left, right, count); + + /// + /// svint32_t svxar[_n_s32](svint32_t op1, svint32_t op2, uint64_t imm3) + /// XAR Ztied1.S, Ztied1.S, Zop2.S, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) => XorRotateRight(left, right, count); + + /// + /// svint64_t svxar[_n_s64](svint64_t op1, svint64_t op2, uint64_t imm3) + /// XAR Ztied1.D, Ztied1.D, Zop2.D, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) => XorRotateRight(left, right, count); + + /// + /// svint8_t svxar[_n_s8](svint8_t op1, svint8_t op2, uint64_t imm3) + /// XAR Ztied1.B, Ztied1.B, Zop2.B, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) => XorRotateRight(left, right, count); + + /// + /// svuint16_t svxar[_n_u16](svuint16_t op1, svuint16_t op2, uint64_t imm3) + /// XAR Ztied1.H, Ztied1.H, Zop2.H, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) => XorRotateRight(left, right, count); + + /// + /// svuint32_t svxar[_n_u32](svuint32_t op1, svuint32_t op2, uint64_t imm3) + /// XAR Ztied1.S, Ztied1.S, Zop2.S, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) => XorRotateRight(left, right, count); + + /// + /// svuint64_t svxar[_n_u64](svuint64_t op1, svuint64_t op2, uint64_t imm3) + /// XAR Ztied1.D, Ztied1.D, Zop2.D, #imm3 + /// + public static Vector XorRotateRight(Vector left, Vector right, [ConstantExpected] byte count) => XorRotateRight(left, right, count); } } 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 b27ff60f800823..a872211f901ba8 100644 --- a/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs +++ b/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs @@ -6079,6 +6079,22 @@ internal Arm64() { } 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; } + public static System.Numerics.Vector Xor(System.Numerics.Vector value1, System.Numerics.Vector value2, System.Numerics.Vector value3) { throw null; } + public static System.Numerics.Vector Xor(System.Numerics.Vector value1, System.Numerics.Vector value2, System.Numerics.Vector value3) { throw null; } + public static System.Numerics.Vector Xor(System.Numerics.Vector value1, System.Numerics.Vector value2, System.Numerics.Vector value3) { throw null; } + public static System.Numerics.Vector Xor(System.Numerics.Vector value1, System.Numerics.Vector value2, System.Numerics.Vector value3) { throw null; } + public static System.Numerics.Vector Xor(System.Numerics.Vector value1, System.Numerics.Vector value2, System.Numerics.Vector value3) { throw null; } + public static System.Numerics.Vector Xor(System.Numerics.Vector value1, System.Numerics.Vector value2, System.Numerics.Vector value3) { throw null; } + public static System.Numerics.Vector Xor(System.Numerics.Vector value1, System.Numerics.Vector value2, System.Numerics.Vector value3) { throw null; } + public static System.Numerics.Vector Xor(System.Numerics.Vector value1, System.Numerics.Vector value2, System.Numerics.Vector value3) { throw null; } + public static System.Numerics.Vector XorRotateRight(System.Numerics.Vector left, System.Numerics.Vector right, [ConstantExpected] byte count) { throw null; } + public static System.Numerics.Vector XorRotateRight(System.Numerics.Vector left, System.Numerics.Vector right, [ConstantExpected] byte count) { throw null; } + public static System.Numerics.Vector XorRotateRight(System.Numerics.Vector left, System.Numerics.Vector right, [ConstantExpected] byte count) { throw null; } + public static System.Numerics.Vector XorRotateRight(System.Numerics.Vector left, System.Numerics.Vector right, [ConstantExpected] byte count) { throw null; } + public static System.Numerics.Vector XorRotateRight(System.Numerics.Vector left, System.Numerics.Vector right, [ConstantExpected] byte count) { throw null; } + public static System.Numerics.Vector XorRotateRight(System.Numerics.Vector left, System.Numerics.Vector right, [ConstantExpected] byte count) { throw null; } + public static System.Numerics.Vector XorRotateRight(System.Numerics.Vector left, System.Numerics.Vector right, [ConstantExpected] byte count) { throw null; } + public static System.Numerics.Vector XorRotateRight(System.Numerics.Vector left, System.Numerics.Vector right, [ConstantExpected] byte count) { throw null; } } public enum SveMaskPattern : byte diff --git a/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs b/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs index e7a5153a0c6da8..6608f6b850859b 100644 --- a/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs +++ b/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs @@ -4782,6 +4782,24 @@ ("SveVecImmBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_ShiftLeftAndInsert_ushort", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftLeftAndInsert", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "UInt16", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt16()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt16()", ["NextValueMask"] = "Helpers.getMaskUInt16()", ["Imm"] = "9", ["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_uint", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftLeftAndInsert", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "UInt32", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt32()", ["NextValueMask"] = "Helpers.getMaskUInt32()", ["Imm"] = "17", ["InvalidImm"] = "32", ["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_ulong", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "ShiftLeftAndInsert", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "UInt64", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt64()", ["NextValueMask"] = "Helpers.getMaskUInt64()", ["Imm"] = "45", ["InvalidImm"] = "64", ["ValidateIterResult"] = "result[i] != Helpers.ShiftLeftAndInsert(firstOp[i], secondOp[i], Imm)", ["GetIterResult"] = "Helpers.ShiftLeftAndInsert(firstOp[i], secondOp[i], Imm)"}), + + ("SveVecTernOpTest.template", new Dictionary { ["TestName"] = "Sve2_Xor_sbyte", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "Xor", ["RetVectorType"] = "Vector", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "SByte", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "SByte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSByte()", ["NextValueOp2"] = "TestLibrary.Generator.GetSByte()", ["NextValueOp3"] = "TestLibrary.Generator.GetSByte()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])", ["GetIterResult"] = "Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])",}), + ("SveVecTernOpTest.template", new Dictionary { ["TestName"] = "Sve2_Xor_short", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "Xor", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int16", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "Int16", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt16()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt16()", ["NextValueOp3"] = "TestLibrary.Generator.GetInt16()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])", ["GetIterResult"] = "Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])",}), + ("SveVecTernOpTest.template", new Dictionary { ["TestName"] = "Sve2_Xor_int", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "Xor", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int32", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "Int32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp3"] = "TestLibrary.Generator.GetInt32()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])", ["GetIterResult"] = "Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])",}), + ("SveVecTernOpTest.template", new Dictionary { ["TestName"] = "Sve2_Xor_long", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "Xor", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int64", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "Int64", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt64()", ["NextValueOp3"] = "TestLibrary.Generator.GetInt64()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])", ["GetIterResult"] = "Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])",}), + ("SveVecTernOpTest.template", new Dictionary { ["TestName"] = "Sve2_Xor_byte", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "Xor", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Byte", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["NextValueOp2"] = "TestLibrary.Generator.GetByte()", ["NextValueOp3"] = "TestLibrary.Generator.GetByte()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])", ["GetIterResult"] = "Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])",}), + ("SveVecTernOpTest.template", new Dictionary { ["TestName"] = "Sve2_Xor_ushort", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "Xor", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "UInt16", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "UInt16", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt16()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt16()", ["NextValueOp3"] = "TestLibrary.Generator.GetUInt16()", ["ConvertFunc"] = "", ["ValidateIterResult"] = "result[i] != Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])", ["GetIterResult"] = "Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])",}), + ("SveVecTernOpTest.template", new Dictionary { ["TestName"] = "Sve2_Xor_uint", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "Xor", ["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.Xor(firstOp[i], secondOp[i], thirdOp[i])", ["GetIterResult"] = "Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])",}), + ("SveVecTernOpTest.template", new Dictionary { ["TestName"] = "Sve2_Xor_ulong", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "Xor", ["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.Xor(firstOp[i], secondOp[i], thirdOp[i])", ["GetIterResult"] = "Helpers.Xor(firstOp[i], secondOp[i], thirdOp[i])",}), + + ("SveVecImmBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_XorRotateRight_sbyte", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "XorRotateRight", ["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"] = "8", ["InvalidImm"] = "9", ["ValidateIterResult"] = "result[i] != Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)", ["GetIterResult"] = "Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)",}), + ("SveVecImmBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_XorRotateRight_short", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "XorRotateRight", ["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"] = "17", ["ValidateIterResult"] = "result[i] != Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)", ["GetIterResult"] = "Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)",}), + ("SveVecImmBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_XorRotateRight_int", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "XorRotateRight", ["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"] = "26", ["InvalidImm"] = "33", ["ValidateIterResult"] = "result[i] != Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)", ["GetIterResult"] = "Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)",}), + ("SveVecImmBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_XorRotateRight_long", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "XorRotateRight", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Int64", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt64()", ["NextValueMask"] = "Helpers.getMaskInt64()", ["Imm"] = "55", ["InvalidImm"] = "65", ["ValidateIterResult"] = "result[i] != Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)", ["GetIterResult"] = "Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)",}), + ("SveVecImmBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_XorRotateRight_byte", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "XorRotateRight", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Byte", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["NextValueOp2"] = "TestLibrary.Generator.GetByte()", ["NextValueMask"] = "Helpers.getMaskByte()", ["Imm"] = "3" , ["InvalidImm"] = "9" , ["ValidateIterResult"] = "result[i] != Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)", ["GetIterResult"] = "Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)",}), + ("SveVecImmBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_XorRotateRight_ushort", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "XorRotateRight", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt16", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "UInt16", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt16()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt16()", ["NextValueMask"] = "Helpers.getMaskUInt16()", ["Imm"] = "11", ["InvalidImm"] = "17", ["ValidateIterResult"] = "result[i] != Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)", ["GetIterResult"] = "Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)",}), + ("SveVecImmBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_XorRotateRight_uint", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "XorRotateRight", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "UInt32", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt32()", ["NextValueMask"] = "Helpers.getMaskUInt32()", ["Imm"] = "22", ["InvalidImm"] = "33", ["ValidateIterResult"] = "result[i] != Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)", ["GetIterResult"] = "Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)",}), + ("SveVecImmBinOpTest.template", new Dictionary { ["TestName"] = "Sve2_XorRotateRight_ulong", ["Isa"] = "Sve2", ["LoadIsa"] = "Sve2", ["Method"] = "XorRotateRight", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "UInt64", ["Op3BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt64()", ["NextValueMask"] = "Helpers.getMaskUInt64()", ["Imm"] = "45", ["InvalidImm"] = "65", ["ValidateIterResult"] = "result[i] != Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)", ["GetIterResult"] = "Helpers.XorRotateRight(firstOp[i], secondOp[i], Imm)",}), }; string projectName = args[0]; diff --git a/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs b/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs index e60f73ed673550..ff3c2608c17e30 100644 --- a/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs +++ b/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs @@ -635,7 +635,7 @@ public static byte ReverseElementBits(byte op1) { if ((val & (cst_one << i)) != 0) { - result |= (byte)(cst_one << (bitsize - 1 - i)); + result |= (byte)(cst_one << (bitsize - 1 - i)); } } @@ -653,7 +653,7 @@ public static short ReverseElementBits(short op1) { if ((val & (cst_one << i)) != 0) { - result |= (short)(cst_one << (bitsize - 1 - i)); + result |= (short)(cst_one << (bitsize - 1 - i)); } } @@ -671,7 +671,7 @@ public static int ReverseElementBits(int op1) { if ((val & (cst_one << i)) != 0) { - result |= (uint)(cst_one << (bitsize - 1 - i)); + result |= (uint)(cst_one << (bitsize - 1 - i)); } } @@ -689,7 +689,7 @@ public static long ReverseElementBits(long op1) { if ((val & (cst_one << i)) != 0) { - result |= (ulong)(cst_one << (bitsize - 1 - i)); + result |= (ulong)(cst_one << (bitsize - 1 - i)); } } @@ -707,7 +707,7 @@ public static sbyte ReverseElementBits(sbyte op1) { if ((val & (cst_one << i)) != 0) { - result |= (byte)(cst_one << (bitsize - 1 - i)); + result |= (byte)(cst_one << (bitsize - 1 - i)); } } @@ -725,7 +725,7 @@ public static ushort ReverseElementBits(ushort op1) { if ((val & (cst_one << i)) != 0) { - result |= (ushort)(cst_one << (bitsize - 1 - i)); + result |= (ushort)(cst_one << (bitsize - 1 - i)); } } @@ -743,7 +743,7 @@ public static uint ReverseElementBits(uint op1) { if ((val & (cst_one << i)) != 0) { - result |= (uint)(cst_one << (bitsize - 1 - i)); + result |= (uint)(cst_one << (bitsize - 1 - i)); } } @@ -761,7 +761,7 @@ public static ulong ReverseElementBits(ulong op1) { if ((val & (cst_one << i)) != 0) { - result |= (ulong)(cst_one << (bitsize - 1 - i)); + result |= (ulong)(cst_one << (bitsize - 1 - i)); } } @@ -1881,7 +1881,7 @@ public static float SveAbsoluteCompareLessThanOrEqual(float left, float right) public static uint SveCompareNotEqual(uint left, uint right) => (uint)((left != right) ? 1 : 0); public static long SveCompareNotEqual(long left, long right) => (long)((left != right) ? 1 : 0); public static ulong SveCompareNotEqual(ulong left, ulong right) => (ulong)((left != right) ? 1 : 0); - + public static double SveCompareGreaterThan(double left, double right) => BitConverter.Int64BitsToDouble((left > right) ? 1 : 0); public static float SveCompareGreaterThan(float left, float right) => BitConverter.Int32BitsToSingle((left > right) ? 1 : 0); public static sbyte SveCompareGreaterThan(sbyte left, sbyte right) => (sbyte)((left > right) ? 1 : 0); @@ -1892,7 +1892,7 @@ public static float SveAbsoluteCompareLessThanOrEqual(float left, float right) public static uint SveCompareGreaterThan(uint left, uint right) => (uint)((left > right) ? 1 : 0); public static long SveCompareGreaterThan(long left, long right) => (long)((left > right) ? 1 : 0); public static ulong SveCompareGreaterThan(ulong left, ulong right) => (ulong)((left > right) ? 1 : 0); - + public static double SveCompareGreaterThanOrEqual(double left, double right) => BitConverter.Int64BitsToDouble((left >= right) ? 1 : 0); public static float SveCompareGreaterThanOrEqual(float left, float right) => BitConverter.Int32BitsToSingle((left >= right) ? 1 : 0); public static sbyte SveCompareGreaterThanOrEqual(sbyte left, sbyte right) => (sbyte)((left >= right) ? 1 : 0); @@ -1913,7 +1913,7 @@ public static float SveAbsoluteCompareLessThanOrEqual(float left, float right) public static int SveCompareLessThan(int left, int right) => (int)((left < right) ? 1 : 0); public static uint SveCompareLessThan(uint left, uint right) => (uint)((left < right) ? 1 : 0); public static long SveCompareLessThan(long left, long right) => (long)((left < right) ? 1 : 0); - public static ulong SveCompareLessThan(ulong left, ulong right) => (ulong)((left < right) ? 1 : 0); + public static ulong SveCompareLessThan(ulong left, ulong right) => (ulong)((left < right) ? 1 : 0); public static double SveCompareLessThanOrEqual(double left, double right) => BitConverter.Int64BitsToDouble((left <= right) ? 1 : 0); public static float SveCompareLessThanOrEqual(float left, float right) => BitConverter.Int32BitsToSingle((left <= right) ? 1 : 0); @@ -2091,7 +2091,7 @@ public static float CompareTest(float left, float right) public static float Scale(float op1, int op2) => op1 * MathF.Pow((float)2.0, op2); - public static double Scale(double op1, long op2) => op1 * Math.Pow(2.0, op2); + public static double Scale(double op1, long op2) => op1 * Math.Pow(2.0, op2); public static float Sqrt(float value) => MathF.Sqrt(value); @@ -3888,7 +3888,7 @@ private static sbyte SignedShift(sbyte op1, sbyte op2, bool rounding = false, bo { bool ovf; - (rndCns, ovf) = ShiftOvf((sbyte)1, -shift-1); + (rndCns, ovf) = ShiftOvf((sbyte)1, -shift - 1); if (ovf) { @@ -3964,11 +3964,11 @@ public static T[] ShiftAndInsert(T[] op1, T op2) public static sbyte ShiftRightArithmetic(sbyte op1, byte op2) => SignedShift(op1, (sbyte)(-op2)); - public static sbyte ShiftRightArithmeticAdd(sbyte op1, sbyte op2, byte op3) => (sbyte)(op1 + ShiftRightArithmetic(op2, op3)); + public static sbyte ShiftRightArithmeticAdd(sbyte op1, sbyte op2, byte op3) => (sbyte)(op1 + ShiftRightArithmetic(op2, op3)); public static sbyte ShiftRightArithmeticRounded(sbyte op1, byte op2) => SignedShift(op1, (sbyte)(-op2), rounding: true); - public static sbyte ShiftRightArithmeticRoundedAdd(sbyte op1, sbyte op2, byte op3) => (sbyte)(op1 + ShiftRightArithmeticRounded(op2, op3)); + public static sbyte ShiftRightArithmeticRoundedAdd(sbyte op1, sbyte op2, byte op3) => (sbyte)(op1 + ShiftRightArithmeticRounded(op2, op3)); public static sbyte ShiftRightLogical(sbyte op1, byte op2) => UnsignedShift(op1, (sbyte)(-op2)); @@ -3996,7 +3996,7 @@ private static byte UnsignedShift(byte op1, sbyte op2, bool rounding = false, bo { bool ovf; - (rndCns, ovf) = ShiftOvf((byte)1, -shift-1); + (rndCns, ovf) = ShiftOvf((byte)1, -shift - 1); if (ovf) { @@ -4202,7 +4202,7 @@ private static short SignedShift(short op1, short op2, bool rounding = false, bo { bool ovf; - (rndCns, ovf) = ShiftOvf((short)1, -shift-1); + (rndCns, ovf) = ShiftOvf((short)1, -shift - 1); if (ovf) { @@ -4266,11 +4266,11 @@ private static short SignedShift(short op1, short op2, bool rounding = false, bo public static short ShiftRightArithmetic(short op1, byte op2) => SignedShift(op1, (short)(-op2)); - public static short ShiftRightArithmeticAdd(short op1, short op2, byte op3) => (short)(op1 + ShiftRightArithmetic(op2, op3)); + public static short ShiftRightArithmeticAdd(short op1, short op2, byte op3) => (short)(op1 + ShiftRightArithmetic(op2, op3)); public static short ShiftRightArithmeticRounded(short op1, byte op2) => SignedShift(op1, (short)(-op2), rounding: true); - public static short ShiftRightArithmeticRoundedAdd(short op1, short op2, byte op3) => (short)(op1 + ShiftRightArithmeticRounded(op2, op3)); + public static short ShiftRightArithmeticRoundedAdd(short op1, short op2, byte op3) => (short)(op1 + ShiftRightArithmeticRounded(op2, op3)); public static short ShiftRightLogical(short op1, byte op2) => UnsignedShift(op1, (short)(-op2)); @@ -4298,7 +4298,7 @@ private static ushort UnsignedShift(ushort op1, short op2, bool rounding = false { bool ovf; - (rndCns, ovf) = ShiftOvf((ushort)1, -shift-1); + (rndCns, ovf) = ShiftOvf((ushort)1, -shift - 1); if (ovf) { @@ -4470,7 +4470,7 @@ private static int SignedShift(int op1, int op2, bool rounding = false, bool sat { bool ovf; - (rndCns, ovf) = ShiftOvf((int)1, -shift-1); + (rndCns, ovf) = ShiftOvf((int)1, -shift - 1); if (ovf) { @@ -4534,11 +4534,11 @@ private static int SignedShift(int op1, int op2, bool rounding = false, bool sat public static int ShiftRightArithmetic(int op1, byte op2) => SignedShift(op1, (int)(-op2)); - public static int ShiftRightArithmeticAdd(int op1, int op2, byte op3) => (int)(op1 + ShiftRightArithmetic(op2, op3)); + public static int ShiftRightArithmeticAdd(int op1, int op2, byte op3) => (int)(op1 + ShiftRightArithmetic(op2, op3)); public static int ShiftRightArithmeticRounded(int op1, byte op2) => SignedShift(op1, (int)(-op2), rounding: true); - public static int ShiftRightArithmeticRoundedAdd(int op1, int op2, byte op3) => (int)(op1 + ShiftRightArithmeticRounded(op2, op3)); + public static int ShiftRightArithmeticRoundedAdd(int op1, int op2, byte op3) => (int)(op1 + ShiftRightArithmeticRounded(op2, op3)); public static int ShiftRightLogical(int op1, byte op2) => UnsignedShift(op1, (int)(-op2)); @@ -4566,7 +4566,7 @@ private static uint UnsignedShift(uint op1, int op2, bool rounding = false, bool { bool ovf; - (rndCns, ovf) = ShiftOvf((uint)1, -shift-1); + (rndCns, ovf) = ShiftOvf((uint)1, -shift - 1); if (ovf) { @@ -4738,7 +4738,7 @@ private static long SignedShift(long op1, long op2, bool rounding = false, bool { bool ovf; - (rndCns, ovf) = ShiftOvf((long)1, -shift-1); + (rndCns, ovf) = ShiftOvf((long)1, -shift - 1); if (ovf) { @@ -4802,11 +4802,11 @@ private static long SignedShift(long op1, long op2, bool rounding = false, bool public static long ShiftRightArithmetic(long op1, byte op2) => SignedShift(op1, (long)(-op2)); - public static long ShiftRightArithmeticAdd(long op1, long op2, byte op3) => (long)(op1 + ShiftRightArithmetic(op2, op3)); + public static long ShiftRightArithmeticAdd(long op1, long op2, byte op3) => (long)(op1 + ShiftRightArithmetic(op2, op3)); public static long ShiftRightArithmeticRounded(long op1, byte op2) => SignedShift(op1, (long)(-op2), rounding: true); - public static long ShiftRightArithmeticRoundedAdd(long op1, long op2, byte op3) => (long)(op1 + ShiftRightArithmeticRounded(op2, op3)); + public static long ShiftRightArithmeticRoundedAdd(long op1, long op2, byte op3) => (long)(op1 + ShiftRightArithmeticRounded(op2, op3)); public static long ShiftRightLogical(long op1, byte op2) => UnsignedShift(op1, (long)(-op2)); @@ -4834,7 +4834,7 @@ private static ulong UnsignedShift(ulong op1, long op2, bool rounding = false, b { bool ovf; - (rndCns, ovf) = ShiftOvf((ulong)1, -shift-1); + (rndCns, ovf) = ShiftOvf((ulong)1, -shift - 1); if (ovf) { @@ -5302,23 +5302,23 @@ public static float TrigonometricMultiplyAddCoefficient(float op1, float op2, by int index = (op2 < 0) ? (imm + 8) : imm; uint coeff = index switch { - 0 => 0x3f800000, - 1 => 0xbe2aaaab, - 2 => 0x3c088886, - 3 => 0xb95008b9, - 4 => 0x36369d6d, - 5 => 0x00000000, - 6 => 0x00000000, - 7 => 0x00000000, - 8 => 0x3f800000, - 9 => 0xbf000000, + 0 => 0x3f800000, + 1 => 0xbe2aaaab, + 2 => 0x3c088886, + 3 => 0xb95008b9, + 4 => 0x36369d6d, + 5 => 0x00000000, + 6 => 0x00000000, + 7 => 0x00000000, + 8 => 0x3f800000, + 9 => 0xbf000000, 10 => 0x3d2aaaa6, 11 => 0xbab60705, 12 => 0x37cd37cc, 13 => 0x00000000, 14 => 0x00000000, 15 => 0x00000000, - _ => 0x00000000 + _ => 0x00000000 }; return MathF.FusedMultiplyAdd(op1, Math.Abs(op2), BitConverter.UInt32BitsToSingle(coeff)); @@ -5328,7 +5328,7 @@ public static float TrigonometricSelectCoefficient(float op1, uint op2) { float result = ((op2 % 2) == 0) ? op1 : (float)1.0; bool isNegative = (op2 & 0b10) == 0b10; - + if (isNegative != (result < 0)) { result *= -1; @@ -5359,16 +5359,16 @@ public static float FPExponentialAccelerator(uint op1) uint index = op1 & 0b111111; uint coeff = index switch { - 0 => 0x000000, - 1 => 0x0164d2, - 2 => 0x02cd87, - 3 => 0x043a29, - 4 => 0x05aac3, - 5 => 0x071f62, - 6 => 0x08980f, - 7 => 0x0a14d5, - 8 => 0x0b95c2, - 9 => 0x0d1adf, + 0 => 0x000000, + 1 => 0x0164d2, + 2 => 0x02cd87, + 3 => 0x043a29, + 4 => 0x05aac3, + 5 => 0x071f62, + 6 => 0x08980f, + 7 => 0x0a14d5, + 8 => 0x0b95c2, + 9 => 0x0d1adf, 10 => 0x0ea43a, 11 => 0x1031dc, 12 => 0x11c3d3, @@ -5423,7 +5423,7 @@ public static float FPExponentialAccelerator(uint op1) 61 => 0x77d0df, 62 => 0x7a83b3, 63 => 0x7d3e0c, - _ => 0x000000 + _ => 0x000000 }; uint result = ((op1 & 0b11111111000000) << 17) | coeff; @@ -5501,23 +5501,23 @@ public static double TrigonometricMultiplyAddCoefficient(double op1, double op2, int index = (op2 < 0) ? (imm + 8) : imm; ulong coeff = index switch { - 0 => 0x3ff0000000000000, - 1 => 0xbfc5555555555543, - 2 => 0x3f8111111110f30c, - 3 => 0xbf2a01a019b92fc6, - 4 => 0x3ec71de351f3d22b, - 5 => 0xbe5ae5e2b60f7b91, - 6 => 0x3de5d8408868552f, - 7 => 0x0000000000000000, - 8 => 0x3ff0000000000000, - 9 => 0xbfe0000000000000, + 0 => 0x3ff0000000000000, + 1 => 0xbfc5555555555543, + 2 => 0x3f8111111110f30c, + 3 => 0xbf2a01a019b92fc6, + 4 => 0x3ec71de351f3d22b, + 5 => 0xbe5ae5e2b60f7b91, + 6 => 0x3de5d8408868552f, + 7 => 0x0000000000000000, + 8 => 0x3ff0000000000000, + 9 => 0xbfe0000000000000, 10 => 0x3fa5555555555536, 11 => 0xbf56c16c16c13a0b, 12 => 0x3efa01a019b1e8d8, 13 => 0xbe927e4f7282f468, 14 => 0x3e21ee96d2641b13, 15 => 0xbda8f76380fbb401, - _ => 0x0000000000000000 + _ => 0x0000000000000000 }; return Math.FusedMultiplyAdd(op1, Math.Abs(op2), BitConverter.UInt64BitsToDouble(coeff)); @@ -5527,7 +5527,7 @@ public static double TrigonometricSelectCoefficient(double op1, ulong op2) { double result = ((op2 % 2) == 0) ? op1 : 1.0; bool isNegative = (op2 & 0b10) == 0b10; - + if (isNegative != (result < 0)) { result *= -1; @@ -5552,22 +5552,22 @@ public static double TrigonometricStartingValue(double op1, ulong op2) return result; } - + public static double FPExponentialAccelerator(ulong op1) { ulong index = op1 & 0b111111; ulong coeff = index switch { - 0 => 0x0000000000000, - 1 => 0x02C9A3E778061, - 2 => 0x059B0D3158574, - 3 => 0x0874518759BC8, - 4 => 0x0B5586CF9890F, - 5 => 0x0E3EC32D3D1A2, - 6 => 0x11301D0125B51, - 7 => 0x1429AAEA92DE0, - 8 => 0x172B83C7D517B, - 9 => 0x1A35BEB6FCB75, + 0 => 0x0000000000000, + 1 => 0x02C9A3E778061, + 2 => 0x059B0D3158574, + 3 => 0x0874518759BC8, + 4 => 0x0B5586CF9890F, + 5 => 0x0E3EC32D3D1A2, + 6 => 0x11301D0125B51, + 7 => 0x1429AAEA92DE0, + 8 => 0x172B83C7D517B, + 9 => 0x1A35BEB6FCB75, 10 => 0x1D4873168B9AA, 11 => 0x2063B88628CD6, 12 => 0x2387A6E756238, @@ -5622,7 +5622,7 @@ public static double FPExponentialAccelerator(ulong op1) 61 => 0xEFA1BEE615A27, 62 => 0xF50765B6E4540, 63 => 0xFA7C1819E90D8, - _ => 0x0000000000000 + _ => 0x0000000000000 }; ulong result = ((op1 & 0b11111111111000000) << 46) | coeff; @@ -5668,7 +5668,7 @@ private static uint ReciprocalSqrtEstimate(uint a) } public static double ReciprocalEstimate(double op1) => Math.ReciprocalEstimate(op1); - + public static float ReciprocalEstimate(float op1) => MathF.ReciprocalEstimate(op1); public static double ReciprocalExponent(double op1) @@ -5696,7 +5696,7 @@ public static float ReciprocalExponent(float op1) } public static double ReciprocalSqrtEstimate(double op1) => Math.ReciprocalSqrtEstimate(op1); - + public static float ReciprocalSqrtEstimate(float op1) => MathF.ReciprocalSqrtEstimate(op1); private static uint ExtractBits(uint val, byte msbPos, byte lsbPos) @@ -6604,7 +6604,7 @@ private struct poly128_t if ((val.lo & 0x8000000000000000U) != 0) { - val.hi |= 1; + val.hi |= 1; } val.lo <<= 1; @@ -6701,7 +6701,7 @@ public static long MultiplyHigh(long op1, long op2) v0 = (ulong)op2 & 0xFFFFFFFF; v1 = op2 >> 32; w0 = u0 * v0; - t = u1 * (long)v0 + (long)(w0 >> 32); + t = u1 * (long)v0 + (long)(w0 >> 32); w1 = t & 0xFFFFFFFF; w2 = t >> 32; w1 = (long)u0 * v1 + w1; @@ -6717,7 +6717,7 @@ public static ulong MultiplyHigh(ulong op1, ulong op2) v0 = (ulong)op2 & 0xFFFFFFFF; v1 = op2 >> 32; w0 = u0 * v0; - t = u1 * (ulong)v0 + (ulong)(w0 >> 32); + t = u1 * (ulong)v0 + (ulong)(w0 >> 32); w1 = t & 0xFFFFFFFF; w2 = t >> 32; w1 = (ulong)u0 * v1 + w1; @@ -6916,7 +6916,7 @@ public static sbyte TableVectorExtension(int i, sbyte[] defaultValues, sbyte[] i int index = indices[i]; if (index < 0 || index >= fullTable.Length) - return defaultValues[i]; + return defaultValues[i]; return fullTable[index]; } @@ -6935,7 +6935,7 @@ public static byte TableVectorExtension(int i, byte[] defaultValues, byte[] indi int index = indices[i]; if (index < 0 || index >= fullTable.Length) - return defaultValues[i]; + return defaultValues[i]; return fullTable[index]; } @@ -7127,7 +7127,7 @@ public static int[] ConvertToInt32(double[] op1) public static int[] ConvertToInt32(float[] op1) => Array.ConvertAll(op1, num => ConvertToInt32(num)); private static long ConvertToInt64(double op1) => (long)Math.Clamp(op1, long.MinValue, long.MaxValue); - + public static long[] ConvertToInt64(double[] op1) => Array.ConvertAll(op1, num => ConvertToInt64(num)); public static long[] ConvertToInt64(float[] op1) @@ -7607,7 +7607,7 @@ public static ulong MaskBothSet(byte[] op1, byte[] op2) ulong acc = 0; for (var i = 0; i < op1.Length; i++) { - acc += (ulong)((op1[i]==1 && op2[i]==1) ? 1 : 0); + acc += (ulong)((op1[i] == 1 && op2[i] == 1) ? 1 : 0); } return acc; } @@ -7617,7 +7617,7 @@ public static ulong MaskBothSet(sbyte[] op1, sbyte[] op2) ulong acc = 0; for (var i = 0; i < op1.Length; i++) { - acc += (ulong)((op1[i]==1 && op2[i]==1) ? 1 : 0); + acc += (ulong)((op1[i] == 1 && op2[i] == 1) ? 1 : 0); } return acc; } @@ -7627,7 +7627,7 @@ public static ulong MaskBothSet(short[] op1, short[] op2) ulong acc = 0; for (var i = 0; i < op1.Length; i++) { - acc += (ulong)((op1[i]==1 && op2[i]==1) ? 1 : 0); + acc += (ulong)((op1[i] == 1 && op2[i] == 1) ? 1 : 0); } return acc; } @@ -7637,7 +7637,7 @@ public static ulong MaskBothSet(ushort[] op1, ushort[] op2) ulong acc = 0; for (var i = 0; i < op1.Length; i++) { - acc += (ulong)((op1[i]==1 && op2[i]==1) ? 1 : 0); + acc += (ulong)((op1[i] == 1 && op2[i] == 1) ? 1 : 0); } return acc; } @@ -7647,7 +7647,7 @@ public static ulong MaskBothSet(int[] op1, int[] op2) ulong acc = 0; for (var i = 0; i < op1.Length; i++) { - acc += (ulong)((op1[i]==1 && op2[i]==1) ? 1 : 0); + acc += (ulong)((op1[i] == 1 && op2[i] == 1) ? 1 : 0); } return acc; } @@ -7657,7 +7657,7 @@ public static ulong MaskBothSet(uint[] op1, uint[] op2) ulong acc = 0; for (var i = 0; i < op1.Length; i++) { - acc += (ulong)((op1[i]==1 && op2[i]==1) ? 1 : 0); + acc += (ulong)((op1[i] == 1 && op2[i] == 1) ? 1 : 0); } return acc; } @@ -7667,7 +7667,7 @@ public static ulong MaskBothSet(long[] op1, long[] op2) ulong acc = 0; for (var i = 0; i < op1.Length; i++) { - acc += (ulong)((op1[i]==1 && op2[i]==1) ? 1 : 0); + acc += (ulong)((op1[i] == 1 && op2[i] == 1) ? 1 : 0); } return acc; } @@ -7677,7 +7677,7 @@ public static ulong MaskBothSet(ulong[] op1, ulong[] op2) ulong acc = 0; for (var i = 0; i < op1.Length; i++) { - acc += (ulong)((op1[i]==1 && op2[i]==1) ? 1 : 0); + acc += (ulong)((op1[i] == 1 && op2[i] == 1) ? 1 : 0); } return acc; } @@ -7755,7 +7755,7 @@ public static double getMaskDouble() public static int MaskNumberOfElementsVector(int elems, SveMaskPattern pattern) { - switch(pattern) + switch (pattern) { // Returns elems, as this is always a power of 2. case SveMaskPattern.LargestPowerOf2: @@ -7807,7 +7807,7 @@ public static int NumberOfElementsInVectorInt8(SveMaskPattern pattern) { return MaskNumberOfElementsVector(Unsafe.SizeOf>() / sizeof(byte), pattern); } - + public static int NumberOfElementsInVectorInt16(SveMaskPattern pattern) { return MaskNumberOfElementsVector(Unsafe.SizeOf>() / sizeof(short), pattern); @@ -8010,7 +8010,7 @@ public static int LoadInt16FromByteArray(byte[] array, int offset) int ret = 0; for (int i = 1; i >= 0; i--) { - ret = (ret << 8) + (int)array[offset+i]; + ret = (ret << 8) + (int)array[offset + i]; } return ret; } @@ -8020,7 +8020,7 @@ public static int LoadInt16FromByteArray(byte[] array, uint offset) int ret = 0; for (int i = 1; i >= 0; i--) { - ret = (ret << 8) + (int)array[offset+i]; + ret = (ret << 8) + (int)array[offset + i]; } return ret; } @@ -8029,7 +8029,7 @@ public static int LoadInt32FromByteArray(byte[] array, int offset) int ret = 0; for (int i = 3; i >= 0; i--) { - ret = (ret << 8) + (int)array[offset+i]; + ret = (ret << 8) + (int)array[offset + i]; } return ret; } @@ -8039,7 +8039,7 @@ public static int LoadInt32FromByteArray(byte[] array, uint offset) int ret = 0; for (int i = 3; i >= 0; i--) { - ret = (ret << 8) + (int)array[offset+i]; + ret = (ret << 8) + (int)array[offset + i]; } return ret; } @@ -8049,7 +8049,7 @@ public static long LoadInt64FromByteArray(byte[] array, long offset) long ret = 0; for (long i = 7; i >= 0; i--) { - ret = (ret << 8) + (long)array[offset+i]; + ret = (ret << 8) + (long)array[offset + i]; } return ret; } @@ -8059,7 +8059,7 @@ public static long LoadInt64FromByteArray(byte[] array, ulong offset) long ret = 0; for (long i = 7; i >= 0; i--) { - ret = (ret << 8) + (long)array[offset+(ulong)i]; + ret = (ret << 8) + (long)array[offset + (ulong)i]; } return ret; } @@ -8069,7 +8069,7 @@ public static uint LoadUInt16FromByteArray(byte[] array, int offset) uint ret = 0; for (int i = 1; i >= 0; i--) { - ret = (ret << 8) + (uint)array[offset+i]; + ret = (ret << 8) + (uint)array[offset + i]; } return ret; } @@ -8079,7 +8079,7 @@ public static uint LoadUInt16FromByteArray(byte[] array, uint offset) uint ret = 0; for (int i = 1; i >= 0; i--) { - ret = (ret << 8) + (uint)array[offset+i]; + ret = (ret << 8) + (uint)array[offset + i]; } return ret; } @@ -8089,7 +8089,7 @@ public static uint LoadUInt32FromByteArray(byte[] array, int offset) uint ret = 0; for (int i = 3; i >= 0; i--) { - ret = (ret << 8) + (uint)array[offset+i]; + ret = (ret << 8) + (uint)array[offset + i]; } return ret; } @@ -8099,7 +8099,7 @@ public static uint LoadUInt32FromByteArray(byte[] array, uint offset) uint ret = 0; for (int i = 3; i >= 0; i--) { - ret = (ret << 8) + (uint)array[offset+i]; + ret = (ret << 8) + (uint)array[offset + i]; } return ret; } @@ -8109,7 +8109,7 @@ public static ulong LoadUInt64FromByteArray(byte[] array, long offset) ulong ret = 0; for (long i = 7; i >= 0; i--) { - ret = (ret << 8) + (ulong)array[offset+i]; + ret = (ret << 8) + (ulong)array[offset + i]; } return ret; } @@ -8119,7 +8119,7 @@ public static ulong LoadUInt64FromByteArray(byte[] array, ulong offset) ulong ret = 0; for (long i = 7; i >= 0; i--) { - ret = (ret << 8) + (ulong)array[offset+(ulong)i]; + ret = (ret << 8) + (ulong)array[offset + (ulong)i]; } return ret; } @@ -8129,7 +8129,7 @@ public static float LoadSingleFromByteArray(byte[] array, int offset) int ret = 0; for (int i = 3; i >= 0; i--) { - ret = (ret << 8) + (int)array[offset+i]; + ret = (ret << 8) + (int)array[offset + i]; } return BitConverter.Int32BitsToSingle(ret); } @@ -8139,7 +8139,7 @@ public static float LoadSingleFromByteArray(byte[] array, uint offset) int ret = 0; for (int i = 3; i >= 0; i--) { - ret = (ret << 8) + (int)array[offset+i]; + ret = (ret << 8) + (int)array[offset + i]; } return BitConverter.Int32BitsToSingle(ret); } @@ -8149,7 +8149,7 @@ public static double LoadDoubleFromByteArray(byte[] array, long offset) long ret = 0; for (long i = 7; i >= 0; i--) { - ret = (ret << 8) + (long)array[offset+i]; + ret = (ret << 8) + (long)array[offset + i]; } return BitConverter.Int64BitsToDouble(ret); } @@ -8159,7 +8159,7 @@ public static double LoadDoubleFromByteArray(byte[] array, ulong offset) long ret = 0; for (long i = 7; i >= 0; i--) { - ret = (ret << 8) + (long)array[offset+(ulong)i]; + ret = (ret << 8) + (long)array[offset + (ulong)i]; } return BitConverter.Int64BitsToDouble(ret); } @@ -8167,9 +8167,9 @@ public static double LoadDoubleFromByteArray(byte[] array, ulong offset) public static Byte Splice(Byte[] first, Byte[] second, Byte[] maskArray, Int32 index) { int start = -1; - int end = -1; + int end = -1; - for(var i = 0; i < maskArray.Length; i++) + for (var i = 0; i < maskArray.Length; i++) { if (maskArray[i] != 0) { @@ -8193,9 +8193,9 @@ public static Byte Splice(Byte[] first, Byte[] second, Byte[] maskArray, Int32 i public static double Splice(double[] first, double[] second, double[] maskArray, Int32 index) { int start = -1; - int end = -1; + int end = -1; - for(var i = 0; i < maskArray.Length; i++) + for (var i = 0; i < maskArray.Length; i++) { if (Double.IsNaN(maskArray[i]) || maskArray[i] > 0.0d) { @@ -8219,9 +8219,9 @@ public static double Splice(double[] first, double[] second, double[] maskArray, public static float Splice(float[] first, float[] second, float[] maskArray, Int32 index) { int start = -1; - int end = -1; + int end = -1; - for(var i = 0; i < maskArray.Length; i++) + for (var i = 0; i < maskArray.Length; i++) { if (maskArray[i] != 0.0f) { @@ -8245,9 +8245,9 @@ public static float Splice(float[] first, float[] second, float[] maskArray, Int public static Int16 Splice(Int16[] first, Int16[] second, Int16[] maskArray, Int32 index) { int start = -1; - int end = -1; + int end = -1; - for(var i = 0; i < maskArray.Length; i++) + for (var i = 0; i < maskArray.Length; i++) { if (maskArray[i] != 0) { @@ -8271,9 +8271,9 @@ public static Int16 Splice(Int16[] first, Int16[] second, Int16[] maskArray, Int public static Int32 Splice(Int32[] first, Int32[] second, Int32[] maskArray, Int32 index) { int start = -1; - int end = -1; + int end = -1; - for(var i = 0; i < maskArray.Length; i++) + for (var i = 0; i < maskArray.Length; i++) { if (maskArray[i] != 0) { @@ -8297,9 +8297,9 @@ public static Int32 Splice(Int32[] first, Int32[] second, Int32[] maskArray, Int public static Int64 Splice(Int64[] first, Int64[] second, Int64[] maskArray, Int32 index) { int start = -1; - int end = -1; + int end = -1; - for(var i = 0; i < maskArray.Length; i++) + for (var i = 0; i < maskArray.Length; i++) { if (maskArray[i] != 0) { @@ -8323,9 +8323,9 @@ public static Int64 Splice(Int64[] first, Int64[] second, Int64[] maskArray, Int public static SByte Splice(SByte[] first, SByte[] second, SByte[] maskArray, Int32 index) { int start = -1; - int end = -1; + int end = -1; - for(var i = 0; i < maskArray.Length; i++) + for (var i = 0; i < maskArray.Length; i++) { if (maskArray[i] != 0) { @@ -8349,9 +8349,9 @@ public static SByte Splice(SByte[] first, SByte[] second, SByte[] maskArray, Int public static UInt16 Splice(UInt16[] first, UInt16[] second, UInt16[] maskArray, Int32 index) { int start = -1; - int end = -1; + int end = -1; - for(var i = 0; i < maskArray.Length; i++) + for (var i = 0; i < maskArray.Length; i++) { if (maskArray[i] != 0) { @@ -8375,9 +8375,9 @@ public static UInt16 Splice(UInt16[] first, UInt16[] second, UInt16[] maskArray, public static UInt32 Splice(UInt32[] first, UInt32[] second, UInt32[] maskArray, Int32 index) { int start = -1; - int end = -1; + int end = -1; - for(var i = 0; i < maskArray.Length; i++) + for (var i = 0; i < maskArray.Length; i++) { if (maskArray[i] != 0) { @@ -8401,9 +8401,9 @@ public static UInt32 Splice(UInt32[] first, UInt32[] second, UInt32[] maskArray, public static ulong Splice(ulong[] first, ulong[] second, ulong[] maskArray, int index) { int start = -1; - int end = -1; + int end = -1; - for(var i = 0; i < maskArray.Length; i++) + for (var i = 0; i < maskArray.Length; i++) { if (maskArray[i] != 0) { @@ -8558,14 +8558,14 @@ private static T ConditionalSelectTrueResult(T maskResult, T result, T trueRe private static TElem GetLoadVectorExpectedResultByIndex(int index, TElem[] mask, TMem[] data, TElem[] result) - where TMem : INumberBase + where TMem : INumberBase where TElem : INumberBase { return (mask[index] == TElem.Zero) ? TElem.Zero : TElem.CreateTruncating(data[index]); } private static TElem GetLoadVectorExpectedResultByIndex(int index, TMem[] data, TElem[] result) - where TMem : INumberBase + where TMem : INumberBase where TElem : INumberBase { TElem[] mask = new TElem[result.Length]; @@ -8575,7 +8575,7 @@ private static TElem GetLoadVectorExpectedResultByIndex(int index, } private static bool CheckLoadVectorBehaviorCore(TElem[] mask, TMem[] data, TElem[] result, Func map) - where TMem : INumberBase + where TMem : INumberBase where TElem : INumberBase { for (var i = 0; i < data.Length; i++) @@ -8591,7 +8591,7 @@ private static bool CheckLoadVectorBehaviorCore(TElem[] mask, TMem[ } private static bool CheckLoadVectorBehaviorCore(TMem[] data, TElem[] result, Func map) - where TMem : INumberBase + where TMem : INumberBase where TElem : INumberBase { for (var i = 0; i < data.Length; i++) @@ -8607,36 +8607,36 @@ private static bool CheckLoadVectorBehaviorCore(TMem[] data, TElem[ } public static bool CheckLoadVectorBehavior(TElem[] mask, TMem[] data, TElem[] result) - where TMem : INumberBase, IConvertible + where TMem : INumberBase, IConvertible where TElem : INumberBase { return CheckLoadVectorBehaviorCore(mask, data, result, (_, loadResult) => loadResult); } public static bool CheckLoadVectorBehavior(TMem[] data, TElem[] result) - where TMem : INumberBase, IConvertible + where TMem : INumberBase, IConvertible where TElem : INumberBase { return CheckLoadVectorBehaviorCore(data, result, (_, loadResult) => loadResult); } public static bool CheckLoadVectorBehavior(TElem[] maskOp, TMem[] data, TElem[] result, TElem[] falseOp) - where TMem : INumberBase, IConvertible + where TMem : INumberBase, IConvertible where TElem : INumberBase { return CheckLoadVectorBehaviorCore(data, result, (i, loadResult) => ConditionalSelectResult(maskOp[i], loadResult, falseOp[i])); } private static T GetGatherVectorResultByIndex(int index, T[] mask, ExtendedElementT[] data, Index[] indices) - where T : INumberBase - where ExtendedElementT : INumberBase + where T : INumberBase + where ExtendedElementT : INumberBase where Index : IBinaryInteger { return (mask[index] == T.Zero) ? T.Zero : T.CreateTruncating(data[int.CreateChecked(indices[index])]); } private static unsafe T GetGatherVectorBasesResultByIndex(int index, T[] mask, AddressT[] data) - where T : INumberBase + where T : INumberBase where AddressT : unmanaged, INumberBase where ExtendedElementT : unmanaged, INumberBase { @@ -8693,9 +8693,9 @@ private static bool GetGatherVectorResultByByteOffset(T[] mask, ExtendedElementT[] data, Index[] indices, T[] result, Func map) + private static bool CheckGatherVectorBehaviorCore(T[] mask, ExtendedElementT[] data, Index[] indices, T[] result, Func map) where T : INumberBase - where ExtendedElementT : INumberBase + where ExtendedElementT : INumberBase where Index : IBinaryInteger { for (var i = 0; i < mask.Length; i++) @@ -8710,8 +8710,8 @@ private static bool CheckGatherVectorBehaviorCore(T[ return true; } - private static bool CheckGatherVectorBasesBehaviorCore(T[] mask, AddressT[] data, T[] result, Func map) - where T : INumberBase + private static bool CheckGatherVectorBasesBehaviorCore(T[] mask, AddressT[] data, T[] result, Func map) + where T : INumberBase where AddressT : unmanaged, INumberBase where ExtendedElementT : unmanaged, INumberBase { @@ -8727,56 +8727,56 @@ private static bool CheckGatherVectorBasesBehaviorCore(T[] mask, ExtendedElementT[] data, Index[] indices, T[] result) - where T : INumberBase - where ExtendedElementT : INumberBase + public static bool CheckGatherVectorBehavior(T[] mask, ExtendedElementT[] data, Index[] indices, T[] result) + where T : INumberBase + where ExtendedElementT : INumberBase where Index : IBinaryInteger { return CheckGatherVectorBehaviorCore(mask, data, indices, result, (_, gatherResult) => gatherResult); } - public static bool CheckGatherVectorConditionalSelectBehavior(T[] cndSelMask, T[] mask, ExtendedElementT[] data, Index[] indices, T[] cndSelFalse, T[] result) - where T : INumberBase - where ExtendedElementT : INumberBase + public static bool CheckGatherVectorConditionalSelectBehavior(T[] cndSelMask, T[] mask, ExtendedElementT[] data, Index[] indices, T[] cndSelFalse, T[] result) + where T : INumberBase + where ExtendedElementT : INumberBase where Index : IBinaryInteger { return CheckGatherVectorBehaviorCore(mask, data, indices, result, (i, gatherResult) => ConditionalSelectResult(cndSelMask[i], gatherResult, cndSelFalse[i])); } - public static bool CheckGatherVectorConditionalSelectTrueBehavior(T[] cndSelMask, T[] mask, ExtendedElementT[] data, Index[] indices, T[] cndSelTrue, T[] result) - where T : INumberBase - where ExtendedElementT : INumberBase + public static bool CheckGatherVectorConditionalSelectTrueBehavior(T[] cndSelMask, T[] mask, ExtendedElementT[] data, Index[] indices, T[] cndSelTrue, T[] result) + where T : INumberBase + where ExtendedElementT : INumberBase where Index : IBinaryInteger { return CheckGatherVectorBehaviorCore(mask, data, indices, result, (i, gatherResult) => ConditionalSelectTrueResult(cndSelMask[i], gatherResult, cndSelTrue[i])); } - public static bool CheckGatherVectorBasesBehavior(T[] mask, AddressT[] data, T[] result) - where T : INumberBase + public static bool CheckGatherVectorBasesBehavior(T[] mask, AddressT[] data, T[] result) + where T : INumberBase where AddressT : unmanaged, INumberBase - where ExtendedElementT : unmanaged, INumberBase + where ExtendedElementT : unmanaged, INumberBase { return CheckGatherVectorBasesBehaviorCore(mask, data, result, (_, gatherResult) => gatherResult); } - public static bool CheckGatherVectorBasesConditionalSelectBehavior(T[] cndSelMask, T[] mask, AddressT[] data, T[] cndSelFalse, T[] result) - where T : INumberBase + public static bool CheckGatherVectorBasesConditionalSelectBehavior(T[] cndSelMask, T[] mask, AddressT[] data, T[] cndSelFalse, T[] result) + where T : INumberBase where AddressT : unmanaged, INumberBase where ExtendedElementT : unmanaged, INumberBase { return CheckGatherVectorBasesBehaviorCore(mask, data, result, (i, gatherResult) => ConditionalSelectResult(cndSelMask[i], gatherResult, cndSelFalse[i])); } - public static bool CheckGatherVectorBasesConditionalSelectTrueBehavior(T[] cndSelMask, T[] mask, AddressT[] data, T[] cndSelTrue, T[] result) - where T : INumberBase + public static bool CheckGatherVectorBasesConditionalSelectTrueBehavior(T[] cndSelMask, T[] mask, AddressT[] data, T[] cndSelTrue, T[] result) + where T : INumberBase where AddressT : unmanaged, INumberBase where ExtendedElementT : unmanaged, INumberBase { return CheckGatherVectorBasesBehaviorCore(mask, data, result, (i, gatherResult) => ConditionalSelectTrueResult(cndSelMask[i], gatherResult, cndSelTrue[i])); } - private static bool CheckFirstFaultingBehaviorCore(T[] result, Vector faultResult, Func checkIter) + private static bool CheckFirstFaultingBehaviorCore(T[] result, Vector faultResult, Func checkIter) where T : INumberBase where TFault : INumberBase { @@ -8828,7 +8828,7 @@ private static bool CheckFaultResultHasAtLeastOneZero(Vector faultResult) } public static bool CheckLoadVectorFirstFaultingBehavior(TElem[] mask, TMem[] data, TElem[] result, Vector faultResult) - where TMem : INumberBase, IConvertible + where TMem : INumberBase, IConvertible where TElem : INumberBase where TFault : INumberBase { @@ -8841,7 +8841,7 @@ public static bool CheckLoadVectorFirstFaultingBehavior(TEl var validElementCount = data.Length; var hasFaulted = false; - var expectedFaultResult = + var expectedFaultResult = InitVector(i => { if (hasFaulted) @@ -8872,8 +8872,8 @@ public static bool CheckLoadVectorFirstFaultingBehavior(TEl } public static bool CheckGatherVectorFirstFaultingBehavior(T[] mask, ExtendedElementT[] data, Index[] indices, T[] result, Vector faultResult) - where T : INumberBase - where ExtendedElementT : INumberBase + where T : INumberBase + where ExtendedElementT : INumberBase where Index : IBinaryInteger where TFault : INumberBase { @@ -8885,7 +8885,7 @@ public static bool CheckGatherVectorFirstFaultingBehavior(i => { if (hasFaulted) @@ -8916,9 +8916,9 @@ public static bool CheckGatherVectorFirstFaultingBehavior(T[] mask, AddressT[] data, T[] result, Vector faultResult) - where T : INumberBase + where T : INumberBase where AddressT : unmanaged, INumberBase - where ExtendedElementT : unmanaged, INumberBase + where ExtendedElementT : unmanaged, INumberBase where TFault : INumberBase { // Checking first faulting behavior requires at least one zero to ensure we are testing the behavior. @@ -8929,14 +8929,14 @@ public static bool CheckGatherVectorBasesFirstFaultingBehavior(i => { if (hasFaulted) { return TFault.Zero; } - + if (mask[i] == T.Zero) { return TFault.One; @@ -8957,7 +8957,7 @@ public static bool CheckGatherVectorBasesFirstFaultingBehavior GetGatherVectorBasesResultByIndex(i, mask, data) == result[i]); } - + public static bool CheckGatherVectorWithByteOffsetFirstFaultingBehavior(T[] mask, byte[] data, Offset[] offsets, T[] result, Vector faultResult) where T : INumberBase where ExtendedElementT : INumberBase @@ -9035,8 +9035,9 @@ private static byte ConditionalExtract(byte[] op1, byte op2, byte[] op3, bool af if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9056,8 +9057,9 @@ private static byte[] ConditionalExtract(byte[] op1, byte[] op2, byte[] op3, boo if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9068,7 +9070,7 @@ private static byte[] ConditionalExtract(byte[] op1, byte[] op2, byte[] op3, boo else { Array.Fill(result, 0, 0, op1.Length); - result[0] = op3[pos]; + result[0] = op3[pos]; } return result; @@ -9116,8 +9118,9 @@ private static sbyte ConditionalExtract(sbyte[] op1, sbyte op2, sbyte[] op3, boo if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9137,8 +9140,9 @@ private static sbyte[] ConditionalExtract(sbyte[] op1, sbyte[] op2, sbyte[] op3, if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9149,7 +9153,7 @@ private static sbyte[] ConditionalExtract(sbyte[] op1, sbyte[] op2, sbyte[] op3, else { Array.Fill(result, 0, 0, op1.Length); - result[0] = op3[pos]; + result[0] = op3[pos]; } return result; @@ -9197,8 +9201,9 @@ private static short ConditionalExtract(short[] op1, short op2, short[] op3, boo if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9218,8 +9223,9 @@ private static short[] ConditionalExtract(short[] op1, short[] op2, short[] op3, if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9230,7 +9236,7 @@ private static short[] ConditionalExtract(short[] op1, short[] op2, short[] op3, else { Array.Fill(result, 0, 0, op1.Length); - result[0] = op3[pos]; + result[0] = op3[pos]; } return result; @@ -9278,8 +9284,9 @@ private static ushort ConditionalExtract(ushort[] op1, ushort op2, ushort[] op3, if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9299,8 +9306,9 @@ private static ushort[] ConditionalExtract(ushort[] op1, ushort[] op2, ushort[] if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9311,7 +9319,7 @@ private static ushort[] ConditionalExtract(ushort[] op1, ushort[] op2, ushort[] else { Array.Fill(result, 0, 0, op1.Length); - result[0] = op3[pos]; + result[0] = op3[pos]; } return result; @@ -9359,8 +9367,9 @@ private static int ConditionalExtract(int[] op1, int op2, int[] op3, bool after) if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9380,8 +9389,9 @@ private static int[] ConditionalExtract(int[] op1, int[] op2, int[] op3, bool af if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9392,7 +9402,7 @@ private static int[] ConditionalExtract(int[] op1, int[] op2, int[] op3, bool af else { Array.Fill(result, 0, 0, op1.Length); - result[0] = op3[pos]; + result[0] = op3[pos]; } return result; @@ -9440,8 +9450,9 @@ private static uint ConditionalExtract(uint[] op1, uint op2, uint[] op3, bool af if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9461,8 +9472,9 @@ private static uint[] ConditionalExtract(uint[] op1, uint[] op2, uint[] op3, boo if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9473,7 +9485,7 @@ private static uint[] ConditionalExtract(uint[] op1, uint[] op2, uint[] op3, boo else { Array.Fill(result, 0, 0, op1.Length); - result[0] = op3[pos]; + result[0] = op3[pos]; } return result; @@ -9521,8 +9533,9 @@ private static long ConditionalExtract(long[] op1, long op2, long[] op3, bool af if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9542,8 +9555,9 @@ private static long[] ConditionalExtract(long[] op1, long[] op2, long[] op3, boo if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9554,7 +9568,7 @@ private static long[] ConditionalExtract(long[] op1, long[] op2, long[] op3, boo else { Array.Fill(result, 0, 0, op1.Length); - result[0] = op3[pos]; + result[0] = op3[pos]; } return result; @@ -9607,8 +9621,9 @@ private static ulong ConditionalExtract(ulong[] op1, ulong op2, ulong[] op3, boo if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9628,8 +9643,9 @@ private static ulong[] ConditionalExtract(ulong[] op1, ulong[] op2, ulong[] op3, if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9640,7 +9656,7 @@ private static ulong[] ConditionalExtract(ulong[] op1, ulong[] op2, ulong[] op3, else { Array.Fill(result, 0, 0, op1.Length); - result[0] = op3[pos]; + result[0] = op3[pos]; } return result; @@ -9683,8 +9699,9 @@ private static float ConditionalExtract(float[] op1, float op2, float[] op3, boo if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9704,8 +9721,9 @@ private static float[] ConditionalExtract(float[] op1, float[] op2, float[] op3, if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9716,7 +9734,7 @@ private static float[] ConditionalExtract(float[] op1, float[] op2, float[] op3, else { Array.Fill(result, 0, 0, op1.Length); - result[0] = op3[pos]; + result[0] = op3[pos]; } return result; @@ -9764,8 +9782,9 @@ private static double ConditionalExtract(double[] op1, double op2, double[] op3, if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9785,8 +9804,9 @@ private static double[] ConditionalExtract(double[] op1, double[] op2, double[] if (after) { pos++; - if (pos == op1.Length) { - pos = 0; + if (pos == op1.Length) + { + pos = 0; } } @@ -9797,7 +9817,7 @@ private static double[] ConditionalExtract(double[] op1, double[] op2, double[] else { Array.Fill(result, 0, 0, op1.Length); - result[0] = op3[pos]; + result[0] = op3[pos]; } return result; @@ -9852,5 +9872,20 @@ public static T BitwiseSelectRightInverted(T select, T left, T right) where T { return (left & select) | (~right & ~select); } + + public static T Xor(params T[] ops) where T : IBitwiseOperators + { + T result = ops[0]; + for (int i = 1; i < ops.Length; i++) + { + result ^= ops[i]; + } + return result; + } + + public static T XorRotateRight(T op1, T op2, int shift) where T : IBinaryInteger + { + return T.RotateRight(Xor(op1, op2), shift); + } } }