From 20f11b0505d018c345446d06e6aeaeb64befb1e5 Mon Sep 17 00:00:00 2001 From: Aman Khalid Date: Tue, 16 Jul 2024 13:26:48 +0000 Subject: [PATCH] ARM64-SVE: Add `ConvertToSingle`, `ConvertToDouble`; fix `CovertTo*` tests (#104478) --- src/coreclr/jit/hwintrinsic.cpp | 4 +- src/coreclr/jit/hwintrinsiccodegenarm64.cpp | 2 + src/coreclr/jit/hwintrinsiclistarm64sve.h | 2 + src/coreclr/jit/lowerarmarch.cpp | 6 +- .../Arm/Sve.PlatformNotSupported.cs | 97 +++++++++++ .../src/System/Runtime/Intrinsics/Arm/Sve.cs | 96 +++++++++++ .../ref/System.Runtime.Intrinsics.cs | 10 ++ .../GenerateHWIntrinsicTests_Arm.cs | 47 ++++-- .../HardwareIntrinsics/Arm/Shared/Helpers.cs | 154 ++++++++++++++++-- ...aryOpDifferentRetTypeTestTemplate.template | 33 ++-- 10 files changed, 406 insertions(+), 45 deletions(-) diff --git a/src/coreclr/jit/hwintrinsic.cpp b/src/coreclr/jit/hwintrinsic.cpp index f1b05fb919798..4d31cebad96b3 100644 --- a/src/coreclr/jit/hwintrinsic.cpp +++ b/src/coreclr/jit/hwintrinsic.cpp @@ -2088,9 +2088,11 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic, #elif defined(TARGET_ARM64) switch (intrinsic) { + case NI_Sve_ConvertToDouble: case NI_Sve_ConvertToInt32: - case NI_Sve_ConvertToUInt32: case NI_Sve_ConvertToInt64: + case NI_Sve_ConvertToSingle: + case NI_Sve_ConvertToUInt32: case NI_Sve_ConvertToUInt64: // Save the base type of return SIMD. It is used to contain this intrinsic inside // ConditionalSelect. diff --git a/src/coreclr/jit/hwintrinsiccodegenarm64.cpp b/src/coreclr/jit/hwintrinsiccodegenarm64.cpp index 17f929fef2bb7..f8e77197916df 100644 --- a/src/coreclr/jit/hwintrinsiccodegenarm64.cpp +++ b/src/coreclr/jit/hwintrinsiccodegenarm64.cpp @@ -586,6 +586,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) { case NI_Sve_ConvertToInt32: case NI_Sve_ConvertToUInt32: + case NI_Sve_ConvertToSingle: { embOpt = emitTypeSize(intrinEmbMask.baseType) == EA_8BYTE ? INS_OPTS_D_TO_S : INS_OPTS_SCALABLE_S; @@ -594,6 +595,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) case NI_Sve_ConvertToInt64: case NI_Sve_ConvertToUInt64: + case NI_Sve_ConvertToDouble: { embOpt = emitTypeSize(intrinEmbMask.baseType) == EA_4BYTE ? INS_OPTS_S_TO_D : INS_OPTS_SCALABLE_D; diff --git a/src/coreclr/jit/hwintrinsiclistarm64sve.h b/src/coreclr/jit/hwintrinsiclistarm64sve.h index c7df23557516e..961076326818a 100644 --- a/src/coreclr/jit/hwintrinsiclistarm64sve.h +++ b/src/coreclr/jit/hwintrinsiclistarm64sve.h @@ -48,8 +48,10 @@ HARDWARE_INTRINSIC(Sve, ConditionalExtractAfterLastActiveElementAndRep HARDWARE_INTRINSIC(Sve, ConditionalExtractLastActiveElement, -1, 3, true, {INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_ExplicitMaskedOperation|HW_Flag_LowMaskedOperation|HW_Flag_HasRMWSemantics|HW_Flag_HasScalarInputVariant|HW_Flag_SpecialCodeGen) HARDWARE_INTRINSIC(Sve, ConditionalExtractLastActiveElementAndReplicate, -1, 3, true, {INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb, INS_sve_clastb}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_ExplicitMaskedOperation|HW_Flag_LowMaskedOperation|HW_Flag_HasRMWSemantics) HARDWARE_INTRINSIC(Sve, ConditionalSelect, -1, 3, true, {INS_sve_sel, INS_sve_sel, INS_sve_sel, INS_sve_sel, INS_sve_sel, INS_sve_sel, INS_sve_sel, INS_sve_sel, INS_sve_sel, INS_sve_sel}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_ExplicitMaskedOperation|HW_Flag_SupportsContainment) +HARDWARE_INTRINSIC(Sve, ConvertToDouble, -1, -1, false, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_scvtf, INS_sve_ucvtf, INS_sve_scvtf, INS_sve_ucvtf, INS_sve_fcvt, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_BaseTypeFromFirstArg|HW_Flag_EmbeddedMaskedOperation|HW_Flag_LowMaskedOperation) HARDWARE_INTRINSIC(Sve, ConvertToInt32, -1, -1, false, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_fcvtzs, INS_sve_fcvtzs}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_BaseTypeFromFirstArg|HW_Flag_EmbeddedMaskedOperation|HW_Flag_LowMaskedOperation) HARDWARE_INTRINSIC(Sve, ConvertToInt64, -1, -1, false, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_fcvtzs, INS_sve_fcvtzs}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_BaseTypeFromFirstArg|HW_Flag_EmbeddedMaskedOperation|HW_Flag_LowMaskedOperation) +HARDWARE_INTRINSIC(Sve, ConvertToSingle, -1, -1, false, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_scvtf, INS_sve_ucvtf, INS_sve_scvtf, INS_sve_ucvtf, INS_invalid, INS_sve_fcvt}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_BaseTypeFromFirstArg|HW_Flag_EmbeddedMaskedOperation|HW_Flag_LowMaskedOperation) HARDWARE_INTRINSIC(Sve, ConvertToUInt32, -1, -1, false, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_fcvtzu, INS_sve_fcvtzu}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_BaseTypeFromFirstArg|HW_Flag_EmbeddedMaskedOperation|HW_Flag_LowMaskedOperation) HARDWARE_INTRINSIC(Sve, ConvertToUInt64, -1, -1, false, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_fcvtzu, INS_sve_fcvtzu}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_BaseTypeFromFirstArg|HW_Flag_EmbeddedMaskedOperation|HW_Flag_LowMaskedOperation) HARDWARE_INTRINSIC(Sve, Count16BitElements, 0, 1, false, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_cnth, INS_invalid, INS_invalid, INS_invalid}, HW_Category_Scalar, HW_Flag_Scalable|HW_Flag_HasEnumOperand|HW_Flag_SpecialCodeGen|HW_Flag_NoFloatingPointUsed) diff --git a/src/coreclr/jit/lowerarmarch.cpp b/src/coreclr/jit/lowerarmarch.cpp index 2ae67d5899b97..e64b134192ae2 100644 --- a/src/coreclr/jit/lowerarmarch.cpp +++ b/src/coreclr/jit/lowerarmarch.cpp @@ -3599,9 +3599,11 @@ void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node) // For now, make sure that we get here only for intrinsics that we are // sure about to rely on auxiliary type's size. - assert((embOp->GetHWIntrinsicId() == NI_Sve_ConvertToInt32) || - (embOp->GetHWIntrinsicId() == NI_Sve_ConvertToUInt32) || + assert((embOp->GetHWIntrinsicId() == NI_Sve_ConvertToDouble) || + (embOp->GetHWIntrinsicId() == NI_Sve_ConvertToInt32) || (embOp->GetHWIntrinsicId() == NI_Sve_ConvertToInt64) || + (embOp->GetHWIntrinsicId() == NI_Sve_ConvertToSingle) || + (embOp->GetHWIntrinsicId() == NI_Sve_ConvertToUInt32) || (embOp->GetHWIntrinsicId() == NI_Sve_ConvertToUInt64)); uint32_t auxSize = genTypeSize(embOp->GetAuxiliaryType()); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve.PlatformNotSupported.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve.PlatformNotSupported.cs index 81863a057638d..3d52204ba67f2 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve.PlatformNotSupported.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve.PlatformNotSupported.cs @@ -1879,6 +1879,54 @@ internal Arm64() { } public static unsafe Vector ConditionalSelect(Vector mask, Vector left, Vector right) { throw new PlatformNotSupportedException(); } + /// ConvertToDouble : Floating-point convert + + /// + /// svfloat64_t svcvt_f64[_s32]_m(svfloat64_t inactive, svbool_t pg, svint32_t op) + /// SCVTF Ztied.D, Pg/M, Zop.S + /// svfloat64_t svcvt_f64[_s32]_x(svbool_t pg, svint32_t op) + /// SCVTF Ztied.D, Pg/M, Ztied.S + /// svfloat64_t svcvt_f64[_s32]_z(svbool_t pg, svint32_t op) + /// + public static unsafe Vector ConvertToDouble(Vector value) { throw new PlatformNotSupportedException(); } + + /// + /// svfloat64_t svcvt_f64[_s64]_m(svfloat64_t inactive, svbool_t pg, svint64_t op) + /// SCVTF Ztied.D, Pg/M, Zop.D + /// svfloat64_t svcvt_f64[_s64]_x(svbool_t pg, svint64_t op) + /// SCVTF Ztied.D, Pg/M, Ztied.D + /// svfloat64_t svcvt_f64[_s64]_z(svbool_t pg, svint64_t op) + /// + public static unsafe Vector ConvertToDouble(Vector value) { throw new PlatformNotSupportedException(); } + + /// + /// svfloat64_t svcvt_f64[_f32]_m(svfloat64_t inactive, svbool_t pg, svfloat32_t op) + /// FCVT Ztied.D, Pg/M, Zop.S + /// svfloat64_t svcvt_f64[_f32]_x(svbool_t pg, svfloat32_t op) + /// FCVT Ztied.D, Pg/M, Ztied.S + /// svfloat64_t svcvt_f64[_f32]_z(svbool_t pg, svfloat32_t op) + /// + public static unsafe Vector ConvertToDouble(Vector value) { throw new PlatformNotSupportedException(); } + + /// + /// svfloat64_t svcvt_f64[_u32]_m(svfloat64_t inactive, svbool_t pg, svuint32_t op) + /// UCVTF Ztied.D, Pg/M, Zop.S + /// svfloat64_t svcvt_f64[_u32]_x(svbool_t pg, svuint32_t op) + /// UCVTF Ztied.D, Pg/M, Ztied.S + /// svfloat64_t svcvt_f64[_u32]_z(svbool_t pg, svuint32_t op) + /// + public static unsafe Vector ConvertToDouble(Vector value) { throw new PlatformNotSupportedException(); } + + /// + /// svfloat64_t svcvt_f64[_u64]_m(svfloat64_t inactive, svbool_t pg, svuint64_t op) + /// UCVTF Ztied.D, Pg/M, Zop.D + /// svfloat64_t svcvt_f64[_u64]_x(svbool_t pg, svuint64_t op) + /// UCVTF Ztied.D, Pg/M, Ztied.D + /// svfloat64_t svcvt_f64[_u64]_z(svbool_t pg, svuint64_t op) + /// + public static unsafe Vector ConvertToDouble(Vector value) { throw new PlatformNotSupportedException(); } + + /// ConvertToInt32 : Floating-point convert /// @@ -1920,6 +1968,55 @@ internal Arm64() { } /// public static unsafe Vector ConvertToInt64(Vector value) { throw new PlatformNotSupportedException(); } + + /// ConvertToSingle : Floating-point convert + + /// + /// svfloat32_t svcvt_f32[_f64]_m(svfloat32_t inactive, svbool_t pg, svfloat64_t op) + /// FCVT Ztied.S, Pg/M, Zop.D + /// svfloat32_t svcvt_f32[_f64]_x(svbool_t pg, svfloat64_t op) + /// FCVT Ztied.S, Pg/M, Ztied.D + /// svfloat32_t svcvt_f32[_f64]_z(svbool_t pg, svfloat64_t op) + /// + public static unsafe Vector ConvertToSingle(Vector value) { throw new PlatformNotSupportedException(); } + + /// + /// svfloat32_t svcvt_f32[_s32]_m(svfloat32_t inactive, svbool_t pg, svint32_t op) + /// SCVTF Ztied.S, Pg/M, Zop.S + /// svfloat32_t svcvt_f32[_s32]_x(svbool_t pg, svint32_t op) + /// SCVTF Ztied.S, Pg/M, Ztied.S + /// svfloat32_t svcvt_f32[_s32]_z(svbool_t pg, svint32_t op) + /// + public static unsafe Vector ConvertToSingle(Vector value) { throw new PlatformNotSupportedException(); } + + /// + /// svfloat32_t svcvt_f32[_s64]_m(svfloat32_t inactive, svbool_t pg, svint64_t op) + /// SCVTF Ztied.S, Pg/M, Zop.D + /// svfloat32_t svcvt_f32[_s64]_x(svbool_t pg, svint64_t op) + /// SCVTF Ztied.S, Pg/M, Ztied.D + /// svfloat32_t svcvt_f32[_s64]_z(svbool_t pg, svint64_t op) + /// + public static unsafe Vector ConvertToSingle(Vector value) { throw new PlatformNotSupportedException(); } + + /// + /// svfloat32_t svcvt_f32[_u32]_m(svfloat32_t inactive, svbool_t pg, svuint32_t op) + /// UCVTF Ztied.S, Pg/M, Zop.S + /// svfloat32_t svcvt_f32[_u32]_x(svbool_t pg, svuint32_t op) + /// UCVTF Ztied.S, Pg/M, Ztied.S + /// svfloat32_t svcvt_f32[_u32]_z(svbool_t pg, svuint32_t op) + /// + public static unsafe Vector ConvertToSingle(Vector value) { throw new PlatformNotSupportedException(); } + + /// + /// svfloat32_t svcvt_f32[_u64]_m(svfloat32_t inactive, svbool_t pg, svuint64_t op) + /// UCVTF Ztied.S, Pg/M, Zop.D + /// svfloat32_t svcvt_f32[_u64]_x(svbool_t pg, svuint64_t op) + /// UCVTF Ztied.S, Pg/M, Ztied.D + /// svfloat32_t svcvt_f32[_u64]_z(svbool_t pg, svuint64_t op) + /// + public static unsafe Vector ConvertToSingle(Vector value) { throw new PlatformNotSupportedException(); } + + /// ConvertToUInt32 : Floating-point convert /// diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve.cs index 73d4c556249fb..e7dc14f3a3f2c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve.cs @@ -1937,6 +1937,54 @@ internal Arm64() { } public static unsafe Vector ConditionalSelect(Vector mask, Vector left, Vector right) => ConditionalSelect(mask, left, right); + /// ConvertToDouble : Floating-point convert + + /// + /// svfloat64_t svcvt_f64[_s32]_m(svfloat64_t inactive, svbool_t pg, svint32_t op) + /// SCVTF Ztied.D, Pg/M, Zop.S + /// svfloat64_t svcvt_f64[_s32]_x(svbool_t pg, svint32_t op) + /// SCVTF Ztied.D, Pg/M, Ztied.S + /// svfloat64_t svcvt_f64[_s32]_z(svbool_t pg, svint32_t op) + /// + public static unsafe Vector ConvertToDouble(Vector value) => ConvertToDouble(value); + + /// + /// svfloat64_t svcvt_f64[_s64]_m(svfloat64_t inactive, svbool_t pg, svint64_t op) + /// SCVTF Ztied.D, Pg/M, Zop.D + /// svfloat64_t svcvt_f64[_s64]_x(svbool_t pg, svint64_t op) + /// SCVTF Ztied.D, Pg/M, Ztied.D + /// svfloat64_t svcvt_f64[_s64]_z(svbool_t pg, svint64_t op) + /// + public static unsafe Vector ConvertToDouble(Vector value) => ConvertToDouble(value); + + /// + /// svfloat64_t svcvt_f64[_f32]_m(svfloat64_t inactive, svbool_t pg, svfloat32_t op) + /// FCVT Ztied.D, Pg/M, Zop.S + /// svfloat64_t svcvt_f64[_f32]_x(svbool_t pg, svfloat32_t op) + /// FCVT Ztied.D, Pg/M, Ztied.S + /// svfloat64_t svcvt_f64[_f32]_z(svbool_t pg, svfloat32_t op) + /// + public static unsafe Vector ConvertToDouble(Vector value) => ConvertToDouble(value); + + /// + /// svfloat64_t svcvt_f64[_u32]_m(svfloat64_t inactive, svbool_t pg, svuint32_t op) + /// UCVTF Ztied.D, Pg/M, Zop.S + /// svfloat64_t svcvt_f64[_u32]_x(svbool_t pg, svuint32_t op) + /// UCVTF Ztied.D, Pg/M, Ztied.S + /// svfloat64_t svcvt_f64[_u32]_z(svbool_t pg, svuint32_t op) + /// + public static unsafe Vector ConvertToDouble(Vector value) => ConvertToDouble(value); + + /// + /// svfloat64_t svcvt_f64[_u64]_m(svfloat64_t inactive, svbool_t pg, svuint64_t op) + /// UCVTF Ztied.D, Pg/M, Zop.D + /// svfloat64_t svcvt_f64[_u64]_x(svbool_t pg, svuint64_t op) + /// UCVTF Ztied.D, Pg/M, Ztied.D + /// svfloat64_t svcvt_f64[_u64]_z(svbool_t pg, svuint64_t op) + /// + public static unsafe Vector ConvertToDouble(Vector value) => ConvertToDouble(value); + + /// ConvertToInt32 : Floating-point convert /// @@ -1979,6 +2027,54 @@ internal Arm64() { } public static unsafe Vector ConvertToInt64(Vector value) => ConvertToInt64(value); + /// ConvertToSingle : Floating-point convert + + /// + /// svfloat32_t svcvt_f32[_f64]_m(svfloat32_t inactive, svbool_t pg, svfloat64_t op) + /// FCVT Ztied.S, Pg/M, Zop.D + /// svfloat32_t svcvt_f32[_f64]_x(svbool_t pg, svfloat64_t op) + /// FCVT Ztied.S, Pg/M, Ztied.D + /// svfloat32_t svcvt_f32[_f64]_z(svbool_t pg, svfloat64_t op) + /// + public static unsafe Vector ConvertToSingle(Vector value) => ConvertToSingle(value); + + /// + /// svfloat32_t svcvt_f32[_s32]_m(svfloat32_t inactive, svbool_t pg, svint32_t op) + /// SCVTF Ztied.S, Pg/M, Zop.S + /// svfloat32_t svcvt_f32[_s32]_x(svbool_t pg, svint32_t op) + /// SCVTF Ztied.S, Pg/M, Ztied.S + /// svfloat32_t svcvt_f32[_s32]_z(svbool_t pg, svint32_t op) + /// + public static unsafe Vector ConvertToSingle(Vector value) => ConvertToSingle(value); + + /// + /// svfloat32_t svcvt_f32[_s64]_m(svfloat32_t inactive, svbool_t pg, svint64_t op) + /// SCVTF Ztied.S, Pg/M, Zop.D + /// svfloat32_t svcvt_f32[_s64]_x(svbool_t pg, svint64_t op) + /// SCVTF Ztied.S, Pg/M, Ztied.D + /// svfloat32_t svcvt_f32[_s64]_z(svbool_t pg, svint64_t op) + /// + public static unsafe Vector ConvertToSingle(Vector value) => ConvertToSingle(value); + + /// + /// svfloat32_t svcvt_f32[_u32]_m(svfloat32_t inactive, svbool_t pg, svuint32_t op) + /// UCVTF Ztied.S, Pg/M, Zop.S + /// svfloat32_t svcvt_f32[_u32]_x(svbool_t pg, svuint32_t op) + /// UCVTF Ztied.S, Pg/M, Ztied.S + /// svfloat32_t svcvt_f32[_u32]_z(svbool_t pg, svuint32_t op) + /// + public static unsafe Vector ConvertToSingle(Vector value) => ConvertToSingle(value); + + /// + /// svfloat32_t svcvt_f32[_u64]_m(svfloat32_t inactive, svbool_t pg, svuint64_t op) + /// UCVTF Ztied.S, Pg/M, Zop.D + /// svfloat32_t svcvt_f32[_u64]_x(svbool_t pg, svuint64_t op) + /// UCVTF Ztied.S, Pg/M, Ztied.D + /// svfloat32_t svcvt_f32[_u64]_z(svbool_t pg, svuint64_t op) + /// + public static unsafe Vector ConvertToSingle(Vector value) => ConvertToSingle(value); + + /// ConvertToUInt32 : Floating-point convert /// 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 419dee05737bd..fc632d99b3387 100644 --- a/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs +++ b/src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs @@ -4610,10 +4610,20 @@ internal Arm64() { } public static System.Numerics.Vector ConditionalSelect(System.Numerics.Vector mask, System.Numerics.Vector left, System.Numerics.Vector right) { throw null; } public static System.Numerics.Vector ConditionalSelect(System.Numerics.Vector mask, System.Numerics.Vector left, System.Numerics.Vector right) { throw null; } + public static System.Numerics.Vector ConvertToDouble(System.Numerics.Vector value) { throw null; } + public static System.Numerics.Vector ConvertToDouble(System.Numerics.Vector value) { throw null; } + public static System.Numerics.Vector ConvertToDouble(System.Numerics.Vector value) { throw null; } + public static System.Numerics.Vector ConvertToDouble(System.Numerics.Vector value) { throw null; } + public static System.Numerics.Vector ConvertToDouble(System.Numerics.Vector value) { throw null; } public static System.Numerics.Vector ConvertToInt32(System.Numerics.Vector value) { throw null; } public static System.Numerics.Vector ConvertToInt32(System.Numerics.Vector value) { throw null; } public static System.Numerics.Vector ConvertToInt64(System.Numerics.Vector value) { throw null; } public static System.Numerics.Vector ConvertToInt64(System.Numerics.Vector value) { throw null; } + public static System.Numerics.Vector ConvertToSingle(System.Numerics.Vector value) { throw null; } + public static System.Numerics.Vector ConvertToSingle(System.Numerics.Vector value) { throw null; } + public static System.Numerics.Vector ConvertToSingle(System.Numerics.Vector value) { throw null; } + public static System.Numerics.Vector ConvertToSingle(System.Numerics.Vector value) { throw null; } + public static System.Numerics.Vector ConvertToSingle(System.Numerics.Vector value) { throw null; } public static System.Numerics.Vector ConvertToUInt32(System.Numerics.Vector value) { throw null; } public static System.Numerics.Vector ConvertToUInt32(System.Numerics.Vector value) { throw null; } public static System.Numerics.Vector ConvertToUInt64(System.Numerics.Vector value) { throw null; } diff --git a/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs b/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs index 2abaf62dcd680..c20d6c8dd1bf5 100644 --- a/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs +++ b/src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs @@ -139,9 +139,9 @@ }"; const string SimpleVecOpTest_VectorValidationLogicForCndSel = @" - { - {Op1BaseType}[] vectorResult = {GetVectorResult}; - {Op1BaseType}[] maskedVectorResult = new {RetBaseType}[vectorResult.Length]; + + {RetBaseType}[] vectorResult = {GetVectorResult}; + {RetBaseType}[] maskedVectorResult = new {RetBaseType}[vectorResult.Length]; for (var i = 0; i < vectorResult.Length; i++) { @@ -152,16 +152,16 @@ { succeeded = false; } - }"; + "; const string SimpleVecOpTest_VectorValidationLogicForCndSel_FalseValue = @" { - {Op1BaseType}[] vectorResult = {GetVectorResult}; - {Op1BaseType}[] maskedVectorResult = new {RetBaseType}[vectorResult.Length]; + {RetBaseType}[] vectorResult = {GetVectorResult}; + {RetBaseType}[] maskedVectorResult = new {RetBaseType}[vectorResult.Length]; for (var i = 0; i < vectorResult.Length; i++) { - {Op1BaseType} iterResult = (mask[i] != 0) ? trueVal[i] : vectorResult[i]; + {RetBaseType} iterResult = (mask[i] != 0) ? trueVal[i] : vectorResult[i]; if (mask[i] != 0) { // Pick the trueValue @@ -271,7 +271,8 @@ ("_BinaryOpTestTemplate.template", "SecureHashBinOpTest.template", new Dictionary { ["TemplateName"] = "SecureHash", ["TemplateValidationLogic"] = SecureHashOpTest_ValidationLogic }), ("_TernaryOpTestTemplate.template", "SecureHashTernOpTest.template", new Dictionary { ["TemplateName"] = "SecureHash", ["TemplateValidationLogic"] = SecureHashOpTest_ValidationLogic }), ("_SveUnaryOpTestTemplate.template", "SveSimpleVecOpTest.template", new Dictionary { ["TemplateName"] = "Simple", ["TemplateValidationLogic"] = SimpleVecOpTest_ValidationLogic, ["TemplateValidationLogicForCndSel"] = SimpleVecOpTest_ValidationLogicForCndSel, ["TemplateValidationLogicForCndSel_FalseValue"] = SimpleVecOpTest_ValidationLogicForCndSel_FalseValue }), - ("_SveUnaryOpDifferentRetTypeTestTemplate.template", "SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary { ["TemplateName"] = "Simple", ["TemplateValidationLogic"] = SimpleVecOpTest_ValidationLogicForNarrowing, ["TemplateValidationLogicForCndSel"] = SimpleVecOpTest_ValidationLogicForCndSelForNarrowing, ["TemplateValidationLogicForCndSel_FalseValue"] = SimpleVecOpTest_ValidationLogicForCndSelForNarrowing_FalseValue }), + ("_SveUnaryOpDifferentRetTypeTestTemplate.template", "SveSimpleVecOpDiffRetTypeTest.template", new Dictionary { ["TemplateName"] = "Simple", ["TemplateValidationLogic"] = SimpleVecOpTest_ValidationLogicForNarrowing, ["TemplateValidationLogicForCndSel"] = SimpleVecOpTest_ValidationLogicForCndSelForNarrowing, ["TemplateValidationLogicForCndSel_FalseValue"] = SimpleVecOpTest_ValidationLogicForCndSelForNarrowing_FalseValue }), + ("_SveUnaryOpDifferentRetTypeTestTemplate.template", "SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TemplateName"] = "Simple", ["TemplateValidationLogic"] = SimpleVecOpTest_VectorValidationLogic, ["TemplateValidationLogicForCndSel"] = SimpleVecOpTest_VectorValidationLogicForCndSel, ["TemplateValidationLogicForCndSel_FalseValue"] = SimpleVecOpTest_VectorValidationLogicForCndSel_FalseValue }), ("_SveBinaryOpTestTemplate.template", "SveVecBinOpTest.template", new Dictionary { ["TemplateName"] = "Simple", ["TemplateValidationLogic"] = SimpleVecOpTest_ValidationLogic, ["TemplateValidationLogicForCndSel"] = SimpleVecOpTest_ValidationLogicForCndSel, ["TemplateValidationLogicForCndSel_FalseValue"] = SimpleVecOpTest_ValidationLogicForCndSel_FalseValue }), ("_SveBinaryOpTestTemplate.template", "SveVecBinOpVecTest.template", new Dictionary { ["TemplateName"] = "Simple", ["TemplateValidationLogic"] = SimpleVecOpTest_VectorValidationLogic, ["TemplateValidationLogicForCndSel"] = SimpleVecOpTest_VectorValidationLogicForCndSel, ["TemplateValidationLogicForCndSel_FalseValue"] = SimpleVecOpTest_VectorValidationLogicForCndSel_FalseValue }), ("_SveBinaryOpTestTemplate.template", "SveVecBinOpConvertTest.template", new Dictionary { ["TemplateName"] = "Simple", ["TemplateValidationLogic"] = SimpleVecOpTest_ValidationLogic, ["TemplateValidationLogicForCndSel"] = SimpleTernVecOpTest_ValidationLogicForCndSel, ["TemplateValidationLogicForCndSel_FalseValue"] = SimpleTernVecOpTest_ValidationLogicForCndSel_FalseValue }), @@ -3272,14 +3273,24 @@ ("SveConditionalSelect.template", new Dictionary { ["TestName"] = "Sve_ConditionalSelect_uint", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConditionalSelect", ["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()", ["ValidateIterResult"] = "(firstOp[i] != 0 ? (result[i] != secondOp[i]) : (result[i] != thirdOp[i]))",}), ("SveConditionalSelect.template", new Dictionary { ["TestName"] = "Sve_ConditionalSelect_ulong", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConditionalSelect", ["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()", ["ValidateIterResult"] = "(firstOp[i] != 0 ? (result[i] != secondOp[i]) : (result[i] != thirdOp[i]))",}), - ("SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary { ["TestName"] = "Sve_ConvertToInt32_int_float", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToInt32", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateIterResult"] = "Helpers.ConvertToInt32(firstOp[i]) != result[i]", ["GetIterResult"] = "Helpers.ConvertToInt32(leftOp[i])", ["ConvertFunc"] = ""}), - ("SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary { ["TestName"] = "Sve_ConvertToInt32_int_double", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToInt32", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateIterResult"] = "Helpers.ConvertDoubleToInt32(firstOp[i]) != result[i]", ["GetIterResult"] = "Helpers.ConvertDoubleToInt32(leftOp[i])", ["ConvertFunc"] = ""}), - ("SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary { ["TestName"] = "Sve_ConvertToInt64_long_float", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateIterResult"] = "Helpers.ConvertFloatToInt64(firstOp[i]) != result[i]", ["GetIterResult"] = "Helpers.ConvertFloatToInt64(leftOp[i])", ["ConvertFunc"] = ""}), - ("SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary { ["TestName"] = "Sve_ConvertToInt64_long_double", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateIterResult"] = "Helpers.ConvertToInt64(firstOp[i]) != result[i]", ["GetIterResult"] = "Helpers.ConvertToInt64(leftOp[i])", ["ConvertFunc"] = ""}), - ("SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary { ["TestName"] = "Sve_ConvertToUInt32_uint_float", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToUInt32", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateIterResult"] = "Helpers.ConvertToUInt32(firstOp[i]) != result[i]", ["GetIterResult"] = "Helpers.ConvertToUInt32(leftOp[i])", ["ConvertFunc"] = ""}), - ("SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary { ["TestName"] = "Sve_ConvertToUInt32_uint_double", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToUInt32", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateIterResult"] = "Helpers.ConvertDoubleToUInt32(firstOp[i]) != result[i]", ["GetIterResult"] = "Helpers.ConvertDoubleToUInt32(leftOp[i])", ["ConvertFunc"] = ""}), - ("SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary { ["TestName"] = "Sve_ConvertToUInt64_ulong_float", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToUInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateIterResult"] = "Helpers.ConvertFloatToUInt64(firstOp[i]) != result[i]", ["GetIterResult"] = "Helpers.ConvertFloatToUInt64(leftOp[i])", ["ConvertFunc"] = ""}), - ("SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary { ["TestName"] = "Sve_ConvertToUInt64_ulong_double", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToUInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateIterResult"] = "Helpers.ConvertToUInt64(firstOp[i]) != result[i]", ["GetIterResult"] = "Helpers.ConvertToUInt64(leftOp[i])", ["ConvertFunc"] = ""}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToDouble_double_float", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToDouble", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToDouble(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToDouble(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToDouble_double_int", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToDouble", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToDouble(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToDouble(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToDouble_double_long", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToDouble", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToDouble(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToDouble(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToDouble_double_uint", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToDouble", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToDouble(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToDouble(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToDouble_double_ulong", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToDouble", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToDouble(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToDouble(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToInt32_int_float", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToInt32", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToInt32(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToInt32(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToInt32_int_double", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToInt32", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToInt32(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToInt32(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToInt64_long_float", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToInt64(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToInt64(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToInt64_long_double", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToInt64(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToInt64(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToSingle_float_int", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToSingle", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToSingle(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToSingle(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToSingle_float_double", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToSingle", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToSingle(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToSingle(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToSingle_float_long", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToSingle", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToSingle(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToSingle(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToSingle_float_uint", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToSingle", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToSingle(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToSingle(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToSingle_float_ulong", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToSingle", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToSingle(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToSingle(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToUInt32_uint_float", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToUInt32", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToUInt32(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToUInt32(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToUInt32_uint_double", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToUInt32", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToUInt32(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToUInt32(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToUInt64_ulong_float", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToUInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToUInt64(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToUInt64(left)"}), + ("SveSimpleVecOpDiffRetTypeTestVec.template", new Dictionary { ["TestName"] = "Sve_ConvertToUInt64_ulong_double", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToUInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.ConvertToUInt64(firstOp))", ["GetVectorResult"] = "Helpers.ConvertToUInt64(left)"}), ("ScalarUnOpTest.template", new Dictionary { ["TestName"] = "Sve_Count16BitElements", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "Count16BitElements", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "SveMaskPattern", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "SveMaskPattern.All", ["ValidateResult"] = "isUnexpectedResult = (result != (UInt64)(Unsafe.SizeOf>() / sizeof(Int16)));",}), ("ScalarUnOpTest.template", new Dictionary { ["TestName"] = "Sve_Count32BitElements", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "Count32BitElements", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "SveMaskPattern", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "SveMaskPattern.All", ["ValidateResult"] = "isUnexpectedResult = (result != (UInt64)(Unsafe.SizeOf>() / sizeof(Int32)));",}), @@ -3481,8 +3492,8 @@ ("SveVecBinOpVecTest.template", new Dictionary { ["TestName"] = "Sve_CreateMaskForNextActiveElement_uint", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "CreateMaskForNextActiveElement", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "Helpers.getMaskUInt32()", ["NextValueOp2"] = "Helpers.getMaskUInt32()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.CreateMaskForNextActiveElement(left, right))", ["GetVectorResult"] = "Helpers.CreateMaskForNextActiveElement(left, right)"}), ("SveVecBinOpVecTest.template", new Dictionary { ["TestName"] = "Sve_CreateMaskForNextActiveElement_ulong", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "CreateMaskForNextActiveElement", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "Helpers.getMaskUInt64()", ["NextValueOp2"] = "Helpers.getMaskUInt64()", ["ValidateVectorResult"] = "!result.SequenceEqual(Helpers.CreateMaskForNextActiveElement(left, right))", ["GetVectorResult"] = "Helpers.CreateMaskForNextActiveElement(left, right)"}), - ("SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary {["TestName"] = "Sve_FloatingPointExponentialAccelerator_float_uint", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "FloatingPointExponentialAccelerator", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateIterResult"] = "BitConverter.SingleToInt32Bits(Helpers.FPExponentialAccelerator(firstOp[i])) != BitConverter.SingleToInt32Bits(result[i])", ["GetIterResult"] = "Helpers.FPExponentialAccelerator(leftOp[i])", ["ConvertFunc"] = "BitConverter.SingleToInt32Bits"}), - ("SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary {["TestName"] = "Sve_FloatingPointExponentialAccelerator_double_ulong", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "FloatingPointExponentialAccelerator", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateIterResult"] = "BitConverter.DoubleToInt64Bits(Helpers.FPExponentialAccelerator(firstOp[i])) != BitConverter.DoubleToInt64Bits(result[i])", ["GetIterResult"] = "Helpers.FPExponentialAccelerator(leftOp[i])", ["ConvertFunc"] = "BitConverter.DoubleToInt64Bits"}), + ("SveSimpleVecOpDiffRetTypeTest.template", new Dictionary {["TestName"] = "Sve_FloatingPointExponentialAccelerator_float_uint", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "FloatingPointExponentialAccelerator", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateIterResult"] = "BitConverter.SingleToInt32Bits(Helpers.FPExponentialAccelerator(firstOp[i])) != BitConverter.SingleToInt32Bits(result[i])", ["GetIterResult"] = "Helpers.FPExponentialAccelerator(leftOp[i])", ["ConvertFunc"] = "BitConverter.SingleToInt32Bits"}), + ("SveSimpleVecOpDiffRetTypeTest.template", new Dictionary {["TestName"] = "Sve_FloatingPointExponentialAccelerator_double_ulong", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "FloatingPointExponentialAccelerator", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateIterResult"] = "BitConverter.DoubleToInt64Bits(Helpers.FPExponentialAccelerator(firstOp[i])) != BitConverter.DoubleToInt64Bits(result[i])", ["GetIterResult"] = "Helpers.FPExponentialAccelerator(leftOp[i])", ["ConvertFunc"] = "BitConverter.DoubleToInt64Bits"}), ("SveExtractVectorTest.template", new Dictionary { ["TestName"] = "SveExtractVector_Byte_1", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ExtractVector", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["NextValueOp2"] = "TestLibrary.Generator.GetByte()", ["ElementIndex"] = "1", ["ValidateIterResult"] = "Helpers.ExtractVector(firstOp, secondOp, ElementIndex, i) != result[i]"}), ("SveExtractVectorTest.template", new Dictionary { ["TestName"] = "SveExtractVector_Double_1", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ExtractVector", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["NextValueOp2"] = "TestLibrary.Generator.GetDouble()", ["ElementIndex"] = "1", ["ValidateIterResult"] = "BitConverter.DoubleToInt64Bits(Helpers.ExtractVector(firstOp, secondOp, ElementIndex, i)) != BitConverter.DoubleToInt64Bits(result[i])"}), diff --git a/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs b/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs index 54ddade391f93..1e3b4c342b1a3 100644 --- a/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs +++ b/src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs @@ -7081,21 +7081,75 @@ public static ulong ShiftRightAndInsert(ulong left, ulong right, byte shift) public static float RoundToZero(float op1) => MathF.Round(op1, MidpointRounding.ToZero); - public static int ConvertDoubleToInt32(double op1) => (int)Math.Clamp(op1, long.MinValue, long.MaxValue); + private static int ConvertToInt32(double op1) => (int)Math.Clamp(op1, int.MinValue, int.MaxValue); - public static int ConvertToInt32(float op1) => (int)Math.Clamp(op1, int.MinValue, int.MaxValue); + public static int[] ConvertToInt32(double[] op1) + { + int[] result = new int[op1.Length * 2]; + + for (int i = 0; i < op1.Length; i++) + { + int index = i * 2; + result[index] = ConvertToInt32(op1[i]); + if (op1[i] < 0) + { + // Sign-extend next lane with all ones + result[index + 1] = -1; + } + } + + return result; + } + + 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) => (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) + { + long[] result = new long[op1.Length / 2]; + + for (int i = 0; i < result.Length; i++) + { + result[i] = ConvertToInt64(op1[i * 2]); + } + + return result; + } + + private static uint ConvertToUInt32(double op1) => (uint)Math.Clamp(op1, uint.MinValue, uint.MaxValue); + + public static uint[] ConvertToUInt32(double[] op1) + { + uint[] result = new uint[op1.Length * 2]; + + for (int i = 0; i < op1.Length; i++) + { + result[i * 2] = ConvertToUInt32(op1[i]); + } + + return result; + } - public static long ConvertFloatToInt64(float op1) => (long)Math.Clamp(op1, int.MinValue, int.MaxValue); + public static uint[] ConvertToUInt32(float[] op1) => Array.ConvertAll(op1, num => ConvertToUInt32(num)); - public static uint ConvertDoubleToUInt32(double op1) => (uint)Math.Clamp(op1, ulong.MinValue, ulong.MaxValue); + private static ulong ConvertToUInt64(double op1) => (ulong)Math.Clamp(op1, ulong.MinValue, ulong.MaxValue); - public static uint ConvertToUInt32(float op1) => (uint)Math.Clamp(op1, uint.MinValue, uint.MaxValue); + public static ulong[] ConvertToUInt64(double[] op1) => Array.ConvertAll(op1, num => ConvertToUInt64(num)); - public static ulong ConvertToUInt64(double op1) => (ulong)Math.Clamp(op1, ulong.MinValue, ulong.MaxValue); + public static ulong[] ConvertToUInt64(float[] op1) + { + ulong[] result = new ulong[op1.Length / 2]; + + for (int i = 0; i < result.Length; i++) + { + result[i] = ConvertToUInt64(op1[i * 2]); + } - public static ulong ConvertFloatToUInt64(float op1) => (ulong)Math.Clamp(op1, uint.MinValue, uint.MaxValue); + return result; + } public static Int32 ConvertToInt32RoundAwayFromZero(float op1) => ConvertToInt32(RoundAwayFromZero(op1)); @@ -7143,16 +7197,96 @@ public static ulong ShiftRightAndInsert(ulong left, ulong right, byte shift) public static float ConvertToSingle(double op1) => (float)op1; + public static float[] ConvertToSingle(double[] op1) + { + float[] result = new float[op1.Length * 2]; + + for (int i = 0; i < op1.Length; i++) + { + result[i * 2] = (float)op1[i]; + } + + return result; + } + + public static float[] ConvertToSingle(int[] op1) => Array.ConvertAll(op1, num => (float)num); + + public static float[] ConvertToSingle(long[] op1) + { + float[] result = new float[op1.Length * 2]; + + for (int i = 0; i < op1.Length; i++) + { + result[i * 2] = (float)op1[i]; + } + + return result; + } + + public static float[] ConvertToSingle(uint[] op1) => Array.ConvertAll(op1, num => (float)num); + + public static float[] ConvertToSingle(ulong[] op1) + { + float[] result = new float[op1.Length * 2]; + + for (int i = 0; i < op1.Length; i++) + { + result[i * 2] = (float)op1[i]; + } + + return result; + } + public static float ConvertToSingleUpper(float[] op1, double[] op2, int i) => i < op1.Length ? op1[i] : ConvertToSingle(op2[i - op1.Length]); public static double ConvertToDouble(float op1) => op1; - public static double ConvertToDoubleUpper(float[] op1, int i) => ConvertToDouble(op1[i + op1.Length / 2]); - public static double ConvertToDouble(long op1) => op1; public static double ConvertToDouble(ulong op1) => op1; + public static double[] ConvertToDouble(float[] op1) + { + double[] result = new double[op1.Length / 2]; + + for (int i = 0; i < result.Length; i++) + { + result[i] = op1[i * 2]; + } + + return result; + } + + public static double[] ConvertToDouble(int[] op1) + { + double[] result = new double[op1.Length / 2]; + + for (int i = 0; i < result.Length; i++) + { + result[i] = op1[i * 2]; + } + + return result; + } + + public static double[] ConvertToDouble(long[] op1) => Array.ConvertAll(op1, num => (double)num); + + public static double[] ConvertToDouble(uint[] op1) + { + double[] result = new double[op1.Length / 2]; + + for (int i = 0; i < result.Length; i++) + { + result[i] = op1[i * 2]; + } + + return result; + } + + public static double[] ConvertToDouble(ulong[] op1) => Array.ConvertAll(op1, num => (double)num); + + public static double ConvertToDoubleUpper(float[] op1, int i) => ConvertToDouble(op1[i + op1.Length / 2]); + public static short ReverseElement8(short val) { ulong result = 0UL; diff --git a/src/tests/JIT/HardwareIntrinsics/Arm/Shared/_SveUnaryOpDifferentRetTypeTestTemplate.template b/src/tests/JIT/HardwareIntrinsics/Arm/Shared/_SveUnaryOpDifferentRetTypeTestTemplate.template index e08a215ae18f0..56a0d8bfb3a2f 100644 --- a/src/tests/JIT/HardwareIntrinsics/Arm/Shared/_SveUnaryOpDifferentRetTypeTestTemplate.template +++ b/src/tests/JIT/HardwareIntrinsics/Arm/Shared/_SveUnaryOpDifferentRetTypeTestTemplate.template @@ -9,6 +9,7 @@ ******************************************************************************/ using System; +using System.Linq; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -51,11 +52,14 @@ namespace JIT.HardwareIntrinsics.Arm // Validates passing an instance member of a struct works test.RunStructFldScenario(); - // Validates executing the test inside conditional, with op3 as falseValue - test.ConditionalSelect_FalseOp(); + if (sizeof({Op1BaseType}) == sizeof({RetBaseType})) + { + // Validates executing the test inside conditional, with op3 as falseValue + test.ConditionalSelect_FalseOp(); - // Validates executing the test inside conditional, with op3 as zero - test.ConditionalSelect_ZeroOp(); + // Validates executing the test inside conditional, with op3 as zero + test.ConditionalSelect_ZeroOp(); + } } else { @@ -143,6 +147,7 @@ namespace JIT.HardwareIntrinsics.Arm private static readonly int LargestVectorSize = {LargestVectorSize}; private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType}); + private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType}); private static {Op1BaseType}[] _data1 = new {Op1BaseType}[Op1ElementCount]; private static {RetBaseType}[] _data2 = new {RetBaseType}[Op1ElementCount]; @@ -165,7 +170,7 @@ namespace JIT.HardwareIntrinsics.Arm Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{RetBaseType}>, byte>(ref _falseFld), ref Unsafe.As<{RetBaseType}, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{RetBaseType}>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; } - _dataTable = new DataTable(_data1, new {RetBaseType}[Op1ElementCount], LargestVectorSize); + _dataTable = new DataTable(_data1, new {RetBaseType}[RetElementCount], LargestVectorSize); } public bool IsSupported => {Isa}.IsSupported; @@ -334,10 +339,10 @@ namespace JIT.HardwareIntrinsics.Arm private void ValidateConditionalSelectResult_TrueValue({Op1VectorType}<{RetBaseType}> maskOp, {Op1VectorType}<{Op1BaseType}> leftOp, {Op1VectorType}<{RetBaseType}> falseOp, void* output, [CallerMemberName] string method = "") { - {RetBaseType}[] mask = new {RetBaseType}[Op1ElementCount]; + {RetBaseType}[] mask = new {RetBaseType}[RetElementCount]; {Op1BaseType}[] left = new {Op1BaseType}[Op1ElementCount]; - {RetBaseType}[] falseVal = new {RetBaseType}[Op1ElementCount]; - {RetBaseType}[] result = new {RetBaseType}[Op1ElementCount]; + {RetBaseType}[] falseVal = new {RetBaseType}[RetElementCount]; + {RetBaseType}[] result = new {RetBaseType}[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref mask[0]), maskOp); Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref left[0]), leftOp); @@ -350,7 +355,7 @@ namespace JIT.HardwareIntrinsics.Arm if (!succeeded) { - TestLibrary.TestFramework.LogInformation($"{nameof({Isa})}.{nameof({Isa}.{Method})}<{RetBaseType}>({Op1VectorType}<{Op1BaseType}>, {Op1VectorType}<{Op1BaseType}>): {method} failed:"); + TestLibrary.TestFramework.LogInformation($"{nameof({Isa})}.{nameof({Isa}.{Method})}<{RetBaseType}>({Op1VectorType}<{Op1BaseType}>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" mask: ({string.Join(", ", mask)})"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" falseOp: ({string.Join(", ", falseVal)})"); @@ -363,10 +368,10 @@ namespace JIT.HardwareIntrinsics.Arm private void ValidateConditionalSelectResult_FalseValue({Op1VectorType}<{RetBaseType}> maskOp, {Op1VectorType}<{Op1BaseType}> leftOp, {Op1VectorType}<{RetBaseType}> trueOp, void* output, [CallerMemberName] string method = "") { - {RetBaseType}[] mask = new {RetBaseType}[Op1ElementCount]; + {RetBaseType}[] mask = new {RetBaseType}[RetElementCount]; {Op1BaseType}[] left = new {Op1BaseType}[Op1ElementCount]; - {RetBaseType}[] trueVal = new {RetBaseType}[Op1ElementCount]; - {RetBaseType}[] result = new {RetBaseType}[Op1ElementCount]; + {RetBaseType}[] trueVal = new {RetBaseType}[RetElementCount]; + {RetBaseType}[] result = new {RetBaseType}[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref mask[0]), maskOp); Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref left[0]), leftOp); @@ -393,7 +398,7 @@ namespace JIT.HardwareIntrinsics.Arm private void ValidateResult({Op1VectorType}<{Op1BaseType}> op1, void* result, [CallerMemberName] string method = "") { {Op1BaseType}[] inArray1 = new {Op1BaseType}[Op1ElementCount]; - {RetBaseType}[] outArray = new {RetBaseType}[Op1ElementCount]; + {RetBaseType}[] outArray = new {RetBaseType}[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>()); @@ -404,7 +409,7 @@ namespace JIT.HardwareIntrinsics.Arm private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "") { {Op1BaseType}[] inArray1 = new {Op1BaseType}[Op1ElementCount]; - {RetBaseType}[] outArray = new {RetBaseType}[Op1ElementCount]; + {RetBaseType}[] outArray = new {RetBaseType}[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef(op1), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());