summaryrefslogtreecommitdiff
path: root/tests/src/JIT
diff options
context:
space:
mode:
authorTanner Gooding <tagoo@outlook.com>2018-11-17 10:24:58 -0800
committerGitHub <noreply@github.com>2018-11-17 10:24:58 -0800
commit29f8190aabac62ece90b666591b50aeb0605dd9d (patch)
tree61df53be7b0a4cac050fbd98b9abb56e94b1f14a /tests/src/JIT
parent3d64a3b3c34866358072ce21579052f37f833050 (diff)
downloadcoreclr-29f8190aabac62ece90b666591b50aeb0605dd9d.tar.gz
coreclr-29f8190aabac62ece90b666591b50aeb0605dd9d.tar.bz2
coreclr-29f8190aabac62ece90b666591b50aeb0605dd9d.zip
Removing the legacy helper intrinsics and adding tests for their replacements (#20994)
* Removing helper intrinsics from the x86 APIs in S.P.Corelib * Removing JIT support for the removed x86 helper intrinsics * Removing the x86 HardwareIntrinsics tests for the removed helper APIs * Fixing up existing usages to no longer use the removed x86 helper intrinsics * Skip CoreFX tests dependent on the removed x86 helper intrinsics * Adding a GenerateTests.csx and templates for the new shared helper intrinsics * Generating the new shared helper intrinsics from their templates * Disabling some tests for arm and arm64 that are failing due to an assert
Diffstat (limited to 'tests/src/JIT')
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_r.csproj164
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_ro.csproj164
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Program.NotSupported.cs147
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsByte.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsDouble.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Byte.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Double.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Int16.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Int32.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Int64.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_SByte.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Single.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_UInt16.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_UInt32.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_UInt64.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsInt16.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsInt32.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsInt64.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsSByte.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsSingle.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsUInt16.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsUInt32.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsUInt64.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ByteAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128DoubleAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetElement0.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetElementMaxValue.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetElementNegativeOne.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetLower.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetUpper.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Int16AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Int32AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Int64AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128SByteAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128SingleAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToScalar.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToVector256.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToVector256Unsafe.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128UInt16AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128UInt32AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128UInt64AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithElement0.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithElementMaxValue.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithElementNegativeOne.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithLower.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithUpper.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Zero.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsByte.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsDouble.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Byte.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Double.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Int16.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Int32.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Int64.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_SByte.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Single.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_UInt16.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_UInt32.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_UInt64.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsInt16.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsInt32.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsInt64.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsSByte.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsSingle.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsUInt16.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsUInt32.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsUInt64.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256ByteAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256DoubleAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetElement0.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetElementMaxValue.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetElementNegativeOne.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetLower.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetUpper.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Int16AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Int32AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Int64AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256SByteAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256SingleAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256ToScalar.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256UInt16AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256UInt32AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256UInt64AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithElement0.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithElementMaxValue.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithElementNegativeOne.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithLower.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithUpper.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Zero.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsByte.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsDouble.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Byte.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Double.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Int16.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Int32.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Int64.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_SByte.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Single.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_UInt16.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_UInt32.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_UInt64.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsInt16.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsInt32.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsInt64.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsSByte.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsSingle.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsUInt16.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsUInt32.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsUInt64.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ByteAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64DoubleAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64GetElement0.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64GetElementMaxValue.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64GetElementNegativeOne.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Int16AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Int32AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Int64AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64SByteAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64SingleAsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToScalar.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToVector128.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToVector128Unsafe.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64UInt16AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64UInt32AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64UInt64AsGeneric_Boolean.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64WithElement0.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64WithElementMaxValue.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64WithElementNegativeOne.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Zero.cs41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Shared/GenerateTests.csx622
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Shared/Program.cs86
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Shared/VectorAsTest.template239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Shared/VectorCreateElementTest.template109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Shared/VectorCreateTest.template102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Shared/VectorCreateVectorTest.template115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Shared/VectorExtendTest.template130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Shared/VectorGetAndWithElementTest.template223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Shared/VectorGetAndWithLowerAndUpperTest.template190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Shared/VectorNotSupportedTest.template41
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Shared/VectorToScalarTest.template96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Shared/VectorZeroTest.template93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Byte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Double.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Int16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Int32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Int64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.SByte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Single.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.UInt16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.UInt32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.UInt64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Byte.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Double.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Int16.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Int32.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Int64.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.SByte.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Single.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.UInt16.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.UInt32.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.UInt64.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Byte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Double.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Int16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Int32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Int64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.SByte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Single.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.UInt16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.UInt32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.UInt64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Byte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Double.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Int16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Int32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Int64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.SByte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Single.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.UInt16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.UInt32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.UInt64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Byte.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Double.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Int16.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Int32.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Int64.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.SByte.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Single.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.UInt16.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.UInt32.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.UInt64.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/Program.Vector128.cs68
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/Vector128_r.csproj85
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128/Vector128_ro.csproj85
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Byte.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Double.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int16.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int32.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int64.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.SByte.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Single.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt16.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt32.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt64.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Byte.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Byte.15.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Byte.7.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Double.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Double.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int16.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int16.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int16.7.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int32.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int32.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int32.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int64.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int64.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.SByte.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.SByte.15.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.SByte.7.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Single.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Single.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Single.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt16.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt16.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt16.7.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt32.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt32.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt32.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt64.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt64.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Byte.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Double.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Int16.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Int32.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Int64.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.SByte.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Single.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.UInt16.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.UInt32.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.UInt64.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Program.Vector128_1.cs95
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Byte.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Double.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Int16.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Int32.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Int64.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.SByte.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Single.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.UInt16.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.UInt32.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.UInt64.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Byte.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Double.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Int16.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Int32.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Int64.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.SByte.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Single.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.UInt16.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.UInt32.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.UInt64.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_r.csproj113
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_ro.csproj112
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Byte.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Double.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Int16.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Int32.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Int64.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.SByte.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Single.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.UInt16.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.UInt32.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.UInt64.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Byte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Double.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Int16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Int32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Int64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.SByte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Single.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.UInt16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.UInt32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.UInt64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Byte.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Double.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Int16.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Int32.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Int64.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.SByte.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Single.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.UInt16.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.UInt32.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.UInt64.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Byte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Double.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Int16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Int32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Int64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.SByte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Single.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.UInt16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.UInt32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.UInt64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Byte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Double.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Int16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Int32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Int64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.SByte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Single.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.UInt16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.UInt32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.UInt64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Byte.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Double.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Int16.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Int32.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Int64.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.SByte.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Single.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.UInt16.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.UInt32.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.UInt64.cs115
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/Program.Vector256.cs68
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/Vector256_r.csproj85
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256/Vector256_ro.csproj85
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Byte.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Double.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int16.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int32.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int64.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.SByte.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Single.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt16.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt32.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt64.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.15.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.31.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.7.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Double.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Double.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Double.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.15.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.7.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.7.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int64.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int64.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int64.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.15.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.31.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.7.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.7.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.15.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.7.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.7.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt64.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt64.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt64.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Byte.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Double.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Int16.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Int32.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Int64.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.SByte.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Single.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.UInt16.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.UInt32.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.UInt64.cs190
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Program.Vector256_1.cs95
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Byte.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Double.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Int16.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Int32.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Int64.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.SByte.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Single.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.UInt16.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.UInt32.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.UInt64.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_r.csproj112
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_ro.csproj112
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Byte.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Double.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Int16.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Int32.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Int64.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.SByte.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Single.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.UInt16.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.UInt32.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.UInt64.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Byte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Double.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Int16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Int32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Int64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.SByte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Single.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.UInt16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.UInt32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.UInt64.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Byte.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Int16.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Int32.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.SByte.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Single.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.UInt16.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.UInt32.cs109
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Byte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Int16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Int32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.SByte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Single.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.UInt16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.UInt32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Byte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Int16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Int32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.SByte.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Single.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.UInt16.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.UInt32.cs102
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/Program.Vector64.cs49
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/Vector64_r.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_r.csproj)34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64/Vector64_ro.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/Avx/SetZeroVector256_ro.csproj)34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Byte.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Double.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Int16.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Int32.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Int64.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.SByte.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Single.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.UInt16.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.UInt32.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.UInt64.cs239
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Byte.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Byte.7.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Double.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int16.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int16.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int32.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int32.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int64.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.SByte.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.SByte.7.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Single.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Single.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt16.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt16.3.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt32.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt32.1.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt64.0.cs223
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Program.Vector64_1.cs75
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Byte.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Double.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Int16.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Int32.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Int64.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.SByte.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Single.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.UInt16.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.UInt32.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.UInt64.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Byte.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Double.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Int16.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Int32.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Int64.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.SByte.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Single.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.UInt16.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.UInt32.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.UInt64.cs130
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_r.csproj92
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_ro.csproj92
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Byte.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Double.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Int16.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Int32.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Int64.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.SByte.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Single.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.UInt16.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.UInt32.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.UInt64.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/General/dir.props7
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_r.csproj52
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_ro.csproj52
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToSingle.cs42
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToSingle_r.csproj17
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToSingle_ro.csproj17
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.1.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.20.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.52.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.1.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.22.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.6.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.1.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.19.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.3.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.1.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.11.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.27.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.1.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.22.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.6.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.1.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.19.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.3.cs372
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Byte.cs379
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Double.cs379
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int16.cs379
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int32.cs379
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int64.cs379
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.SByte.cs379
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Single.cs379
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt16.cs379
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt32.cs379
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt64.cs379
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.1.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.20.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.52.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.1.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.11.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.27.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.1.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.22.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.6.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.1.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.19.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.3.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.1.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.20.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.52.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.1.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.11.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.27.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.1.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.22.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.6.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.1.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.19.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.3.cs384
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/Program.Avx.cs52
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256.cs241
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256.cs258
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/SetZeroVector256.cs231
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/SetZeroVector256_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/StaticCast.cs127
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/StaticCast_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx/StaticCast_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_r.csproj1
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_ro.csproj1
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToDouble.Double.cs341
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/GatherMaskVector128.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/GatherMaskVector256.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.Avx2.cs1
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/General/VectorArgs.cs8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/General/VectorArray.cs8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/General/VectorHelpers.cs114
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet.cs78
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/General/VectorUnused.cs10
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx63
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToSingle.cs63
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToSingle_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToSingle_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/SetAllVector128.cs79
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/SetAllVector128_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/SetAllVector128_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/SetScalarVector128.cs75
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/SetScalarVector128_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/SetScalarVector128_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/SetVector128.cs73
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/SetVector128_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/SetVector128_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/SetZeroVector128.cs79
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/SetZeroVector128_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/SetZeroVector128_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast.cs127
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast_ro.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToDouble.Vector128Double.cs341
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/MaskMove.cs4
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Program.Sse2.cs10
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Byte.cs258
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Double.cs258
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int16.cs258
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int32.cs258
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int64.cs258
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.SByte.cs258
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt16.cs258
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt32.cs258
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt64.cs258
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetScalarVector128.cs72
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetScalarVector128_r.csproj36
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetScalarVector128_ro.csproj36
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetVector128.cs312
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetVector128_r.csproj37
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetVector128_ro.csproj37
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetZeroVector128.cs178
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetZeroVector128_r.csproj37
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetZeroVector128_ro.csproj37
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_r.csproj10
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_ro.csproj10
-rw-r--r--tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Camera.cs4
-rw-r--r--tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/ColorPacket.cs8
-rw-r--r--tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Intersections.cs8
-rw-r--r--tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/PacketTracer.cs42
-rw-r--r--tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/PlanePacket.cs4
-rw-r--r--tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Program.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Scene.cs6
-rw-r--r--tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/SpherePacket.cs2
-rw-r--r--tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Surfaces.cs18
-rw-r--r--tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/VectorMath.cs64
-rw-r--r--tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/VectorPacket.cs24
637 files changed, 60653 insertions, 25995 deletions
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_r.csproj b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_r.csproj
new file mode 100644
index 0000000000..ac76cd8853
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_r.csproj
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Embedded</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Vector64Zero.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Boolean.cs" />
+ <Compile Include="Vector64ByteAsGeneric_Boolean.cs" />
+ <Compile Include="Vector64DoubleAsGeneric_Boolean.cs" />
+ <Compile Include="Vector64Int16AsGeneric_Boolean.cs" />
+ <Compile Include="Vector64Int32AsGeneric_Boolean.cs" />
+ <Compile Include="Vector64Int64AsGeneric_Boolean.cs" />
+ <Compile Include="Vector64SByteAsGeneric_Boolean.cs" />
+ <Compile Include="Vector64SingleAsGeneric_Boolean.cs" />
+ <Compile Include="Vector64UInt16AsGeneric_Boolean.cs" />
+ <Compile Include="Vector64UInt32AsGeneric_Boolean.cs" />
+ <Compile Include="Vector64UInt64AsGeneric_Boolean.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Byte.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Double.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Int16.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Int32.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Int64.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_SByte.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Single.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_UInt16.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_UInt32.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_UInt64.cs" />
+ <Compile Include="Vector64BooleanAsByte.cs" />
+ <Compile Include="Vector64BooleanAsDouble.cs" />
+ <Compile Include="Vector64BooleanAsInt16.cs" />
+ <Compile Include="Vector64BooleanAsInt32.cs" />
+ <Compile Include="Vector64BooleanAsInt64.cs" />
+ <Compile Include="Vector64BooleanAsSByte.cs" />
+ <Compile Include="Vector64BooleanAsSingle.cs" />
+ <Compile Include="Vector64BooleanAsUInt16.cs" />
+ <Compile Include="Vector64BooleanAsUInt32.cs" />
+ <Compile Include="Vector64BooleanAsUInt64.cs" />
+ <Compile Include="Vector64GetElementNegativeOne.cs" />
+ <Compile Include="Vector64GetElement0.cs" />
+ <Compile Include="Vector64GetElementMaxValue.cs" />
+ <Compile Include="Vector64WithElementNegativeOne.cs" />
+ <Compile Include="Vector64WithElement0.cs" />
+ <Compile Include="Vector64WithElementMaxValue.cs" />
+ <Compile Include="Vector64ToScalar.cs" />
+ <Compile Include="Vector64ToVector128.cs" />
+ <Compile Include="Vector64ToVector128Unsafe.cs" />
+ <Compile Include="Vector128Zero.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Boolean.cs" />
+ <Compile Include="Vector128ByteAsGeneric_Boolean.cs" />
+ <Compile Include="Vector128DoubleAsGeneric_Boolean.cs" />
+ <Compile Include="Vector128Int16AsGeneric_Boolean.cs" />
+ <Compile Include="Vector128Int32AsGeneric_Boolean.cs" />
+ <Compile Include="Vector128Int64AsGeneric_Boolean.cs" />
+ <Compile Include="Vector128SByteAsGeneric_Boolean.cs" />
+ <Compile Include="Vector128SingleAsGeneric_Boolean.cs" />
+ <Compile Include="Vector128UInt16AsGeneric_Boolean.cs" />
+ <Compile Include="Vector128UInt32AsGeneric_Boolean.cs" />
+ <Compile Include="Vector128UInt64AsGeneric_Boolean.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Byte.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Double.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Int16.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Int32.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Int64.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_SByte.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Single.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_UInt16.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_UInt32.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_UInt64.cs" />
+ <Compile Include="Vector128BooleanAsByte.cs" />
+ <Compile Include="Vector128BooleanAsDouble.cs" />
+ <Compile Include="Vector128BooleanAsInt16.cs" />
+ <Compile Include="Vector128BooleanAsInt32.cs" />
+ <Compile Include="Vector128BooleanAsInt64.cs" />
+ <Compile Include="Vector128BooleanAsSByte.cs" />
+ <Compile Include="Vector128BooleanAsSingle.cs" />
+ <Compile Include="Vector128BooleanAsUInt16.cs" />
+ <Compile Include="Vector128BooleanAsUInt32.cs" />
+ <Compile Include="Vector128BooleanAsUInt64.cs" />
+ <Compile Include="Vector128GetElementNegativeOne.cs" />
+ <Compile Include="Vector128GetElement0.cs" />
+ <Compile Include="Vector128GetElementMaxValue.cs" />
+ <Compile Include="Vector128WithElementNegativeOne.cs" />
+ <Compile Include="Vector128WithElement0.cs" />
+ <Compile Include="Vector128WithElementMaxValue.cs" />
+ <Compile Include="Vector128GetLower.cs" />
+ <Compile Include="Vector128WithLower.cs" />
+ <Compile Include="Vector128GetUpper.cs" />
+ <Compile Include="Vector128WithUpper.cs" />
+ <Compile Include="Vector128ToScalar.cs" />
+ <Compile Include="Vector128ToVector256.cs" />
+ <Compile Include="Vector128ToVector256Unsafe.cs" />
+ <Compile Include="Vector256Zero.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Boolean.cs" />
+ <Compile Include="Vector256ByteAsGeneric_Boolean.cs" />
+ <Compile Include="Vector256DoubleAsGeneric_Boolean.cs" />
+ <Compile Include="Vector256Int16AsGeneric_Boolean.cs" />
+ <Compile Include="Vector256Int32AsGeneric_Boolean.cs" />
+ <Compile Include="Vector256Int64AsGeneric_Boolean.cs" />
+ <Compile Include="Vector256SByteAsGeneric_Boolean.cs" />
+ <Compile Include="Vector256SingleAsGeneric_Boolean.cs" />
+ <Compile Include="Vector256UInt16AsGeneric_Boolean.cs" />
+ <Compile Include="Vector256UInt32AsGeneric_Boolean.cs" />
+ <Compile Include="Vector256UInt64AsGeneric_Boolean.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Byte.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Double.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Int16.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Int32.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Int64.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_SByte.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Single.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_UInt16.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_UInt32.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_UInt64.cs" />
+ <Compile Include="Vector256BooleanAsByte.cs" />
+ <Compile Include="Vector256BooleanAsDouble.cs" />
+ <Compile Include="Vector256BooleanAsInt16.cs" />
+ <Compile Include="Vector256BooleanAsInt32.cs" />
+ <Compile Include="Vector256BooleanAsInt64.cs" />
+ <Compile Include="Vector256BooleanAsSByte.cs" />
+ <Compile Include="Vector256BooleanAsSingle.cs" />
+ <Compile Include="Vector256BooleanAsUInt16.cs" />
+ <Compile Include="Vector256BooleanAsUInt32.cs" />
+ <Compile Include="Vector256BooleanAsUInt64.cs" />
+ <Compile Include="Vector256GetElementNegativeOne.cs" />
+ <Compile Include="Vector256GetElement0.cs" />
+ <Compile Include="Vector256GetElementMaxValue.cs" />
+ <Compile Include="Vector256WithElementNegativeOne.cs" />
+ <Compile Include="Vector256WithElement0.cs" />
+ <Compile Include="Vector256WithElementMaxValue.cs" />
+ <Compile Include="Vector256GetLower.cs" />
+ <Compile Include="Vector256WithLower.cs" />
+ <Compile Include="Vector256GetUpper.cs" />
+ <Compile Include="Vector256WithUpper.cs" />
+ <Compile Include="Vector256ToScalar.cs" />
+ <Compile Include="Program.NotSupported.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_ro.csproj b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_ro.csproj
new file mode 100644
index 0000000000..513293640e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_ro.csproj
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Embedded</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Vector64Zero.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Boolean.cs" />
+ <Compile Include="Vector64ByteAsGeneric_Boolean.cs" />
+ <Compile Include="Vector64DoubleAsGeneric_Boolean.cs" />
+ <Compile Include="Vector64Int16AsGeneric_Boolean.cs" />
+ <Compile Include="Vector64Int32AsGeneric_Boolean.cs" />
+ <Compile Include="Vector64Int64AsGeneric_Boolean.cs" />
+ <Compile Include="Vector64SByteAsGeneric_Boolean.cs" />
+ <Compile Include="Vector64SingleAsGeneric_Boolean.cs" />
+ <Compile Include="Vector64UInt16AsGeneric_Boolean.cs" />
+ <Compile Include="Vector64UInt32AsGeneric_Boolean.cs" />
+ <Compile Include="Vector64UInt64AsGeneric_Boolean.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Byte.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Double.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Int16.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Int32.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Int64.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_SByte.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_Single.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_UInt16.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_UInt32.cs" />
+ <Compile Include="Vector64BooleanAsGeneric_UInt64.cs" />
+ <Compile Include="Vector64BooleanAsByte.cs" />
+ <Compile Include="Vector64BooleanAsDouble.cs" />
+ <Compile Include="Vector64BooleanAsInt16.cs" />
+ <Compile Include="Vector64BooleanAsInt32.cs" />
+ <Compile Include="Vector64BooleanAsInt64.cs" />
+ <Compile Include="Vector64BooleanAsSByte.cs" />
+ <Compile Include="Vector64BooleanAsSingle.cs" />
+ <Compile Include="Vector64BooleanAsUInt16.cs" />
+ <Compile Include="Vector64BooleanAsUInt32.cs" />
+ <Compile Include="Vector64BooleanAsUInt64.cs" />
+ <Compile Include="Vector64GetElementNegativeOne.cs" />
+ <Compile Include="Vector64GetElement0.cs" />
+ <Compile Include="Vector64GetElementMaxValue.cs" />
+ <Compile Include="Vector64WithElementNegativeOne.cs" />
+ <Compile Include="Vector64WithElement0.cs" />
+ <Compile Include="Vector64WithElementMaxValue.cs" />
+ <Compile Include="Vector64ToScalar.cs" />
+ <Compile Include="Vector64ToVector128.cs" />
+ <Compile Include="Vector64ToVector128Unsafe.cs" />
+ <Compile Include="Vector128Zero.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Boolean.cs" />
+ <Compile Include="Vector128ByteAsGeneric_Boolean.cs" />
+ <Compile Include="Vector128DoubleAsGeneric_Boolean.cs" />
+ <Compile Include="Vector128Int16AsGeneric_Boolean.cs" />
+ <Compile Include="Vector128Int32AsGeneric_Boolean.cs" />
+ <Compile Include="Vector128Int64AsGeneric_Boolean.cs" />
+ <Compile Include="Vector128SByteAsGeneric_Boolean.cs" />
+ <Compile Include="Vector128SingleAsGeneric_Boolean.cs" />
+ <Compile Include="Vector128UInt16AsGeneric_Boolean.cs" />
+ <Compile Include="Vector128UInt32AsGeneric_Boolean.cs" />
+ <Compile Include="Vector128UInt64AsGeneric_Boolean.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Byte.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Double.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Int16.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Int32.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Int64.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_SByte.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_Single.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_UInt16.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_UInt32.cs" />
+ <Compile Include="Vector128BooleanAsGeneric_UInt64.cs" />
+ <Compile Include="Vector128BooleanAsByte.cs" />
+ <Compile Include="Vector128BooleanAsDouble.cs" />
+ <Compile Include="Vector128BooleanAsInt16.cs" />
+ <Compile Include="Vector128BooleanAsInt32.cs" />
+ <Compile Include="Vector128BooleanAsInt64.cs" />
+ <Compile Include="Vector128BooleanAsSByte.cs" />
+ <Compile Include="Vector128BooleanAsSingle.cs" />
+ <Compile Include="Vector128BooleanAsUInt16.cs" />
+ <Compile Include="Vector128BooleanAsUInt32.cs" />
+ <Compile Include="Vector128BooleanAsUInt64.cs" />
+ <Compile Include="Vector128GetElementNegativeOne.cs" />
+ <Compile Include="Vector128GetElement0.cs" />
+ <Compile Include="Vector128GetElementMaxValue.cs" />
+ <Compile Include="Vector128WithElementNegativeOne.cs" />
+ <Compile Include="Vector128WithElement0.cs" />
+ <Compile Include="Vector128WithElementMaxValue.cs" />
+ <Compile Include="Vector128GetLower.cs" />
+ <Compile Include="Vector128WithLower.cs" />
+ <Compile Include="Vector128GetUpper.cs" />
+ <Compile Include="Vector128WithUpper.cs" />
+ <Compile Include="Vector128ToScalar.cs" />
+ <Compile Include="Vector128ToVector256.cs" />
+ <Compile Include="Vector128ToVector256Unsafe.cs" />
+ <Compile Include="Vector256Zero.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Boolean.cs" />
+ <Compile Include="Vector256ByteAsGeneric_Boolean.cs" />
+ <Compile Include="Vector256DoubleAsGeneric_Boolean.cs" />
+ <Compile Include="Vector256Int16AsGeneric_Boolean.cs" />
+ <Compile Include="Vector256Int32AsGeneric_Boolean.cs" />
+ <Compile Include="Vector256Int64AsGeneric_Boolean.cs" />
+ <Compile Include="Vector256SByteAsGeneric_Boolean.cs" />
+ <Compile Include="Vector256SingleAsGeneric_Boolean.cs" />
+ <Compile Include="Vector256UInt16AsGeneric_Boolean.cs" />
+ <Compile Include="Vector256UInt32AsGeneric_Boolean.cs" />
+ <Compile Include="Vector256UInt64AsGeneric_Boolean.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Byte.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Double.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Int16.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Int32.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Int64.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_SByte.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_Single.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_UInt16.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_UInt32.cs" />
+ <Compile Include="Vector256BooleanAsGeneric_UInt64.cs" />
+ <Compile Include="Vector256BooleanAsByte.cs" />
+ <Compile Include="Vector256BooleanAsDouble.cs" />
+ <Compile Include="Vector256BooleanAsInt16.cs" />
+ <Compile Include="Vector256BooleanAsInt32.cs" />
+ <Compile Include="Vector256BooleanAsInt64.cs" />
+ <Compile Include="Vector256BooleanAsSByte.cs" />
+ <Compile Include="Vector256BooleanAsSingle.cs" />
+ <Compile Include="Vector256BooleanAsUInt16.cs" />
+ <Compile Include="Vector256BooleanAsUInt32.cs" />
+ <Compile Include="Vector256BooleanAsUInt64.cs" />
+ <Compile Include="Vector256GetElementNegativeOne.cs" />
+ <Compile Include="Vector256GetElement0.cs" />
+ <Compile Include="Vector256GetElementMaxValue.cs" />
+ <Compile Include="Vector256WithElementNegativeOne.cs" />
+ <Compile Include="Vector256WithElement0.cs" />
+ <Compile Include="Vector256WithElementMaxValue.cs" />
+ <Compile Include="Vector256GetLower.cs" />
+ <Compile Include="Vector256WithLower.cs" />
+ <Compile Include="Vector256GetUpper.cs" />
+ <Compile Include="Vector256WithUpper.cs" />
+ <Compile Include="Vector256ToScalar.cs" />
+ <Compile Include="Program.NotSupported.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Program.NotSupported.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Program.NotSupported.cs
new file mode 100644
index 0000000000..6c3a923e04
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Program.NotSupported.cs
@@ -0,0 +1,147 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["Vector64Zero"] = Vector64Zero,
+ ["Vector64BooleanAsGeneric_Boolean"] = Vector64BooleanAsGeneric_Boolean,
+ ["Vector64ByteAsGeneric_Boolean"] = Vector64ByteAsGeneric_Boolean,
+ ["Vector64DoubleAsGeneric_Boolean"] = Vector64DoubleAsGeneric_Boolean,
+ ["Vector64Int16AsGeneric_Boolean"] = Vector64Int16AsGeneric_Boolean,
+ ["Vector64Int32AsGeneric_Boolean"] = Vector64Int32AsGeneric_Boolean,
+ ["Vector64Int64AsGeneric_Boolean"] = Vector64Int64AsGeneric_Boolean,
+ ["Vector64SByteAsGeneric_Boolean"] = Vector64SByteAsGeneric_Boolean,
+ ["Vector64SingleAsGeneric_Boolean"] = Vector64SingleAsGeneric_Boolean,
+ ["Vector64UInt16AsGeneric_Boolean"] = Vector64UInt16AsGeneric_Boolean,
+ ["Vector64UInt32AsGeneric_Boolean"] = Vector64UInt32AsGeneric_Boolean,
+ ["Vector64UInt64AsGeneric_Boolean"] = Vector64UInt64AsGeneric_Boolean,
+ ["Vector64BooleanAsGeneric_Byte"] = Vector64BooleanAsGeneric_Byte,
+ ["Vector64BooleanAsGeneric_Double"] = Vector64BooleanAsGeneric_Double,
+ ["Vector64BooleanAsGeneric_Int16"] = Vector64BooleanAsGeneric_Int16,
+ ["Vector64BooleanAsGeneric_Int32"] = Vector64BooleanAsGeneric_Int32,
+ ["Vector64BooleanAsGeneric_Int64"] = Vector64BooleanAsGeneric_Int64,
+ ["Vector64BooleanAsGeneric_SByte"] = Vector64BooleanAsGeneric_SByte,
+ ["Vector64BooleanAsGeneric_Single"] = Vector64BooleanAsGeneric_Single,
+ ["Vector64BooleanAsGeneric_UInt16"] = Vector64BooleanAsGeneric_UInt16,
+ ["Vector64BooleanAsGeneric_UInt32"] = Vector64BooleanAsGeneric_UInt32,
+ ["Vector64BooleanAsGeneric_UInt64"] = Vector64BooleanAsGeneric_UInt64,
+ ["Vector64BooleanAsByte"] = Vector64BooleanAsByte,
+ ["Vector64BooleanAsDouble"] = Vector64BooleanAsDouble,
+ ["Vector64BooleanAsInt16"] = Vector64BooleanAsInt16,
+ ["Vector64BooleanAsInt32"] = Vector64BooleanAsInt32,
+ ["Vector64BooleanAsInt64"] = Vector64BooleanAsInt64,
+ ["Vector64BooleanAsSByte"] = Vector64BooleanAsSByte,
+ ["Vector64BooleanAsSingle"] = Vector64BooleanAsSingle,
+ ["Vector64BooleanAsUInt16"] = Vector64BooleanAsUInt16,
+ ["Vector64BooleanAsUInt32"] = Vector64BooleanAsUInt32,
+ ["Vector64BooleanAsUInt64"] = Vector64BooleanAsUInt64,
+ ["Vector64GetElementNegativeOne"] = Vector64GetElementNegativeOne,
+ ["Vector64GetElement0"] = Vector64GetElement0,
+ ["Vector64GetElementMaxValue"] = Vector64GetElementMaxValue,
+ ["Vector64WithElementNegativeOne"] = Vector64WithElementNegativeOne,
+ ["Vector64WithElement0"] = Vector64WithElement0,
+ ["Vector64WithElementMaxValue"] = Vector64WithElementMaxValue,
+ ["Vector64ToScalar"] = Vector64ToScalar,
+ ["Vector64ToVector128"] = Vector64ToVector128,
+ ["Vector64ToVector128Unsafe"] = Vector64ToVector128Unsafe,
+ ["Vector128Zero"] = Vector128Zero,
+ ["Vector128BooleanAsGeneric_Boolean"] = Vector128BooleanAsGeneric_Boolean,
+ ["Vector128ByteAsGeneric_Boolean"] = Vector128ByteAsGeneric_Boolean,
+ ["Vector128DoubleAsGeneric_Boolean"] = Vector128DoubleAsGeneric_Boolean,
+ ["Vector128Int16AsGeneric_Boolean"] = Vector128Int16AsGeneric_Boolean,
+ ["Vector128Int32AsGeneric_Boolean"] = Vector128Int32AsGeneric_Boolean,
+ ["Vector128Int64AsGeneric_Boolean"] = Vector128Int64AsGeneric_Boolean,
+ ["Vector128SByteAsGeneric_Boolean"] = Vector128SByteAsGeneric_Boolean,
+ ["Vector128SingleAsGeneric_Boolean"] = Vector128SingleAsGeneric_Boolean,
+ ["Vector128UInt16AsGeneric_Boolean"] = Vector128UInt16AsGeneric_Boolean,
+ ["Vector128UInt32AsGeneric_Boolean"] = Vector128UInt32AsGeneric_Boolean,
+ ["Vector128UInt64AsGeneric_Boolean"] = Vector128UInt64AsGeneric_Boolean,
+ ["Vector128BooleanAsGeneric_Byte"] = Vector128BooleanAsGeneric_Byte,
+ ["Vector128BooleanAsGeneric_Double"] = Vector128BooleanAsGeneric_Double,
+ ["Vector128BooleanAsGeneric_Int16"] = Vector128BooleanAsGeneric_Int16,
+ ["Vector128BooleanAsGeneric_Int32"] = Vector128BooleanAsGeneric_Int32,
+ ["Vector128BooleanAsGeneric_Int64"] = Vector128BooleanAsGeneric_Int64,
+ ["Vector128BooleanAsGeneric_SByte"] = Vector128BooleanAsGeneric_SByte,
+ ["Vector128BooleanAsGeneric_Single"] = Vector128BooleanAsGeneric_Single,
+ ["Vector128BooleanAsGeneric_UInt16"] = Vector128BooleanAsGeneric_UInt16,
+ ["Vector128BooleanAsGeneric_UInt32"] = Vector128BooleanAsGeneric_UInt32,
+ ["Vector128BooleanAsGeneric_UInt64"] = Vector128BooleanAsGeneric_UInt64,
+ ["Vector128BooleanAsByte"] = Vector128BooleanAsByte,
+ ["Vector128BooleanAsDouble"] = Vector128BooleanAsDouble,
+ ["Vector128BooleanAsInt16"] = Vector128BooleanAsInt16,
+ ["Vector128BooleanAsInt32"] = Vector128BooleanAsInt32,
+ ["Vector128BooleanAsInt64"] = Vector128BooleanAsInt64,
+ ["Vector128BooleanAsSByte"] = Vector128BooleanAsSByte,
+ ["Vector128BooleanAsSingle"] = Vector128BooleanAsSingle,
+ ["Vector128BooleanAsUInt16"] = Vector128BooleanAsUInt16,
+ ["Vector128BooleanAsUInt32"] = Vector128BooleanAsUInt32,
+ ["Vector128BooleanAsUInt64"] = Vector128BooleanAsUInt64,
+ ["Vector128GetElementNegativeOne"] = Vector128GetElementNegativeOne,
+ ["Vector128GetElement0"] = Vector128GetElement0,
+ ["Vector128GetElementMaxValue"] = Vector128GetElementMaxValue,
+ ["Vector128WithElementNegativeOne"] = Vector128WithElementNegativeOne,
+ ["Vector128WithElement0"] = Vector128WithElement0,
+ ["Vector128WithElementMaxValue"] = Vector128WithElementMaxValue,
+ ["Vector128GetLower"] = Vector128GetLower,
+ ["Vector128WithLower"] = Vector128WithLower,
+ ["Vector128GetUpper"] = Vector128GetUpper,
+ ["Vector128WithUpper"] = Vector128WithUpper,
+ ["Vector128ToScalar"] = Vector128ToScalar,
+ ["Vector128ToVector256"] = Vector128ToVector256,
+ ["Vector128ToVector256Unsafe"] = Vector128ToVector256Unsafe,
+ ["Vector256Zero"] = Vector256Zero,
+ ["Vector256BooleanAsGeneric_Boolean"] = Vector256BooleanAsGeneric_Boolean,
+ ["Vector256ByteAsGeneric_Boolean"] = Vector256ByteAsGeneric_Boolean,
+ ["Vector256DoubleAsGeneric_Boolean"] = Vector256DoubleAsGeneric_Boolean,
+ ["Vector256Int16AsGeneric_Boolean"] = Vector256Int16AsGeneric_Boolean,
+ ["Vector256Int32AsGeneric_Boolean"] = Vector256Int32AsGeneric_Boolean,
+ ["Vector256Int64AsGeneric_Boolean"] = Vector256Int64AsGeneric_Boolean,
+ ["Vector256SByteAsGeneric_Boolean"] = Vector256SByteAsGeneric_Boolean,
+ ["Vector256SingleAsGeneric_Boolean"] = Vector256SingleAsGeneric_Boolean,
+ ["Vector256UInt16AsGeneric_Boolean"] = Vector256UInt16AsGeneric_Boolean,
+ ["Vector256UInt32AsGeneric_Boolean"] = Vector256UInt32AsGeneric_Boolean,
+ ["Vector256UInt64AsGeneric_Boolean"] = Vector256UInt64AsGeneric_Boolean,
+ ["Vector256BooleanAsGeneric_Byte"] = Vector256BooleanAsGeneric_Byte,
+ ["Vector256BooleanAsGeneric_Double"] = Vector256BooleanAsGeneric_Double,
+ ["Vector256BooleanAsGeneric_Int16"] = Vector256BooleanAsGeneric_Int16,
+ ["Vector256BooleanAsGeneric_Int32"] = Vector256BooleanAsGeneric_Int32,
+ ["Vector256BooleanAsGeneric_Int64"] = Vector256BooleanAsGeneric_Int64,
+ ["Vector256BooleanAsGeneric_SByte"] = Vector256BooleanAsGeneric_SByte,
+ ["Vector256BooleanAsGeneric_Single"] = Vector256BooleanAsGeneric_Single,
+ ["Vector256BooleanAsGeneric_UInt16"] = Vector256BooleanAsGeneric_UInt16,
+ ["Vector256BooleanAsGeneric_UInt32"] = Vector256BooleanAsGeneric_UInt32,
+ ["Vector256BooleanAsGeneric_UInt64"] = Vector256BooleanAsGeneric_UInt64,
+ ["Vector256BooleanAsByte"] = Vector256BooleanAsByte,
+ ["Vector256BooleanAsDouble"] = Vector256BooleanAsDouble,
+ ["Vector256BooleanAsInt16"] = Vector256BooleanAsInt16,
+ ["Vector256BooleanAsInt32"] = Vector256BooleanAsInt32,
+ ["Vector256BooleanAsInt64"] = Vector256BooleanAsInt64,
+ ["Vector256BooleanAsSByte"] = Vector256BooleanAsSByte,
+ ["Vector256BooleanAsSingle"] = Vector256BooleanAsSingle,
+ ["Vector256BooleanAsUInt16"] = Vector256BooleanAsUInt16,
+ ["Vector256BooleanAsUInt32"] = Vector256BooleanAsUInt32,
+ ["Vector256BooleanAsUInt64"] = Vector256BooleanAsUInt64,
+ ["Vector256GetElementNegativeOne"] = Vector256GetElementNegativeOne,
+ ["Vector256GetElement0"] = Vector256GetElement0,
+ ["Vector256GetElementMaxValue"] = Vector256GetElementMaxValue,
+ ["Vector256WithElementNegativeOne"] = Vector256WithElementNegativeOne,
+ ["Vector256WithElement0"] = Vector256WithElement0,
+ ["Vector256WithElementMaxValue"] = Vector256WithElementMaxValue,
+ ["Vector256GetLower"] = Vector256GetLower,
+ ["Vector256WithLower"] = Vector256WithLower,
+ ["Vector256GetUpper"] = Vector256GetUpper,
+ ["Vector256WithUpper"] = Vector256WithUpper,
+ ["Vector256ToScalar"] = Vector256ToScalar,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsByte.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsByte.cs
new file mode 100644
index 0000000000..d02c6332ec
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsByte.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsByte()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<byte> result = default(Vector128<bool>).AsByte();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsByte: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsDouble.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsDouble.cs
new file mode 100644
index 0000000000..5ad235bffe
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsDouble.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsDouble()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<double> result = default(Vector128<bool>).AsDouble();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsDouble: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..d60ce57d4a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<bool>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Byte.cs
new file mode 100644
index 0000000000..0ad3fc3ed4
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Byte.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsGeneric_Byte()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<byte> result = default(Vector128<bool>).As<byte>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsGeneric_Byte: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Double.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Double.cs
new file mode 100644
index 0000000000..002a165c23
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Double.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsGeneric_Double()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<double> result = default(Vector128<bool>).As<double>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsGeneric_Double: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Int16.cs
new file mode 100644
index 0000000000..5276a9877a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Int16.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsGeneric_Int16()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<short> result = default(Vector128<bool>).As<short>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsGeneric_Int16: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Int32.cs
new file mode 100644
index 0000000000..835f9daa02
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Int32.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsGeneric_Int32()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<int> result = default(Vector128<bool>).As<int>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsGeneric_Int32: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Int64.cs
new file mode 100644
index 0000000000..330ad2b08a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Int64.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsGeneric_Int64()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<long> result = default(Vector128<bool>).As<long>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsGeneric_Int64: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_SByte.cs
new file mode 100644
index 0000000000..84a9fc9c7c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_SByte.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsGeneric_SByte()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<sbyte> result = default(Vector128<bool>).As<sbyte>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsGeneric_SByte: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Single.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Single.cs
new file mode 100644
index 0000000000..801b495905
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_Single.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsGeneric_Single()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<float> result = default(Vector128<bool>).As<float>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsGeneric_Single: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_UInt16.cs
new file mode 100644
index 0000000000..f592bde98e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_UInt16.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsGeneric_UInt16()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<ushort> result = default(Vector128<bool>).As<ushort>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsGeneric_UInt16: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_UInt32.cs
new file mode 100644
index 0000000000..8aa5b5b5ce
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_UInt32.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsGeneric_UInt32()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<uint> result = default(Vector128<bool>).As<uint>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsGeneric_UInt32: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_UInt64.cs
new file mode 100644
index 0000000000..a4294f3848
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsGeneric_UInt64.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsGeneric_UInt64()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<ulong> result = default(Vector128<bool>).As<ulong>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsGeneric_UInt64: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsInt16.cs
new file mode 100644
index 0000000000..b34aa76e96
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsInt16.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsInt16()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<short> result = default(Vector128<bool>).AsInt16();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsInt16: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsInt32.cs
new file mode 100644
index 0000000000..352c79a03c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsInt32.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsInt32()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<int> result = default(Vector128<bool>).AsInt32();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsInt32: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsInt64.cs
new file mode 100644
index 0000000000..aae7077bb3
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsInt64.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsInt64()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<long> result = default(Vector128<bool>).AsInt64();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsInt64: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsSByte.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsSByte.cs
new file mode 100644
index 0000000000..3d90478269
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsSByte.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsSByte()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<sbyte> result = default(Vector128<bool>).AsSByte();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsSByte: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsSingle.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsSingle.cs
new file mode 100644
index 0000000000..a8d11652b2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsSingle.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsSingle()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<float> result = default(Vector128<bool>).AsSingle();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsSingle: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsUInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsUInt16.cs
new file mode 100644
index 0000000000..0038536ba4
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsUInt16.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsUInt16()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<ushort> result = default(Vector128<bool>).AsUInt16();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsUInt16: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsUInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsUInt32.cs
new file mode 100644
index 0000000000..8769bd42a6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsUInt32.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsUInt32()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<uint> result = default(Vector128<bool>).AsUInt32();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsUInt32: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsUInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsUInt64.cs
new file mode 100644
index 0000000000..5f720793d2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128BooleanAsUInt64.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128BooleanAsUInt64()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<ulong> result = default(Vector128<bool>).AsUInt64();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128BooleanAsUInt64: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ByteAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ByteAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..1b1ac5db93
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ByteAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128ByteAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<byte>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128ByteAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128DoubleAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128DoubleAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..0422f59c2f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128DoubleAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128DoubleAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<double>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128DoubleAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetElement0.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetElement0.cs
new file mode 100644
index 0000000000..8ee13cb26e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetElement0.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128GetElement0()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ bool result = default(Vector128<bool>).GetElement(0);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128GetElement0: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetElementMaxValue.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetElementMaxValue.cs
new file mode 100644
index 0000000000..722c06af19
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetElementMaxValue.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128GetElementMaxValue()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ bool result = default(Vector128<bool>).GetElement(int.MaxValue);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128GetElementMaxValue: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetElementNegativeOne.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetElementNegativeOne.cs
new file mode 100644
index 0000000000..b7eb978777
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetElementNegativeOne.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128GetElementNegativeOne()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ bool result = default(Vector128<bool>).GetElement(-1);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128GetElementNegativeOne: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetLower.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetLower.cs
new file mode 100644
index 0000000000..18db9c9d50
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetLower.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128GetLower()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector128<bool>).GetLower();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128GetLower: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetUpper.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetUpper.cs
new file mode 100644
index 0000000000..32069261c3
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128GetUpper.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128GetUpper()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector128<bool>).GetUpper();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128GetUpper: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Int16AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Int16AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..495533b84a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Int16AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128Int16AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<short>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128Int16AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Int32AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Int32AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..319677c626
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Int32AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128Int32AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<int>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128Int32AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Int64AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Int64AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..b3de12a509
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Int64AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128Int64AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<long>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128Int64AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128SByteAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128SByteAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..a6746e4527
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128SByteAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128SByteAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<sbyte>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128SByteAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128SingleAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128SingleAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..ef9a4a9095
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128SingleAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128SingleAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<float>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128SingleAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToScalar.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToScalar.cs
new file mode 100644
index 0000000000..cf7f29a131
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToScalar.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128ToScalar()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ bool result = default(Vector128<bool>).ToScalar();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128ToScalar: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToVector256.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToVector256.cs
new file mode 100644
index 0000000000..1431045c5e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToVector256.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128ToVector256()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector128<bool>).ToVector256();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128ToVector256: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToVector256Unsafe.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToVector256Unsafe.cs
new file mode 100644
index 0000000000..6d45a93e01
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToVector256Unsafe.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128ToVector256Unsafe()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector128<bool>).ToVector256Unsafe();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128ToVector256Unsafe: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128UInt16AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128UInt16AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..3ecaa8022e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128UInt16AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128UInt16AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<ushort>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128UInt16AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128UInt32AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128UInt32AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..7c29b9f1f3
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128UInt32AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128UInt32AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<uint>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128UInt32AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128UInt64AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128UInt64AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..7e28e14929
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128UInt64AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128UInt64AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<ulong>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128UInt64AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithElement0.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithElement0.cs
new file mode 100644
index 0000000000..612de53214
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithElement0.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128WithElement0()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<bool>).WithElement(0, false);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128WithElement0: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithElementMaxValue.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithElementMaxValue.cs
new file mode 100644
index 0000000000..4b05ce5a92
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithElementMaxValue.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128WithElementMaxValue()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<bool>).WithElement(int.MaxValue, false);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128WithElementMaxValue: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithElementNegativeOne.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithElementNegativeOne.cs
new file mode 100644
index 0000000000..25286c1b0b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithElementNegativeOne.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128WithElementNegativeOne()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<bool>).WithElement(-1, false);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128WithElementNegativeOne: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithLower.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithLower.cs
new file mode 100644
index 0000000000..5355ab702b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithLower.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128WithLower()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<bool>).WithLower(default(Vector64<bool>));
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128WithLower: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithUpper.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithUpper.cs
new file mode 100644
index 0000000000..c4a9b76c25
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128WithUpper.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128WithUpper()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector128<bool>).WithUpper(default(Vector64<bool>));
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128WithUpper: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Zero.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Zero.cs
new file mode 100644
index 0000000000..b5751d48c7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128Zero.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector128Zero()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = Vector128<bool>.Zero;
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128Zero: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsByte.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsByte.cs
new file mode 100644
index 0000000000..fff1b3fe56
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsByte.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsByte()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<byte> result = default(Vector256<bool>).AsByte();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsByte: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsDouble.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsDouble.cs
new file mode 100644
index 0000000000..3c02b03d74
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsDouble.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsDouble()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<double> result = default(Vector256<bool>).AsDouble();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsDouble: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..c029d88972
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<bool>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Byte.cs
new file mode 100644
index 0000000000..ea4dd09496
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Byte.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsGeneric_Byte()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<byte> result = default(Vector256<bool>).As<byte>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsGeneric_Byte: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Double.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Double.cs
new file mode 100644
index 0000000000..31d6347678
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Double.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsGeneric_Double()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<double> result = default(Vector256<bool>).As<double>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsGeneric_Double: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Int16.cs
new file mode 100644
index 0000000000..b766758ca8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Int16.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsGeneric_Int16()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<short> result = default(Vector256<bool>).As<short>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsGeneric_Int16: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Int32.cs
new file mode 100644
index 0000000000..433d68468d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Int32.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsGeneric_Int32()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<int> result = default(Vector256<bool>).As<int>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsGeneric_Int32: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Int64.cs
new file mode 100644
index 0000000000..5f1f4d32e9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Int64.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsGeneric_Int64()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<long> result = default(Vector256<bool>).As<long>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsGeneric_Int64: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_SByte.cs
new file mode 100644
index 0000000000..66fa2837fd
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_SByte.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsGeneric_SByte()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<sbyte> result = default(Vector256<bool>).As<sbyte>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsGeneric_SByte: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Single.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Single.cs
new file mode 100644
index 0000000000..8712739de9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_Single.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsGeneric_Single()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<float> result = default(Vector256<bool>).As<float>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsGeneric_Single: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_UInt16.cs
new file mode 100644
index 0000000000..915786150b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_UInt16.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsGeneric_UInt16()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<ushort> result = default(Vector256<bool>).As<ushort>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsGeneric_UInt16: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_UInt32.cs
new file mode 100644
index 0000000000..b2e027d8c8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_UInt32.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsGeneric_UInt32()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<uint> result = default(Vector256<bool>).As<uint>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsGeneric_UInt32: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_UInt64.cs
new file mode 100644
index 0000000000..1f0c5f526e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsGeneric_UInt64.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsGeneric_UInt64()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<ulong> result = default(Vector256<bool>).As<ulong>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsGeneric_UInt64: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsInt16.cs
new file mode 100644
index 0000000000..98a07229f4
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsInt16.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsInt16()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<short> result = default(Vector256<bool>).AsInt16();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsInt16: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsInt32.cs
new file mode 100644
index 0000000000..923551da48
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsInt32.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsInt32()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<int> result = default(Vector256<bool>).AsInt32();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsInt32: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsInt64.cs
new file mode 100644
index 0000000000..97bca819b6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsInt64.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsInt64()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<long> result = default(Vector256<bool>).AsInt64();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsInt64: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsSByte.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsSByte.cs
new file mode 100644
index 0000000000..c5c85a7629
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsSByte.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsSByte()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<sbyte> result = default(Vector256<bool>).AsSByte();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsSByte: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsSingle.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsSingle.cs
new file mode 100644
index 0000000000..f1f19ebd80
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsSingle.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsSingle()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<float> result = default(Vector256<bool>).AsSingle();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsSingle: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsUInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsUInt16.cs
new file mode 100644
index 0000000000..0b8894bce3
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsUInt16.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsUInt16()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<ushort> result = default(Vector256<bool>).AsUInt16();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsUInt16: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsUInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsUInt32.cs
new file mode 100644
index 0000000000..3592a87bdc
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsUInt32.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsUInt32()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<uint> result = default(Vector256<bool>).AsUInt32();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsUInt32: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsUInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsUInt64.cs
new file mode 100644
index 0000000000..186ab74a83
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256BooleanAsUInt64.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256BooleanAsUInt64()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<ulong> result = default(Vector256<bool>).AsUInt64();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256BooleanAsUInt64: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256ByteAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256ByteAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..867f954fa1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256ByteAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256ByteAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<byte>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256ByteAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256DoubleAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256DoubleAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..7d2b8ffc95
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256DoubleAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256DoubleAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<double>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256DoubleAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetElement0.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetElement0.cs
new file mode 100644
index 0000000000..627663a122
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetElement0.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256GetElement0()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ bool result = default(Vector256<bool>).GetElement(0);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256GetElement0: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetElementMaxValue.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetElementMaxValue.cs
new file mode 100644
index 0000000000..27751ac97d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetElementMaxValue.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256GetElementMaxValue()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ bool result = default(Vector256<bool>).GetElement(int.MaxValue);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256GetElementMaxValue: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetElementNegativeOne.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetElementNegativeOne.cs
new file mode 100644
index 0000000000..4157ffeb89
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetElementNegativeOne.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256GetElementNegativeOne()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ bool result = default(Vector256<bool>).GetElement(-1);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256GetElementNegativeOne: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetLower.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetLower.cs
new file mode 100644
index 0000000000..4b721745a6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetLower.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256GetLower()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector256<bool>).GetLower();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256GetLower: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetUpper.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetUpper.cs
new file mode 100644
index 0000000000..b56d073417
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256GetUpper.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256GetUpper()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector256<bool>).GetUpper();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256GetUpper: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Int16AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Int16AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..060b18e0a6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Int16AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256Int16AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<short>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256Int16AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Int32AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Int32AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..e2963fca0d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Int32AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256Int32AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<int>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256Int32AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Int64AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Int64AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..1b59ca11de
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Int64AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256Int64AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<long>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256Int64AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256SByteAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256SByteAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..13517c14d1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256SByteAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256SByteAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<sbyte>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256SByteAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256SingleAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256SingleAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..7afd2094a2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256SingleAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256SingleAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<float>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256SingleAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256ToScalar.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256ToScalar.cs
new file mode 100644
index 0000000000..70f00128c4
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256ToScalar.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256ToScalar()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ bool result = default(Vector256<bool>).ToScalar();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256ToScalar: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256UInt16AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256UInt16AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..1b5a4a0196
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256UInt16AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256UInt16AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<ushort>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256UInt16AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256UInt32AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256UInt32AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..db4fb1cd0b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256UInt32AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256UInt32AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<uint>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256UInt32AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256UInt64AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256UInt64AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..3b71753901
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256UInt64AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256UInt64AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<ulong>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256UInt64AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithElement0.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithElement0.cs
new file mode 100644
index 0000000000..2721589bc2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithElement0.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256WithElement0()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<bool>).WithElement(0, false);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256WithElement0: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithElementMaxValue.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithElementMaxValue.cs
new file mode 100644
index 0000000000..f89ff54b17
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithElementMaxValue.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256WithElementMaxValue()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<bool>).WithElement(int.MaxValue, false);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256WithElementMaxValue: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithElementNegativeOne.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithElementNegativeOne.cs
new file mode 100644
index 0000000000..54370c9963
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithElementNegativeOne.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256WithElementNegativeOne()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<bool>).WithElement(-1, false);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256WithElementNegativeOne: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithLower.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithLower.cs
new file mode 100644
index 0000000000..88592a678b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithLower.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256WithLower()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<bool>).WithLower(default(Vector128<bool>));
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256WithLower: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithUpper.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithUpper.cs
new file mode 100644
index 0000000000..78b1a9be11
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256WithUpper.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256WithUpper()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = default(Vector256<bool>).WithUpper(default(Vector128<bool>));
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256WithUpper: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Zero.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Zero.cs
new file mode 100644
index 0000000000..bc94e4c472
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256Zero.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector256Zero()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector256<bool> result = Vector256<bool>.Zero;
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256Zero: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsByte.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsByte.cs
new file mode 100644
index 0000000000..86ed936173
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsByte.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsByte()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<byte> result = default(Vector64<bool>).AsByte();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsByte: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsDouble.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsDouble.cs
new file mode 100644
index 0000000000..f6ccf9047c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsDouble.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsDouble()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<double> result = default(Vector64<bool>).AsDouble();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsDouble: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..121274c585
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<bool>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Byte.cs
new file mode 100644
index 0000000000..1c53f6a298
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Byte.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsGeneric_Byte()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<byte> result = default(Vector64<bool>).As<byte>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsGeneric_Byte: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Double.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Double.cs
new file mode 100644
index 0000000000..bde45cea81
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Double.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsGeneric_Double()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<double> result = default(Vector64<bool>).As<double>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsGeneric_Double: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Int16.cs
new file mode 100644
index 0000000000..88018c847a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Int16.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsGeneric_Int16()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<short> result = default(Vector64<bool>).As<short>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsGeneric_Int16: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Int32.cs
new file mode 100644
index 0000000000..09b6f2653f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Int32.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsGeneric_Int32()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<int> result = default(Vector64<bool>).As<int>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsGeneric_Int32: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Int64.cs
new file mode 100644
index 0000000000..6b7e902f38
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Int64.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsGeneric_Int64()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<long> result = default(Vector64<bool>).As<long>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsGeneric_Int64: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_SByte.cs
new file mode 100644
index 0000000000..26a428eb5f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_SByte.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsGeneric_SByte()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<sbyte> result = default(Vector64<bool>).As<sbyte>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsGeneric_SByte: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Single.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Single.cs
new file mode 100644
index 0000000000..3b3a95074a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_Single.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsGeneric_Single()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<float> result = default(Vector64<bool>).As<float>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsGeneric_Single: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_UInt16.cs
new file mode 100644
index 0000000000..ea3cc48840
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_UInt16.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsGeneric_UInt16()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<ushort> result = default(Vector64<bool>).As<ushort>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsGeneric_UInt16: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_UInt32.cs
new file mode 100644
index 0000000000..846ae4815f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_UInt32.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsGeneric_UInt32()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<uint> result = default(Vector64<bool>).As<uint>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsGeneric_UInt32: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_UInt64.cs
new file mode 100644
index 0000000000..b61815cd71
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsGeneric_UInt64.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsGeneric_UInt64()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<ulong> result = default(Vector64<bool>).As<ulong>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsGeneric_UInt64: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsInt16.cs
new file mode 100644
index 0000000000..dae2902ee1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsInt16.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsInt16()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<short> result = default(Vector64<bool>).AsInt16();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsInt16: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsInt32.cs
new file mode 100644
index 0000000000..fe3b7f3b56
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsInt32.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsInt32()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<int> result = default(Vector64<bool>).AsInt32();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsInt32: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsInt64.cs
new file mode 100644
index 0000000000..e0ba02dac2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsInt64.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsInt64()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<long> result = default(Vector64<bool>).AsInt64();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsInt64: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsSByte.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsSByte.cs
new file mode 100644
index 0000000000..588919ef26
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsSByte.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsSByte()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<sbyte> result = default(Vector64<bool>).AsSByte();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsSByte: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsSingle.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsSingle.cs
new file mode 100644
index 0000000000..e0f1cabfed
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsSingle.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsSingle()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<float> result = default(Vector64<bool>).AsSingle();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsSingle: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsUInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsUInt16.cs
new file mode 100644
index 0000000000..a20fb44932
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsUInt16.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsUInt16()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<ushort> result = default(Vector64<bool>).AsUInt16();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsUInt16: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsUInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsUInt32.cs
new file mode 100644
index 0000000000..8ee2e27997
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsUInt32.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsUInt32()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<uint> result = default(Vector64<bool>).AsUInt32();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsUInt32: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsUInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsUInt64.cs
new file mode 100644
index 0000000000..c456dfd725
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64BooleanAsUInt64.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64BooleanAsUInt64()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<ulong> result = default(Vector64<bool>).AsUInt64();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64BooleanAsUInt64: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ByteAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ByteAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..08e99655d5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ByteAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64ByteAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<byte>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64ByteAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64DoubleAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64DoubleAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..f9ff44ffc8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64DoubleAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64DoubleAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<double>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64DoubleAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64GetElement0.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64GetElement0.cs
new file mode 100644
index 0000000000..2055b689f5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64GetElement0.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64GetElement0()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ bool result = default(Vector64<bool>).GetElement(0);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64GetElement0: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64GetElementMaxValue.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64GetElementMaxValue.cs
new file mode 100644
index 0000000000..09414cd1a8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64GetElementMaxValue.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64GetElementMaxValue()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ bool result = default(Vector64<bool>).GetElement(int.MaxValue);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64GetElementMaxValue: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64GetElementNegativeOne.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64GetElementNegativeOne.cs
new file mode 100644
index 0000000000..4c9da46bb1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64GetElementNegativeOne.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64GetElementNegativeOne()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ bool result = default(Vector64<bool>).GetElement(-1);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64GetElementNegativeOne: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Int16AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Int16AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..e8ef4e75f9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Int16AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64Int16AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<short>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64Int16AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Int32AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Int32AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..25a6e6542a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Int32AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64Int32AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<int>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64Int32AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Int64AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Int64AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..7ea6752d3d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Int64AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64Int64AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<long>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64Int64AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64SByteAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64SByteAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..6f3b78db1e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64SByteAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64SByteAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<sbyte>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64SByteAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64SingleAsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64SingleAsGeneric_Boolean.cs
new file mode 100644
index 0000000000..a04c618637
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64SingleAsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64SingleAsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<float>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64SingleAsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToScalar.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToScalar.cs
new file mode 100644
index 0000000000..fa8efaf23a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToScalar.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64ToScalar()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ bool result = default(Vector64<bool>).ToScalar();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64ToScalar: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToVector128.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToVector128.cs
new file mode 100644
index 0000000000..aa52ca68f7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToVector128.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64ToVector128()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector64<bool>).ToVector128();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64ToVector128: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToVector128Unsafe.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToVector128Unsafe.cs
new file mode 100644
index 0000000000..53634ac6aa
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToVector128Unsafe.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64ToVector128Unsafe()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector128<bool> result = default(Vector64<bool>).ToVector128Unsafe();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64ToVector128Unsafe: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64UInt16AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64UInt16AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..fa5ac5e7f2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64UInt16AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64UInt16AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<ushort>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64UInt16AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64UInt32AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64UInt32AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..9d478d109f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64UInt32AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64UInt32AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<uint>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64UInt32AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64UInt64AsGeneric_Boolean.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64UInt64AsGeneric_Boolean.cs
new file mode 100644
index 0000000000..3763af8607
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64UInt64AsGeneric_Boolean.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64UInt64AsGeneric_Boolean()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<ulong>).As<bool>();
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64UInt64AsGeneric_Boolean: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64WithElement0.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64WithElement0.cs
new file mode 100644
index 0000000000..219dc341ff
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64WithElement0.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64WithElement0()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<bool>).WithElement(0, false);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64WithElement0: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64WithElementMaxValue.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64WithElementMaxValue.cs
new file mode 100644
index 0000000000..747042a6f7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64WithElementMaxValue.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64WithElementMaxValue()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<bool>).WithElement(int.MaxValue, false);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64WithElementMaxValue: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64WithElementNegativeOne.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64WithElementNegativeOne.cs
new file mode 100644
index 0000000000..ccfc51f691
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64WithElementNegativeOne.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64WithElementNegativeOne()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = default(Vector64<bool>).WithElement(-1, false);
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64WithElementNegativeOne: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Zero.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Zero.cs
new file mode 100644
index 0000000000..9666bcbebb
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64Zero.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void Vector64Zero()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ Vector64<bool> result = Vector64<bool>.Zero;
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64Zero: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/GenerateTests.csx b/tests/src/JIT/HardwareIntrinsics/General/Shared/GenerateTests.csx
new file mode 100644
index 0000000000..93e8656cc1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/GenerateTests.csx
@@ -0,0 +1,622 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+// DIRECTIONS:
+// This file isn't very robust and makes several assumptions
+// You can execute it by calling "csi .\GenerateTests.csx"
+//
+// csi can be found under the <repo-root>\tools\net46\roslyn directory
+// It must be run such from the directory that contains the csx script
+//
+// New tests can be generated from the template by adding an entry to the
+// appropriate Inputs array below.
+//
+// You can support a new Isa by creating a new array and adding a new
+// "ProcessInputs" call at the bottom of the script.
+
+private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Vector64Inputs = new []
+{
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "Byte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "Double", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "Int16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "Int32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "Int64", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "SByte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "Single", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Byte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Int16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Int32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "SByte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Single", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalar", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector64", ["BaseType"] = "Byte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector64", ["BaseType"] = "Int16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector64", ["BaseType"] = "Int32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector64", ["BaseType"] = "SByte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector64", ["BaseType"] = "Single", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector64", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "Byte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "Int16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "Int32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "SByte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "Single", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "Create", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1]" }),
+};
+
+private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Vector64_1Inputs = new []
+{
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "Zero", ["VectorType"] = "Vector64", ["BaseType"] = "Byte", ["LargestVectorSize"] = "8" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "Zero", ["VectorType"] = "Vector64", ["BaseType"] = "Double", ["LargestVectorSize"] = "8" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "Zero", ["VectorType"] = "Vector64", ["BaseType"] = "Int16", ["LargestVectorSize"] = "8" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "Zero", ["VectorType"] = "Vector64", ["BaseType"] = "Int32", ["LargestVectorSize"] = "8" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "Zero", ["VectorType"] = "Vector64", ["BaseType"] = "Int64", ["LargestVectorSize"] = "8" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "Zero", ["VectorType"] = "Vector64", ["BaseType"] = "SByte", ["LargestVectorSize"] = "8" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "Zero", ["VectorType"] = "Vector64", ["BaseType"] = "Single", ["LargestVectorSize"] = "8" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "Zero", ["VectorType"] = "Vector64", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "8" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "Zero", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "8" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "Zero", ["VectorType"] = "Vector64", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "8" }),
+
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "As", ["VectorType"] = "Vector64", ["BaseType"] = "Byte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetByte()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "As", ["VectorType"] = "Vector64", ["BaseType"] = "Double", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "As", ["VectorType"] = "Vector64", ["BaseType"] = "Int16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "As", ["VectorType"] = "Vector64", ["BaseType"] = "Int32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "As", ["VectorType"] = "Vector64", ["BaseType"] = "Int64", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "As", ["VectorType"] = "Vector64", ["BaseType"] = "SByte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "As", ["VectorType"] = "Vector64", ["BaseType"] = "Single", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "As", ["VectorType"] = "Vector64", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "As", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64_1", ["Method"] = "As", ["VectorType"] = "Vector64", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()" }),
+
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "Byte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "Byte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["Imm"] = "7", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "Double", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["Imm"] = "0", ["ConsumeValues"] = "values[0]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "Int16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "Int16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "Int32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "Int32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "Int64", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["Imm"] = "0", ["ConsumeValues"] = "values[0]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "SByte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "SByte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "7", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "Single", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "Single", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector64", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["Imm"] = "0", ["ConsumeValues"] = "values[0]" }),
+
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Byte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Double", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ConsumeValues"] = "values[0]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Int16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Int32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Int64", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ConsumeValues"] = "values[0]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToScalar", ["VectorType"] = "Vector64", ["BaseType"] = "SByte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToScalar", ["VectorType"] = "Vector64", ["BaseType"] = "Single", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToScalar", ["VectorType"] = "Vector64", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToScalar", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToScalar", ["VectorType"] = "Vector64", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0]" }),
+
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToVector128", ["VectorType"] = "Vector64", ["BaseType"] = "Byte", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToVector128", ["VectorType"] = "Vector64", ["BaseType"] = "Double", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ConsumeValues"] = "values[0]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToVector128", ["VectorType"] = "Vector64", ["BaseType"] = "Int16", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToVector128", ["VectorType"] = "Vector64", ["BaseType"] = "Int32", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToVector128", ["VectorType"] = "Vector64", ["BaseType"] = "Int64", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ConsumeValues"] = "values[0]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToVector128", ["VectorType"] = "Vector64", ["BaseType"] = "SByte", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToVector128", ["VectorType"] = "Vector64", ["BaseType"] = "Single", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToVector128", ["VectorType"] = "Vector64", ["BaseType"] = "UInt16", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToVector128", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector64", ["Method"] = "ToVector128", ["VectorType"] = "Vector64", ["BaseType"] = "UInt64", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0]" }),
+};
+
+private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Vector128Inputs = new []
+{
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalar", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalar", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalar", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalar", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalar", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalar", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalar", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalar", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalar", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalar", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0], values[1]" }),
+
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["OpVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["OpVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["OpVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["OpVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["OpVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["OpVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["OpVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["OpVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["OpVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "Create", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["OpVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()" }),
+};
+
+private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Vector128_1Inputs = new []
+{
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "Zero", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["LargestVectorSize"] = "16" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "Zero", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["LargestVectorSize"] = "16" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "Zero", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["LargestVectorSize"] = "16" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "Zero", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["LargestVectorSize"] = "16" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "Zero", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["LargestVectorSize"] = "16" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "Zero", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["LargestVectorSize"] = "16" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "Zero", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["LargestVectorSize"] = "16" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "Zero", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "16" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "Zero", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "Zero", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "16" }),
+
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()" }),
+
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["Imm"] = "7", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["Imm"] = "15", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["Imm"] = "7", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "7", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "15", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["Imm"] = "7", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1]" }),
+
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["TgtVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["TgtVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["TgtVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["TgtVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["TgtVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["TgtVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["TgtVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["TgtVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["TgtVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["TgtVectorType"] = "Vector64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0], values[1]" }),
+
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToScalar", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToScalar", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToScalar", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToScalar", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToScalar", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToScalar", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToScalar", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToScalar", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToScalar", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToScalar", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0], values[1]" }),
+
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToVector256", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["TgtVectorType"] = "Vector256", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToVector256", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["TgtVectorType"] = "Vector256", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToVector256", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["TgtVectorType"] = "Vector256", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToVector256", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["TgtVectorType"] = "Vector256", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToVector256", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["TgtVectorType"] = "Vector256", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ConsumeValues"] = "values[0], values[1]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToVector256", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["TgtVectorType"] = "Vector256", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToVector256", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["TgtVectorType"] = "Vector256", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToVector256", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["TgtVectorType"] = "Vector256", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToVector256", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["TgtVectorType"] = "Vector256", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorExtendTest.template", new Dictionary<string, string> { ["Isa"] = "Vector128", ["Method"] = "ToVector256", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["TgtVectorType"] = "Vector256", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0], values[1]" }),
+};
+
+private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Vector256Inputs = new []
+{
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != expectedValue" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalar", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalar", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalar", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalar", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalar", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalar", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalar", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalar", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalar", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalar", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "resultElements[i] != 0" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+ ("VectorCreateTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "CreateScalarUnsafe", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "resultElements[0] != expectedValue", ["ValidateRemainingResults"] = "false /* value is uninitialized */" }),
+
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorCreateElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["OpVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["OpVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["OpVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["OpVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["OpVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["OpVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["OpVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["OpVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["OpVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()" }),
+ ("VectorCreateVectorTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "Create", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["OpVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()" }),
+};
+
+private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Vector256_1Inputs = new []
+{
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "Zero", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "Zero", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["LargestVectorSize"] = "32" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "Zero", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "Zero", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "Zero", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["LargestVectorSize"] = "32" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "Zero", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "Zero", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "Zero", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "Zero", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32" }),
+ ("VectorZeroTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "Zero", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32" }),
+
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()" }),
+ ("VectorAsTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()" }),
+
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["Imm"] = "7", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["Imm"] = "15", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["Imm"] = "31", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["Imm"] = "7", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["Imm"] = "15", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["Imm"] = "7", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "7", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "15", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "31", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["Imm"] = "7", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["Imm"] = "7", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["Imm"] = "15", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["Imm"] = "7", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["Imm"] = "0", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["Imm"] = "1", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithElementTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithElement", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["Imm"] = "3", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorGetAndWithLowerAndUpperTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "GetAndWithLowerAndUpper", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "ToScalar", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "ToScalar", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "ToScalar", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "ToScalar", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "ToScalar", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "ToScalar", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "ToScalar", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "ToScalar", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "ToScalar", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }),
+ ("VectorToScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Vector256", ["Method"] = "ToScalar", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }),
+};
+
+private static readonly (string templateFileName, Dictionary<string, string> templateData)[] NotSupportedInputs = new []
+{
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64Zero", ["TargetType"] = "Vector64<bool>", ["Source"] = "Vector64<bool>", ["Method"] = "Zero" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsGeneric_Boolean", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64ByteAsGeneric_Boolean", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<byte>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64DoubleAsGeneric_Boolean", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<double>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64Int16AsGeneric_Boolean", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<short>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64Int32AsGeneric_Boolean", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<int>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64Int64AsGeneric_Boolean", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<long>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64SByteAsGeneric_Boolean", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<sbyte>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64SingleAsGeneric_Boolean", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<float>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64UInt16AsGeneric_Boolean", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<ushort>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64UInt32AsGeneric_Boolean", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<uint>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64UInt64AsGeneric_Boolean", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<ulong>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsGeneric_Byte", ["TargetType"] = "Vector64<byte>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "As<byte>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsGeneric_Double", ["TargetType"] = "Vector64<double>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "As<double>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsGeneric_Int16", ["TargetType"] = "Vector64<short>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "As<short>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsGeneric_Int32", ["TargetType"] = "Vector64<int>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "As<int>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsGeneric_Int64", ["TargetType"] = "Vector64<long>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "As<long>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsGeneric_SByte", ["TargetType"] = "Vector64<sbyte>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "As<sbyte>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsGeneric_Single", ["TargetType"] = "Vector64<float>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "As<float>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsGeneric_UInt16", ["TargetType"] = "Vector64<ushort>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "As<ushort>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsGeneric_UInt32", ["TargetType"] = "Vector64<uint>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "As<uint>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsGeneric_UInt64", ["TargetType"] = "Vector64<ulong>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "As<ulong>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsByte", ["TargetType"] = "Vector64<byte>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "AsByte()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsDouble", ["TargetType"] = "Vector64<double>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "AsDouble()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsInt16", ["TargetType"] = "Vector64<short>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "AsInt16()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsInt32", ["TargetType"] = "Vector64<int>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "AsInt32()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsInt64", ["TargetType"] = "Vector64<long>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "AsInt64()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsSByte", ["TargetType"] = "Vector64<sbyte>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "AsSByte()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsSingle", ["TargetType"] = "Vector64<float>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "AsSingle()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsUInt16", ["TargetType"] = "Vector64<ushort>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "AsUInt16()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsUInt32", ["TargetType"] = "Vector64<uint>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "AsUInt32()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64BooleanAsUInt64", ["TargetType"] = "Vector64<ulong>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "AsUInt64()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64GetElementNegativeOne", ["TargetType"] = "bool", ["Source"] = "default(Vector64<bool>)", ["Method"] = "GetElement(-1)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64GetElement0", ["TargetType"] = "bool", ["Source"] = "default(Vector64<bool>)", ["Method"] = "GetElement(0)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64GetElementMaxValue", ["TargetType"] = "bool", ["Source"] = "default(Vector64<bool>)", ["Method"] = "GetElement(int.MaxValue)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64WithElementNegativeOne", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "WithElement(-1, false)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64WithElement0", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "WithElement(0, false)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64WithElementMaxValue", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "WithElement(int.MaxValue, false)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64ToScalar", ["TargetType"] = "bool", ["Source"] = "default(Vector64<bool>)", ["Method"] = "ToScalar()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64ToVector128", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "ToVector128()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector64ToVector128Unsafe", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector64<bool>)", ["Method"] = "ToVector128Unsafe()" }),
+
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128Zero", ["TargetType"] = "Vector128<bool>", ["Source"] = "Vector128<bool>", ["Method"] = "Zero" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsGeneric_Boolean", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128ByteAsGeneric_Boolean", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<byte>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128DoubleAsGeneric_Boolean", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<double>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128Int16AsGeneric_Boolean", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<short>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128Int32AsGeneric_Boolean", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<int>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128Int64AsGeneric_Boolean", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<long>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128SByteAsGeneric_Boolean", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<sbyte>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128SingleAsGeneric_Boolean", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<float>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128UInt16AsGeneric_Boolean", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<ushort>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128UInt32AsGeneric_Boolean", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<uint>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128UInt64AsGeneric_Boolean", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<ulong>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsGeneric_Byte", ["TargetType"] = "Vector128<byte>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "As<byte>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsGeneric_Double", ["TargetType"] = "Vector128<double>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "As<double>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsGeneric_Int16", ["TargetType"] = "Vector128<short>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "As<short>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsGeneric_Int32", ["TargetType"] = "Vector128<int>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "As<int>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsGeneric_Int64", ["TargetType"] = "Vector128<long>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "As<long>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsGeneric_SByte", ["TargetType"] = "Vector128<sbyte>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "As<sbyte>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsGeneric_Single", ["TargetType"] = "Vector128<float>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "As<float>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsGeneric_UInt16", ["TargetType"] = "Vector128<ushort>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "As<ushort>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsGeneric_UInt32", ["TargetType"] = "Vector128<uint>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "As<uint>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsGeneric_UInt64", ["TargetType"] = "Vector128<ulong>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "As<ulong>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsByte", ["TargetType"] = "Vector128<byte>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "AsByte()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsDouble", ["TargetType"] = "Vector128<double>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "AsDouble()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsInt16", ["TargetType"] = "Vector128<short>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "AsInt16()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsInt32", ["TargetType"] = "Vector128<int>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "AsInt32()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsInt64", ["TargetType"] = "Vector128<long>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "AsInt64()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsSByte", ["TargetType"] = "Vector128<sbyte>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "AsSByte()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsSingle", ["TargetType"] = "Vector128<float>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "AsSingle()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsUInt16", ["TargetType"] = "Vector128<ushort>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "AsUInt16()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsUInt32", ["TargetType"] = "Vector128<uint>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "AsUInt32()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsUInt64", ["TargetType"] = "Vector128<ulong>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "AsUInt64()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128GetElementNegativeOne", ["TargetType"] = "bool", ["Source"] = "default(Vector128<bool>)", ["Method"] = "GetElement(-1)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128GetElement0", ["TargetType"] = "bool", ["Source"] = "default(Vector128<bool>)", ["Method"] = "GetElement(0)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128GetElementMaxValue", ["TargetType"] = "bool", ["Source"] = "default(Vector128<bool>)", ["Method"] = "GetElement(int.MaxValue)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128WithElementNegativeOne", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "WithElement(-1, false)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128WithElement0", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "WithElement(0, false)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128WithElementMaxValue", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "WithElement(int.MaxValue, false)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128GetLower", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "GetLower()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128WithLower", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "WithLower(default(Vector64<bool>))" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128GetUpper", ["TargetType"] = "Vector64<bool>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "GetUpper()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128WithUpper", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "WithUpper(default(Vector64<bool>))" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128ToScalar", ["TargetType"] = "bool", ["Source"] = "default(Vector128<bool>)", ["Method"] = "ToScalar()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128ToVector256", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "ToVector256()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector128ToVector256Unsafe", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector128<bool>)", ["Method"] = "ToVector256Unsafe()" }),
+
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256Zero", ["TargetType"] = "Vector256<bool>", ["Source"] = "Vector256<bool>", ["Method"] = "Zero" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsGeneric_Boolean", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256ByteAsGeneric_Boolean", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<byte>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256DoubleAsGeneric_Boolean", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<double>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256Int16AsGeneric_Boolean", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<short>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256Int32AsGeneric_Boolean", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<int>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256Int64AsGeneric_Boolean", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<long>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256SByteAsGeneric_Boolean", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<sbyte>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256SingleAsGeneric_Boolean", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<float>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256UInt16AsGeneric_Boolean", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<ushort>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256UInt32AsGeneric_Boolean", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<uint>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256UInt64AsGeneric_Boolean", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<ulong>)", ["Method"] = "As<bool>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsGeneric_Byte", ["TargetType"] = "Vector256<byte>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "As<byte>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsGeneric_Double", ["TargetType"] = "Vector256<double>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "As<double>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsGeneric_Int16", ["TargetType"] = "Vector256<short>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "As<short>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsGeneric_Int32", ["TargetType"] = "Vector256<int>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "As<int>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsGeneric_Int64", ["TargetType"] = "Vector256<long>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "As<long>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsGeneric_SByte", ["TargetType"] = "Vector256<sbyte>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "As<sbyte>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsGeneric_Single", ["TargetType"] = "Vector256<float>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "As<float>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsGeneric_UInt16", ["TargetType"] = "Vector256<ushort>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "As<ushort>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsGeneric_UInt32", ["TargetType"] = "Vector256<uint>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "As<uint>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsGeneric_UInt64", ["TargetType"] = "Vector256<ulong>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "As<ulong>()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsByte", ["TargetType"] = "Vector256<byte>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "AsByte()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsDouble", ["TargetType"] = "Vector256<double>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "AsDouble()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsInt16", ["TargetType"] = "Vector256<short>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "AsInt16()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsInt32", ["TargetType"] = "Vector256<int>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "AsInt32()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsInt64", ["TargetType"] = "Vector256<long>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "AsInt64()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsSByte", ["TargetType"] = "Vector256<sbyte>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "AsSByte()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsSingle", ["TargetType"] = "Vector256<float>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "AsSingle()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsUInt16", ["TargetType"] = "Vector256<ushort>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "AsUInt16()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsUInt32", ["TargetType"] = "Vector256<uint>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "AsUInt32()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsUInt64", ["TargetType"] = "Vector256<ulong>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "AsUInt64()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256GetElementNegativeOne", ["TargetType"] = "bool", ["Source"] = "default(Vector256<bool>)", ["Method"] = "GetElement(-1)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256GetElement0", ["TargetType"] = "bool", ["Source"] = "default(Vector256<bool>)", ["Method"] = "GetElement(0)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256GetElementMaxValue", ["TargetType"] = "bool", ["Source"] = "default(Vector256<bool>)", ["Method"] = "GetElement(int.MaxValue)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256WithElementNegativeOne", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "WithElement(-1, false)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256WithElement0", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "WithElement(0, false)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256WithElementMaxValue", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "WithElement(int.MaxValue, false)" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256GetLower", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "GetLower()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256WithLower", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "WithLower(default(Vector128<bool>))" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256GetUpper", ["TargetType"] = "Vector128<bool>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "GetUpper()" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256WithUpper", ["TargetType"] = "Vector256<bool>", ["Source"] = "default(Vector256<bool>)", ["Method"] = "WithUpper(default(Vector128<bool>))" }),
+ ("VectorNotSupportedTest.template", new Dictionary<string, string> { ["Isa"] = "NotSupported", ["Name"] = "Vector256ToScalar", ["TargetType"] = "bool", ["Source"] = "default(Vector256<bool>)", ["Method"] = "ToScalar()" }),
+};
+
+private static void ProcessInputs(string groupName, (string templateFileName, Dictionary<string, string> templateData)[] inputs)
+{
+ var testListFileName = Path.Combine("..", groupName, $"Program.{groupName}.cs");
+
+ using (var testListFile = new StreamWriter(testListFileName, append: false))
+ {
+ testListFile.WriteLine(@"// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {");
+
+ foreach (var input in inputs)
+ {
+ ProcessInput(testListFile, groupName, input);
+ }
+
+ testListFile.WriteLine(@" };
+ }
+ }
+}");
+ }
+}
+
+private static void ProcessInput(StreamWriter testListFile, string groupName, (string templateFileName, Dictionary<string, string> templateData) input)
+{
+ var testName = "";
+
+ // Ex: ["Add.Single"] = AddSingle
+ if (input.templateFileName == "VectorCreateElementTest.template")
+ {
+ testName = $"{input.templateData["Method"]}Element.{input.templateData["BaseType"]}";
+ testListFile.WriteLine($@" [""{testName}""] = {input.templateData["Method"]}Element{input.templateData["BaseType"]},");
+ }
+ else if (input.templateFileName == "VectorCreateVectorTest.template")
+ {
+ testName = $"{input.templateData["Method"]}Vector.{input.templateData["BaseType"]}";
+ testListFile.WriteLine($@" [""{testName}""] = {input.templateData["Method"]}Vector{input.templateData["BaseType"]},");
+ }
+ else if (input.templateFileName == "VectorGetAndWithElementTest.template")
+ {
+ testName = $"{input.templateData["Method"]}.{input.templateData["BaseType"]}.{input.templateData["Imm"]}";
+ testListFile.WriteLine($@" [""{testName}""] = {input.templateData["Method"]}{input.templateData["BaseType"]}{input.templateData["Imm"]},");
+ }
+ else if (input.templateFileName == "VectorNotSupportedTest.template")
+ {
+ testName = input.templateData["Name"];
+ testListFile.WriteLine($@" [""{testName}""] = {testName},");
+ }
+ else
+ {
+ testName = $"{input.templateData["Method"]}.{input.templateData["BaseType"]}";
+ testListFile.WriteLine($@" [""{testName}""] = {input.templateData["Method"]}{input.templateData["BaseType"]},");
+ }
+
+ var testFileName = Path.Combine("..", groupName, $"{testName}.cs");
+ var template = File.ReadAllText(input.templateFileName);
+
+ foreach (var kvp in input.templateData)
+ {
+ template = template.Replace($"{{{kvp.Key}}}", kvp.Value);
+ }
+
+ File.WriteAllText(testFileName, template);
+}
+
+ProcessInputs("Vector64", Vector64Inputs);
+ProcessInputs("Vector64_1", Vector64_1Inputs);
+ProcessInputs("Vector128", Vector128Inputs);
+ProcessInputs("Vector128_1", Vector128_1Inputs);
+ProcessInputs("Vector256", Vector256Inputs);
+ProcessInputs("Vector256_1", Vector256_1Inputs);
+ProcessInputs("NotSupported", NotSupportedInputs);
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/Program.cs b/tests/src/JIT/HardwareIntrinsics/General/Shared/Program.cs
new file mode 100644
index 0000000000..d35d5dc823
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/Program.cs
@@ -0,0 +1,86 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private const int PASS = 100;
+ private const int FAIL = 0;
+
+ private static readonly IDictionary<string, Action> TestList;
+
+ public static int Main(string[] args)
+ {
+ var isPassing = true;
+
+ foreach (string testToRun in GetTestsToRun(args))
+ {
+ TestLibrary.TestFramework.BeginTestCase(testToRun);
+
+ try
+ {
+ TestList[testToRun].Invoke();
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError(e.GetType().ToString(), e.Message);
+ TestLibrary.TestFramework.LogVerbose(e.StackTrace);
+ isPassing = false;
+ }
+
+ TestLibrary.TestFramework.EndTestCase();
+ }
+
+ return isPassing ? PASS : FAIL;
+ }
+
+ private static ICollection<string> GetTestsToRun(string[] args)
+ {
+ var testsToRun = new HashSet<string>();
+
+ for (var i = 0; i < args.Length; i++)
+ {
+ var testName = args[i];
+
+ if (testName.Equals("all", StringComparison.OrdinalIgnoreCase))
+ {
+ break;
+ }
+
+ if (!TestList.Keys.Contains(testName, StringComparer.OrdinalIgnoreCase))
+ {
+ PrintUsage();
+ }
+
+ testsToRun.Add(testName);
+ }
+
+ return (testsToRun.Count == 0) ? TestList.Keys : testsToRun;
+ }
+
+ private static void PrintUsage()
+ {
+ TestLibrary.TestFramework.LogInformation($@"Usage:
+{Environment.GetCommandLineArgs()[0]} [testName]
+
+ [testName]: The name of the function to test.
+ Defaults to 'all'.
+ Multiple can be specified.
+
+ Available Test Names:");
+ foreach (string testName in TestList.Keys)
+ {
+ TestLibrary.TestFramework.LogInformation($" {testName}");
+ }
+
+ Environment.Exit(FAIL);
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorAsTest.template b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorAsTest.template
new file mode 100644
index 0000000000..bd28520ac5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorAsTest.template
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void {Method}{BaseType}()
+ {
+ var test = new VectorAs__{Method}{BaseType}();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__{Method}{BaseType}
+ {
+ private static readonly int LargestVectorSize = {LargestVectorSize};
+
+ private static readonly int ElementCount = Unsafe.SizeOf<{VectorType}<{BaseType}>>() / sizeof({BaseType});
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ {VectorType}<{BaseType}> value;
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<byte> byteResult = value.{Method}Byte();
+ ValidateResult(byteResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<double> doubleResult = value.{Method}Double();
+ ValidateResult(doubleResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<short> shortResult = value.{Method}Int16();
+ ValidateResult(shortResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<int> intResult = value.{Method}Int32();
+ ValidateResult(intResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<long> longResult = value.{Method}Int64();
+ ValidateResult(longResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<sbyte> sbyteResult = value.{Method}SByte();
+ ValidateResult(sbyteResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<float> floatResult = value.{Method}Single();
+ ValidateResult(floatResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<ushort> ushortResult = value.{Method}UInt16();
+ ValidateResult(ushortResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<uint> uintResult = value.{Method}UInt32();
+ ValidateResult(uintResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<ulong> ulongResult = value.{Method}UInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ {VectorType}<{BaseType}> value;
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<byte> byteResult = value.{Method}<byte>();
+ ValidateResult(byteResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<double> doubleResult = value.{Method}<double>();
+ ValidateResult(doubleResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<short> shortResult = value.{Method}<short>();
+ ValidateResult(shortResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<int> intResult = value.{Method}<int>();
+ ValidateResult(intResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<long> longResult = value.{Method}<long>();
+ ValidateResult(longResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<sbyte> sbyteResult = value.{Method}<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<float> floatResult = value.{Method}<float>();
+ ValidateResult(floatResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<ushort> ushortResult = value.{Method}<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<uint> uintResult = value.{Method}<uint>();
+ ValidateResult(uintResult, value);
+
+ value = {VectorType}.Create({NextValueOp});
+ {VectorType}<ulong> ulongResult = value.{Method}<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ {VectorType}<{BaseType}> value;
+
+ value = {VectorType}.Create({NextValueOp});
+ object byteResult = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.{Method}Byte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult(({VectorType}<byte>)(byteResult), value);
+
+ value = {VectorType}.Create({NextValueOp});
+ object doubleResult = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.{Method}Double), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult(({VectorType}<double>)(doubleResult), value);
+
+ value = {VectorType}.Create({NextValueOp});
+ object shortResult = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.{Method}Int16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult(({VectorType}<short>)(shortResult), value);
+
+ value = {VectorType}.Create({NextValueOp});
+ object intResult = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.{Method}Int32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult(({VectorType}<int>)(intResult), value);
+
+ value = {VectorType}.Create({NextValueOp});
+ object longResult = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.{Method}Int64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult(({VectorType}<long>)(longResult), value);
+
+ value = {VectorType}.Create({NextValueOp});
+ object sbyteResult = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.{Method}SByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult(({VectorType}<sbyte>)(sbyteResult), value);
+
+ value = {VectorType}.Create({NextValueOp});
+ object floatResult = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.{Method}Single), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult(({VectorType}<float>)(floatResult), value);
+
+ value = {VectorType}.Create({NextValueOp});
+ object ushortResult = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.{Method}UInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult(({VectorType}<ushort>)(ushortResult), value);
+
+ value = {VectorType}.Create({NextValueOp});
+ object uintResult = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.{Method}UInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult(({VectorType}<uint>)(uintResult), value);
+
+ value = {VectorType}.Create({NextValueOp});
+ object ulongResult = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.{Method}UInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult(({VectorType}<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>({VectorType}<T> result, {VectorType}<{BaseType}> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ {BaseType}[] resultElements = new {BaseType}[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref resultElements[0]), result);
+
+ {BaseType}[] valueElements = new {BaseType}[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult({BaseType}[] resultElements, {BaseType}[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}>.{Method}{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorCreateElementTest.template b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorCreateElementTest.template
new file mode 100644
index 0000000000..ec09545523
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorCreateElementTest.template
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void {Method}Element{BaseType}()
+ {
+ var test = new VectorCreate__{Method}Element{BaseType}();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__{Method}Element{BaseType}
+ {
+ private static readonly int LargestVectorSize = {LargestVectorSize};
+
+ private static readonly int ElementCount = Unsafe.SizeOf<{VectorType}<{BaseType}>>() / sizeof({BaseType});
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ {BaseType}[] values = new {BaseType}[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = {NextValueOp};
+ }
+
+ {VectorType}<{BaseType}> result = {Isa}.{Method}({ConsumeValues});
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ {BaseType}[] values = new {BaseType}[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof({BaseType});
+ values[i] = {NextValueOp};
+ }
+
+ object result = typeof({Isa})
+ .GetMethod(nameof({Isa}.{Method}), operandTypes)
+ .Invoke(null, new object[] { {ConsumeValues} });
+
+ ValidateResult(({VectorType}<{BaseType}>)(result), values);
+ }
+
+ private void ValidateResult({VectorType}<{BaseType}> result, {BaseType}[] expectedValues, [CallerMemberName] string method = "")
+ {
+ {BaseType}[] resultElements = new {BaseType}[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult({BaseType}[] resultElements, {BaseType}[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{Isa}.{Method}({BaseType}): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorCreateTest.template b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorCreateTest.template
new file mode 100644
index 0000000000..c3173575f2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorCreateTest.template
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void {Method}{BaseType}()
+ {
+ var test = new VectorCreate__{Method}{BaseType}();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__{Method}{BaseType}
+ {
+ private static readonly int LargestVectorSize = {LargestVectorSize};
+
+ private static readonly int ElementCount = Unsafe.SizeOf<{VectorType}<{BaseType}>>() / sizeof({BaseType});
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ {BaseType} value = {NextValueOp};
+ {VectorType}<{BaseType}> result = {Isa}.{Method}(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ {BaseType} value = {NextValueOp};
+ object result = typeof({Isa})
+ .GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({BaseType}) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult(({VectorType}<{BaseType}>)(result), value);
+ }
+
+ private void ValidateResult({VectorType}<{BaseType}> result, {BaseType} expectedValue, [CallerMemberName] string method = "")
+ {
+ {BaseType}[] resultElements = new {BaseType}[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult({BaseType}[] resultElements, {BaseType} expectedValue, [CallerMemberName] string method = "")
+ {
+ if ({ValidateFirstResult})
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if ({ValidateRemainingResults})
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{Isa}.{Method}({BaseType}): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorCreateVectorTest.template b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorCreateVectorTest.template
new file mode 100644
index 0000000000..fc6ab0aeb6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorCreateVectorTest.template
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void {Method}Vector{BaseType}()
+ {
+ var test = new VectorCreate__{Method}Vector{BaseType}();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__{Method}Vector{BaseType}
+ {
+ private static readonly int LargestVectorSize = {LargestVectorSize};
+
+ private static readonly int ElementCount = Unsafe.SizeOf<{VectorType}<{BaseType}>>() / sizeof({BaseType});
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ {BaseType} lowerValue = {NextValueOp};
+ {OpVectorType}<{BaseType}> lower = {OpVectorType}.Create(lowerValue);
+
+ {BaseType} upperValue = {NextValueOp};
+ {OpVectorType}<{BaseType}> upper = {OpVectorType}.Create(upperValue);
+
+ {VectorType}<{BaseType}> result = {Isa}.{Method}(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ {BaseType} lowerValue = {NextValueOp};
+ {OpVectorType}<{BaseType}> lower = {OpVectorType}.Create(lowerValue);
+
+ {BaseType} upperValue = {NextValueOp};
+ {OpVectorType}<{BaseType}> upper = {OpVectorType}.Create(upperValue);
+
+ object result = typeof({Isa})
+ .GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({OpVectorType}<{BaseType}>), typeof({OpVectorType}<{BaseType}>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult(({VectorType}<{BaseType}>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult({VectorType}<{BaseType}> result, {BaseType} expectedLowerValue, {BaseType} expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ {BaseType}[] resultElements = new {BaseType}[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult({BaseType}[] resultElements, {BaseType} expectedLowerValue, {BaseType} expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{Isa}.{Method}({BaseType}): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorExtendTest.template b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorExtendTest.template
new file mode 100644
index 0000000000..307b6ba650
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorExtendTest.template
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void {Method}{BaseType}()
+ {
+ var test = new VectorExtend__{Method}{BaseType}();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__{Method}{BaseType}
+ {
+ private static readonly int LargestVectorSize = {LargestVectorSize};
+
+ private static readonly int ElementCount = Unsafe.SizeOf<{VectorType}<{BaseType}>>() / sizeof({BaseType});
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ {BaseType}[] values = new {BaseType}[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = {NextValueOp};
+ }
+
+ {VectorType}<{BaseType}> value = {VectorType}.Create({ConsumeValues});
+
+ {TgtVectorType}<{BaseType}> result = value.{Method}();
+ ValidateResult(result, values, isUnsafe: false);
+
+ {TgtVectorType}<{BaseType}> unsafeResult = value.{Method}Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ {BaseType}[] values = new {BaseType}[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = {NextValueOp};
+ }
+
+ {VectorType}<{BaseType}> value = {VectorType}.Create({ConsumeValues});
+
+ object result = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.{Method}), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult(({TgtVectorType}<{BaseType}>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.{Method}), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult(({TgtVectorType}<{BaseType}>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult({TgtVectorType}<{BaseType}> result, {BaseType}[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ {BaseType}[] resultElements = new {BaseType}[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult({BaseType}[] result, {BaseType}[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}>.{Method}{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorGetAndWithElementTest.template b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorGetAndWithElementTest.template
new file mode 100644
index 0000000000..605e85795c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorGetAndWithElementTest.template
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void {Method}{BaseType}{Imm}()
+ {
+ var test = new VectorGetAndWithElement__{Method}{BaseType}{Imm}();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__{Method}{BaseType}{Imm}
+ {
+ private static readonly int LargestVectorSize = {LargestVectorSize};
+
+ private static readonly int ElementCount = Unsafe.SizeOf<{VectorType}<{BaseType}>>() / sizeof({BaseType});
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = {Imm}, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ {BaseType}[] values = new {BaseType}[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = {NextValueOp};
+ }
+
+ {VectorType}<{BaseType}> value = {VectorType}.Create({ConsumeValues});
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ {BaseType} result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ {BaseType} insertedValue = {NextValueOp};
+
+ try
+ {
+ {VectorType}<{BaseType}> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = {Imm}, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ {BaseType}[] values = new {BaseType}[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = {NextValueOp};
+ }
+
+ {VectorType}<{BaseType}> value = {VectorType}.Create({ConsumeValues});
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult(({BaseType})(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ {BaseType} insertedValue = {NextValueOp};
+
+ try
+ {
+ object result2 = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.WithElement), new Type[] { typeof(int), typeof({BaseType}) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult(({VectorType}<{BaseType}>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario({Imm} - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario({Imm} + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario({Imm} - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario({Imm} + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult({BaseType} result, {BaseType}[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[{Imm}])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}.GetElement({Imm}): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult({VectorType}<{BaseType}> result, {BaseType}[] values, {BaseType} insertedValue, [CallerMemberName] string method = "")
+ {
+ {BaseType}[] resultElements = new {BaseType}[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult({BaseType}[] result, {BaseType}[] values, {BaseType} insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != {Imm}) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[{Imm}] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}.WithElement({Imm}): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorGetAndWithLowerAndUpperTest.template b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorGetAndWithLowerAndUpperTest.template
new file mode 100644
index 0000000000..626e8d8505
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorGetAndWithLowerAndUpperTest.template
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void {Method}{BaseType}()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__{Method}{BaseType}();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__{Method}{BaseType}
+ {
+ private static readonly int LargestVectorSize = {LargestVectorSize};
+
+ private static readonly int ElementCount = Unsafe.SizeOf<{VectorType}<{BaseType}>>() / sizeof({BaseType});
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ {BaseType}[] values = new {BaseType}[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = {NextValueOp};
+ }
+
+ {VectorType}<{BaseType}> value = {VectorType}.Create({ConsumeValues});
+
+ {TgtVectorType}<{BaseType}> lowerResult = value.GetLower();
+ {TgtVectorType}<{BaseType}> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ {VectorType}<{BaseType}> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ {BaseType}[] values = new {BaseType}[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = {NextValueOp};
+ }
+
+ {VectorType}<{BaseType}> value = {VectorType}.Create({ConsumeValues});
+
+ object lowerResult = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult(({TgtVectorType}<{BaseType}>)(lowerResult), ({TgtVectorType}<{BaseType}>)(upperResult), values);
+
+ object result = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.WithLower), new Type[] { typeof({TgtVectorType}<{BaseType}>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.WithUpper), new Type[] { typeof({TgtVectorType}<{BaseType}>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult(({VectorType}<{BaseType}>)(result), values);
+ }
+
+ private void ValidateGetResult({TgtVectorType}<{BaseType}> lowerResult, {TgtVectorType}<{BaseType}> upperResult, {BaseType}[] values, [CallerMemberName] string method = "")
+ {
+ {BaseType}[] lowerElements = new {BaseType}[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref lowerElements[0]), lowerResult);
+
+ {BaseType}[] upperElements = new {BaseType}[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult({BaseType}[] lowerResult, {BaseType}[] upperResult, {BaseType}[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult({VectorType}<{BaseType}> result, {BaseType}[] values, [CallerMemberName] string method = "")
+ {
+ {BaseType}[] resultElements = new {BaseType}[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult({BaseType}[] result, {BaseType}[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorNotSupportedTest.template b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorNotSupportedTest.template
new file mode 100644
index 0000000000..bd4a888bc6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorNotSupportedTest.template
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void {Name}()
+ {
+ bool succeeded = false;
+
+ try
+ {
+ {TargetType} result = {Source}.{Method};
+ }
+ catch (NotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{Name}: RunNotSupportedScenario failed to throw NotSupportedException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorToScalarTest.template b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorToScalarTest.template
new file mode 100644
index 0000000000..70e4ea9778
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorToScalarTest.template
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void {Method}{BaseType}()
+ {
+ var test = new VectorToScalar__{Method}{BaseType}();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__{Method}{BaseType}
+ {
+ private static readonly int LargestVectorSize = {LargestVectorSize};
+
+ private static readonly int ElementCount = Unsafe.SizeOf<{VectorType}<{BaseType}>>() / sizeof({BaseType});
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ {BaseType}[] values = new {BaseType}[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = {NextValueOp};
+ }
+
+ {VectorType}<{BaseType}> value = {VectorType}.Create({ConsumeValues});
+
+ {BaseType} result = value.{Method}();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ {BaseType}[] values = new {BaseType}[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = {NextValueOp};
+ }
+
+ {VectorType}<{BaseType}> value = {VectorType}.Create({ConsumeValues});
+
+ object result = typeof({VectorType}<{BaseType}>)
+ .GetMethod(nameof({VectorType}<{BaseType}>.{Method}), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult(({BaseType})(result), values);
+ }
+
+ private void ValidateResult({BaseType} result, {BaseType}[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}>.{Method}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorZeroTest.template b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorZeroTest.template
new file mode 100644
index 0000000000..693fbaee76
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorZeroTest.template
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void {Method}{BaseType}()
+ {
+ var test = new VectorZero__{Method}{BaseType}();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__{Method}{BaseType}
+ {
+ private static readonly int LargestVectorSize = {LargestVectorSize};
+
+ private static readonly int ElementCount = Unsafe.SizeOf<{VectorType}<{BaseType}>>() / sizeof({BaseType});
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ {VectorType}<{BaseType}> result = {VectorType}<{BaseType}>.{Method};
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof({VectorType}<{BaseType}>)
+ .GetProperty(nameof({VectorType}<{BaseType}>.{Method}), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult(({VectorType}<{BaseType}>)(result));
+ }
+
+ private void ValidateResult({VectorType}<{BaseType}> result, [CallerMemberName] string method = "")
+ {
+ {BaseType}[] resultElements = new {BaseType}[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult({BaseType}[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{VectorType}.{Method}({BaseType}): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Byte.cs
new file mode 100644
index 0000000000..8b0a69f0d9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Byte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateByte()
+ {
+ var test = new VectorCreate__CreateByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ Vector128<Byte> result = Vector128.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Byte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Byte>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Byte> result, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Double.cs
new file mode 100644
index 0000000000..c7d8391d0a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Double.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateDouble()
+ {
+ var test = new VectorCreate__CreateDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateDouble
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ Vector128<Double> result = Vector128.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Double) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Double>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Double> result, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Int16.cs
new file mode 100644
index 0000000000..643711ac6b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Int16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateInt16()
+ {
+ var test = new VectorCreate__CreateInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ Vector128<Int16> result = Vector128.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Int16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Int16>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Int16> result, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Int32.cs
new file mode 100644
index 0000000000..0b3d64fe03
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Int32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateInt32()
+ {
+ var test = new VectorCreate__CreateInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ Vector128<Int32> result = Vector128.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Int32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Int32>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Int32> result, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Int64.cs
new file mode 100644
index 0000000000..ed992ed3f0
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Int64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateInt64()
+ {
+ var test = new VectorCreate__CreateInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ Vector128<Int64> result = Vector128.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Int64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Int64>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Int64> result, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.SByte.cs
new file mode 100644
index 0000000000..80ab8e17c2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.SByte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateSByte()
+ {
+ var test = new VectorCreate__CreateSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateSByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ Vector128<SByte> result = Vector128.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(SByte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<SByte>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<SByte> result, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Single.cs
new file mode 100644
index 0000000000..fbb909d12f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Single.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateSingle()
+ {
+ var test = new VectorCreate__CreateSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateSingle
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ Vector128<Single> result = Vector128.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Single) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Single>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Single> result, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.UInt16.cs
new file mode 100644
index 0000000000..95e33b1971
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.UInt16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateUInt16()
+ {
+ var test = new VectorCreate__CreateUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateUInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ Vector128<UInt16> result = Vector128.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(UInt16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<UInt16>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<UInt16> result, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.UInt32.cs
new file mode 100644
index 0000000000..27e55e3049
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.UInt32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateUInt32()
+ {
+ var test = new VectorCreate__CreateUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateUInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ Vector128<UInt32> result = Vector128.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(UInt32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<UInt32>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<UInt32> result, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.UInt64.cs
new file mode 100644
index 0000000000..19a90d5336
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.UInt64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateUInt64()
+ {
+ var test = new VectorCreate__CreateUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateUInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ Vector128<UInt64> result = Vector128.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(UInt64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<UInt64>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<UInt64> result, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Byte.cs
new file mode 100644
index 0000000000..98c7f84df9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Byte.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementByte()
+ {
+ var test = new VectorCreate__CreateElementByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector128<Byte> result = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Byte);
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15] });
+
+ ValidateResult((Vector128<Byte>)(result), values);
+ }
+
+ private void ValidateResult(Vector128<Byte> result, Byte[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Double.cs
new file mode 100644
index 0000000000..4cc4acd097
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Double.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementDouble()
+ {
+ var test = new VectorCreate__CreateElementDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementDouble
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector128<Double> result = Vector128.Create(values[0], values[1]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Double);
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1] });
+
+ ValidateResult((Vector128<Double>)(result), values);
+ }
+
+ private void ValidateResult(Vector128<Double> result, Double[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Int16.cs
new file mode 100644
index 0000000000..85d143cb1f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Int16.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementInt16()
+ {
+ var test = new VectorCreate__CreateElementInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector128<Int16> result = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Int16);
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7] });
+
+ ValidateResult((Vector128<Int16>)(result), values);
+ }
+
+ private void ValidateResult(Vector128<Int16> result, Int16[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Int32.cs
new file mode 100644
index 0000000000..804ab59361
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Int32.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementInt32()
+ {
+ var test = new VectorCreate__CreateElementInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector128<Int32> result = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Int32);
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3] });
+
+ ValidateResult((Vector128<Int32>)(result), values);
+ }
+
+ private void ValidateResult(Vector128<Int32> result, Int32[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Int64.cs
new file mode 100644
index 0000000000..a63dad6232
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Int64.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementInt64()
+ {
+ var test = new VectorCreate__CreateElementInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector128<Int64> result = Vector128.Create(values[0], values[1]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Int64);
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1] });
+
+ ValidateResult((Vector128<Int64>)(result), values);
+ }
+
+ private void ValidateResult(Vector128<Int64> result, Int64[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.SByte.cs
new file mode 100644
index 0000000000..56e7f95027
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.SByte.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementSByte()
+ {
+ var test = new VectorCreate__CreateElementSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementSByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector128<SByte> result = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(SByte);
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15] });
+
+ ValidateResult((Vector128<SByte>)(result), values);
+ }
+
+ private void ValidateResult(Vector128<SByte> result, SByte[] expectedValues, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Single.cs
new file mode 100644
index 0000000000..74540b3d7e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.Single.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementSingle()
+ {
+ var test = new VectorCreate__CreateElementSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementSingle
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector128<Single> result = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Single);
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3] });
+
+ ValidateResult((Vector128<Single>)(result), values);
+ }
+
+ private void ValidateResult(Vector128<Single> result, Single[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.UInt16.cs
new file mode 100644
index 0000000000..ba89ba0e3c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.UInt16.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementUInt16()
+ {
+ var test = new VectorCreate__CreateElementUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementUInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector128<UInt16> result = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(UInt16);
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7] });
+
+ ValidateResult((Vector128<UInt16>)(result), values);
+ }
+
+ private void ValidateResult(Vector128<UInt16> result, UInt16[] expectedValues, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.UInt32.cs
new file mode 100644
index 0000000000..60cec72465
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.UInt32.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementUInt32()
+ {
+ var test = new VectorCreate__CreateElementUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementUInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector128<UInt32> result = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(UInt32);
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3] });
+
+ ValidateResult((Vector128<UInt32>)(result), values);
+ }
+
+ private void ValidateResult(Vector128<UInt32> result, UInt32[] expectedValues, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.UInt64.cs
new file mode 100644
index 0000000000..b437196f3f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateElement.UInt64.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementUInt64()
+ {
+ var test = new VectorCreate__CreateElementUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementUInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector128<UInt64> result = Vector128.Create(values[0], values[1]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(UInt64);
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1] });
+
+ ValidateResult((Vector128<UInt64>)(result), values);
+ }
+
+ private void ValidateResult(Vector128<UInt64> result, UInt64[] expectedValues, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Byte.cs
new file mode 100644
index 0000000000..873df6cfb5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Byte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarByte()
+ {
+ var test = new VectorCreate__CreateScalarByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ Vector128<Byte> result = Vector128.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalar), new Type[] { typeof(Byte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Byte>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Byte> result, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalar(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Double.cs
new file mode 100644
index 0000000000..c4e2b3cfbd
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Double.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarDouble()
+ {
+ var test = new VectorCreate__CreateScalarDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarDouble
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ Vector128<Double> result = Vector128.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalar), new Type[] { typeof(Double) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Double>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Double> result, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalar(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Int16.cs
new file mode 100644
index 0000000000..cdbca215ae
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Int16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarInt16()
+ {
+ var test = new VectorCreate__CreateScalarInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ Vector128<Int16> result = Vector128.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalar), new Type[] { typeof(Int16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Int16>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Int16> result, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalar(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Int32.cs
new file mode 100644
index 0000000000..7bf566626e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Int32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarInt32()
+ {
+ var test = new VectorCreate__CreateScalarInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ Vector128<Int32> result = Vector128.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalar), new Type[] { typeof(Int32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Int32>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Int32> result, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalar(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Int64.cs
new file mode 100644
index 0000000000..d236a97e89
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Int64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarInt64()
+ {
+ var test = new VectorCreate__CreateScalarInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ Vector128<Int64> result = Vector128.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalar), new Type[] { typeof(Int64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Int64>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Int64> result, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalar(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.SByte.cs
new file mode 100644
index 0000000000..0256348e0a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.SByte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarSByte()
+ {
+ var test = new VectorCreate__CreateScalarSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarSByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ Vector128<SByte> result = Vector128.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalar), new Type[] { typeof(SByte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<SByte>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<SByte> result, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalar(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Single.cs
new file mode 100644
index 0000000000..5b52abb688
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.Single.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarSingle()
+ {
+ var test = new VectorCreate__CreateScalarSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarSingle
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ Vector128<Single> result = Vector128.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalar), new Type[] { typeof(Single) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Single>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Single> result, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalar(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.UInt16.cs
new file mode 100644
index 0000000000..736e414c52
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.UInt16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUInt16()
+ {
+ var test = new VectorCreate__CreateScalarUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ Vector128<UInt16> result = Vector128.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalar), new Type[] { typeof(UInt16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<UInt16>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<UInt16> result, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalar(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.UInt32.cs
new file mode 100644
index 0000000000..f873d37a23
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.UInt32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUInt32()
+ {
+ var test = new VectorCreate__CreateScalarUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ Vector128<UInt32> result = Vector128.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalar), new Type[] { typeof(UInt32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<UInt32>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<UInt32> result, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalar(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.UInt64.cs
new file mode 100644
index 0000000000..1047a74aad
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.UInt64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUInt64()
+ {
+ var test = new VectorCreate__CreateScalarUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ Vector128<UInt64> result = Vector128.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalar), new Type[] { typeof(UInt64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<UInt64>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<UInt64> result, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalar(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Byte.cs
new file mode 100644
index 0000000000..b6b48729a1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Byte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeByte()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ Vector128<Byte> result = Vector128.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalarUnsafe), new Type[] { typeof(Byte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Byte>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Byte> result, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalarUnsafe(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Double.cs
new file mode 100644
index 0000000000..6d90e84b0a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Double.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeDouble()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeDouble
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ Vector128<Double> result = Vector128.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalarUnsafe), new Type[] { typeof(Double) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Double>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Double> result, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalarUnsafe(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Int16.cs
new file mode 100644
index 0000000000..de0b4f25ec
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Int16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeInt16()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ Vector128<Int16> result = Vector128.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalarUnsafe), new Type[] { typeof(Int16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Int16>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Int16> result, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalarUnsafe(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Int32.cs
new file mode 100644
index 0000000000..79fe4e36ff
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Int32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeInt32()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ Vector128<Int32> result = Vector128.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalarUnsafe), new Type[] { typeof(Int32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Int32>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Int32> result, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalarUnsafe(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Int64.cs
new file mode 100644
index 0000000000..c45a48449a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Int64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeInt64()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ Vector128<Int64> result = Vector128.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalarUnsafe), new Type[] { typeof(Int64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Int64>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Int64> result, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalarUnsafe(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.SByte.cs
new file mode 100644
index 0000000000..3555d7a900
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.SByte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeSByte()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeSByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ Vector128<SByte> result = Vector128.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalarUnsafe), new Type[] { typeof(SByte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<SByte>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<SByte> result, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalarUnsafe(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Single.cs
new file mode 100644
index 0000000000..c4b1a59aa6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.Single.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeSingle()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeSingle
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ Vector128<Single> result = Vector128.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalarUnsafe), new Type[] { typeof(Single) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<Single>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<Single> result, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalarUnsafe(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.UInt16.cs
new file mode 100644
index 0000000000..c1b17fb9d0
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.UInt16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeUInt16()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeUInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ Vector128<UInt16> result = Vector128.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalarUnsafe), new Type[] { typeof(UInt16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<UInt16>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<UInt16> result, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalarUnsafe(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.UInt32.cs
new file mode 100644
index 0000000000..8c31d4461b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.UInt32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeUInt32()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeUInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ Vector128<UInt32> result = Vector128.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalarUnsafe), new Type[] { typeof(UInt32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<UInt32>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<UInt32> result, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalarUnsafe(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.UInt64.cs
new file mode 100644
index 0000000000..f2e3e03f80
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateScalarUnsafe.UInt64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeUInt64()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeUInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ Vector128<UInt64> result = Vector128.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.CreateScalarUnsafe), new Type[] { typeof(UInt64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector128<UInt64>)(result), value);
+ }
+
+ private void ValidateResult(Vector128<UInt64> result, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalarUnsafe(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Byte.cs
new file mode 100644
index 0000000000..8423bb9246
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Byte.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorByte()
+ {
+ var test = new VectorCreate__CreateVectorByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte lowerValue = TestLibrary.Generator.GetByte();
+ Vector64<Byte> lower = Vector64.Create(lowerValue);
+
+ Byte upperValue = TestLibrary.Generator.GetByte();
+ Vector64<Byte> upper = Vector64.Create(upperValue);
+
+ Vector128<Byte> result = Vector128.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte lowerValue = TestLibrary.Generator.GetByte();
+ Vector64<Byte> lower = Vector64.Create(lowerValue);
+
+ Byte upperValue = TestLibrary.Generator.GetByte();
+ Vector64<Byte> upper = Vector64.Create(upperValue);
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Vector64<Byte>), typeof(Vector64<Byte>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector128<Byte>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector128<Byte> result, Byte expectedLowerValue, Byte expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte expectedLowerValue, Byte expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Double.cs
new file mode 100644
index 0000000000..7cd70b163f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Double.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorDouble()
+ {
+ var test = new VectorCreate__CreateVectorDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorDouble
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double lowerValue = TestLibrary.Generator.GetDouble();
+ Vector64<Double> lower = Vector64.Create(lowerValue);
+
+ Double upperValue = TestLibrary.Generator.GetDouble();
+ Vector64<Double> upper = Vector64.Create(upperValue);
+
+ Vector128<Double> result = Vector128.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double lowerValue = TestLibrary.Generator.GetDouble();
+ Vector64<Double> lower = Vector64.Create(lowerValue);
+
+ Double upperValue = TestLibrary.Generator.GetDouble();
+ Vector64<Double> upper = Vector64.Create(upperValue);
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Vector64<Double>), typeof(Vector64<Double>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector128<Double>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector128<Double> result, Double expectedLowerValue, Double expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double expectedLowerValue, Double expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Int16.cs
new file mode 100644
index 0000000000..748305920f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Int16.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorInt16()
+ {
+ var test = new VectorCreate__CreateVectorInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16 lowerValue = TestLibrary.Generator.GetInt16();
+ Vector64<Int16> lower = Vector64.Create(lowerValue);
+
+ Int16 upperValue = TestLibrary.Generator.GetInt16();
+ Vector64<Int16> upper = Vector64.Create(upperValue);
+
+ Vector128<Int16> result = Vector128.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16 lowerValue = TestLibrary.Generator.GetInt16();
+ Vector64<Int16> lower = Vector64.Create(lowerValue);
+
+ Int16 upperValue = TestLibrary.Generator.GetInt16();
+ Vector64<Int16> upper = Vector64.Create(upperValue);
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Vector64<Int16>), typeof(Vector64<Int16>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector128<Int16>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector128<Int16> result, Int16 expectedLowerValue, Int16 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16 expectedLowerValue, Int16 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Int32.cs
new file mode 100644
index 0000000000..df0f4ba743
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Int32.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorInt32()
+ {
+ var test = new VectorCreate__CreateVectorInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32 lowerValue = TestLibrary.Generator.GetInt32();
+ Vector64<Int32> lower = Vector64.Create(lowerValue);
+
+ Int32 upperValue = TestLibrary.Generator.GetInt32();
+ Vector64<Int32> upper = Vector64.Create(upperValue);
+
+ Vector128<Int32> result = Vector128.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32 lowerValue = TestLibrary.Generator.GetInt32();
+ Vector64<Int32> lower = Vector64.Create(lowerValue);
+
+ Int32 upperValue = TestLibrary.Generator.GetInt32();
+ Vector64<Int32> upper = Vector64.Create(upperValue);
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<Int32>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector128<Int32>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector128<Int32> result, Int32 expectedLowerValue, Int32 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32 expectedLowerValue, Int32 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Int64.cs
new file mode 100644
index 0000000000..cb18564e88
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Int64.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorInt64()
+ {
+ var test = new VectorCreate__CreateVectorInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64 lowerValue = TestLibrary.Generator.GetInt64();
+ Vector64<Int64> lower = Vector64.Create(lowerValue);
+
+ Int64 upperValue = TestLibrary.Generator.GetInt64();
+ Vector64<Int64> upper = Vector64.Create(upperValue);
+
+ Vector128<Int64> result = Vector128.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64 lowerValue = TestLibrary.Generator.GetInt64();
+ Vector64<Int64> lower = Vector64.Create(lowerValue);
+
+ Int64 upperValue = TestLibrary.Generator.GetInt64();
+ Vector64<Int64> upper = Vector64.Create(upperValue);
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Vector64<Int64>), typeof(Vector64<Int64>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector128<Int64>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector128<Int64> result, Int64 expectedLowerValue, Int64 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64 expectedLowerValue, Int64 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.SByte.cs
new file mode 100644
index 0000000000..65fdbe6d52
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.SByte.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorSByte()
+ {
+ var test = new VectorCreate__CreateVectorSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorSByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte lowerValue = TestLibrary.Generator.GetSByte();
+ Vector64<SByte> lower = Vector64.Create(lowerValue);
+
+ SByte upperValue = TestLibrary.Generator.GetSByte();
+ Vector64<SByte> upper = Vector64.Create(upperValue);
+
+ Vector128<SByte> result = Vector128.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte lowerValue = TestLibrary.Generator.GetSByte();
+ Vector64<SByte> lower = Vector64.Create(lowerValue);
+
+ SByte upperValue = TestLibrary.Generator.GetSByte();
+ Vector64<SByte> upper = Vector64.Create(upperValue);
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Vector64<SByte>), typeof(Vector64<SByte>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector128<SByte>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector128<SByte> result, SByte expectedLowerValue, SByte expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte expectedLowerValue, SByte expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Single.cs
new file mode 100644
index 0000000000..4c07257d27
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.Single.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorSingle()
+ {
+ var test = new VectorCreate__CreateVectorSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorSingle
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single lowerValue = TestLibrary.Generator.GetSingle();
+ Vector64<Single> lower = Vector64.Create(lowerValue);
+
+ Single upperValue = TestLibrary.Generator.GetSingle();
+ Vector64<Single> upper = Vector64.Create(upperValue);
+
+ Vector128<Single> result = Vector128.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single lowerValue = TestLibrary.Generator.GetSingle();
+ Vector64<Single> lower = Vector64.Create(lowerValue);
+
+ Single upperValue = TestLibrary.Generator.GetSingle();
+ Vector64<Single> upper = Vector64.Create(upperValue);
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Vector64<Single>), typeof(Vector64<Single>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector128<Single>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector128<Single> result, Single expectedLowerValue, Single expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single expectedLowerValue, Single expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.UInt16.cs
new file mode 100644
index 0000000000..c74ee8404f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.UInt16.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorUInt16()
+ {
+ var test = new VectorCreate__CreateVectorUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorUInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16 lowerValue = TestLibrary.Generator.GetUInt16();
+ Vector64<UInt16> lower = Vector64.Create(lowerValue);
+
+ UInt16 upperValue = TestLibrary.Generator.GetUInt16();
+ Vector64<UInt16> upper = Vector64.Create(upperValue);
+
+ Vector128<UInt16> result = Vector128.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16 lowerValue = TestLibrary.Generator.GetUInt16();
+ Vector64<UInt16> lower = Vector64.Create(lowerValue);
+
+ UInt16 upperValue = TestLibrary.Generator.GetUInt16();
+ Vector64<UInt16> upper = Vector64.Create(upperValue);
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Vector64<UInt16>), typeof(Vector64<UInt16>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector128<UInt16>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector128<UInt16> result, UInt16 expectedLowerValue, UInt16 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16 expectedLowerValue, UInt16 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.UInt32.cs
new file mode 100644
index 0000000000..66687bfc77
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.UInt32.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorUInt32()
+ {
+ var test = new VectorCreate__CreateVectorUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorUInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32 lowerValue = TestLibrary.Generator.GetUInt32();
+ Vector64<UInt32> lower = Vector64.Create(lowerValue);
+
+ UInt32 upperValue = TestLibrary.Generator.GetUInt32();
+ Vector64<UInt32> upper = Vector64.Create(upperValue);
+
+ Vector128<UInt32> result = Vector128.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32 lowerValue = TestLibrary.Generator.GetUInt32();
+ Vector64<UInt32> lower = Vector64.Create(lowerValue);
+
+ UInt32 upperValue = TestLibrary.Generator.GetUInt32();
+ Vector64<UInt32> upper = Vector64.Create(upperValue);
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Vector64<UInt32>), typeof(Vector64<UInt32>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector128<UInt32>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector128<UInt32> result, UInt32 expectedLowerValue, UInt32 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32 expectedLowerValue, UInt32 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.UInt64.cs
new file mode 100644
index 0000000000..8720d7dbe7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/CreateVector.UInt64.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorUInt64()
+ {
+ var test = new VectorCreate__CreateVectorUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorUInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64 lowerValue = TestLibrary.Generator.GetUInt64();
+ Vector64<UInt64> lower = Vector64.Create(lowerValue);
+
+ UInt64 upperValue = TestLibrary.Generator.GetUInt64();
+ Vector64<UInt64> upper = Vector64.Create(upperValue);
+
+ Vector128<UInt64> result = Vector128.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64 lowerValue = TestLibrary.Generator.GetUInt64();
+ Vector64<UInt64> lower = Vector64.Create(lowerValue);
+
+ UInt64 upperValue = TestLibrary.Generator.GetUInt64();
+ Vector64<UInt64> upper = Vector64.Create(upperValue);
+
+ object result = typeof(Vector128)
+ .GetMethod(nameof(Vector128.Create), new Type[] { typeof(Vector64<UInt64>), typeof(Vector64<UInt64>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector128<UInt64>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector128<UInt64> result, UInt64 expectedLowerValue, UInt64 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64 expectedLowerValue, UInt64 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Create(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/Program.Vector128.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Program.Vector128.cs
new file mode 100644
index 0000000000..3ee1de45ac
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Program.Vector128.cs
@@ -0,0 +1,68 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["Create.Byte"] = CreateByte,
+ ["Create.Double"] = CreateDouble,
+ ["Create.Int16"] = CreateInt16,
+ ["Create.Int32"] = CreateInt32,
+ ["Create.Int64"] = CreateInt64,
+ ["Create.SByte"] = CreateSByte,
+ ["Create.Single"] = CreateSingle,
+ ["Create.UInt16"] = CreateUInt16,
+ ["Create.UInt32"] = CreateUInt32,
+ ["Create.UInt64"] = CreateUInt64,
+ ["CreateScalar.Byte"] = CreateScalarByte,
+ ["CreateScalar.Double"] = CreateScalarDouble,
+ ["CreateScalar.Int16"] = CreateScalarInt16,
+ ["CreateScalar.Int32"] = CreateScalarInt32,
+ ["CreateScalar.Int64"] = CreateScalarInt64,
+ ["CreateScalar.SByte"] = CreateScalarSByte,
+ ["CreateScalar.Single"] = CreateScalarSingle,
+ ["CreateScalar.UInt16"] = CreateScalarUInt16,
+ ["CreateScalar.UInt32"] = CreateScalarUInt32,
+ ["CreateScalar.UInt64"] = CreateScalarUInt64,
+ ["CreateScalarUnsafe.Byte"] = CreateScalarUnsafeByte,
+ ["CreateScalarUnsafe.Double"] = CreateScalarUnsafeDouble,
+ ["CreateScalarUnsafe.Int16"] = CreateScalarUnsafeInt16,
+ ["CreateScalarUnsafe.Int32"] = CreateScalarUnsafeInt32,
+ ["CreateScalarUnsafe.Int64"] = CreateScalarUnsafeInt64,
+ ["CreateScalarUnsafe.SByte"] = CreateScalarUnsafeSByte,
+ ["CreateScalarUnsafe.Single"] = CreateScalarUnsafeSingle,
+ ["CreateScalarUnsafe.UInt16"] = CreateScalarUnsafeUInt16,
+ ["CreateScalarUnsafe.UInt32"] = CreateScalarUnsafeUInt32,
+ ["CreateScalarUnsafe.UInt64"] = CreateScalarUnsafeUInt64,
+ ["CreateElement.Byte"] = CreateElementByte,
+ ["CreateElement.Double"] = CreateElementDouble,
+ ["CreateElement.Int16"] = CreateElementInt16,
+ ["CreateElement.Int32"] = CreateElementInt32,
+ ["CreateElement.Int64"] = CreateElementInt64,
+ ["CreateElement.SByte"] = CreateElementSByte,
+ ["CreateElement.Single"] = CreateElementSingle,
+ ["CreateElement.UInt16"] = CreateElementUInt16,
+ ["CreateElement.UInt32"] = CreateElementUInt32,
+ ["CreateElement.UInt64"] = CreateElementUInt64,
+ ["CreateVector.Byte"] = CreateVectorByte,
+ ["CreateVector.Double"] = CreateVectorDouble,
+ ["CreateVector.Int16"] = CreateVectorInt16,
+ ["CreateVector.Int32"] = CreateVectorInt32,
+ ["CreateVector.Int64"] = CreateVectorInt64,
+ ["CreateVector.SByte"] = CreateVectorSByte,
+ ["CreateVector.Single"] = CreateVectorSingle,
+ ["CreateVector.UInt16"] = CreateVectorUInt16,
+ ["CreateVector.UInt32"] = CreateVectorUInt32,
+ ["CreateVector.UInt64"] = CreateVectorUInt64,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/Vector128_r.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Vector128_r.csproj
new file mode 100644
index 0000000000..024f227d64
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Vector128_r.csproj
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Embedded</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Create.Byte.cs" />
+ <Compile Include="Create.Double.cs" />
+ <Compile Include="Create.Int16.cs" />
+ <Compile Include="Create.Int32.cs" />
+ <Compile Include="Create.Int64.cs" />
+ <Compile Include="Create.SByte.cs" />
+ <Compile Include="Create.Single.cs" />
+ <Compile Include="Create.UInt16.cs" />
+ <Compile Include="Create.UInt32.cs" />
+ <Compile Include="Create.UInt64.cs" />
+ <Compile Include="CreateElement.Byte.cs" />
+ <Compile Include="CreateElement.Double.cs" />
+ <Compile Include="CreateElement.Int16.cs" />
+ <Compile Include="CreateElement.Int32.cs" />
+ <Compile Include="CreateElement.Int64.cs" />
+ <Compile Include="CreateElement.SByte.cs" />
+ <Compile Include="CreateElement.Single.cs" />
+ <Compile Include="CreateElement.UInt16.cs" />
+ <Compile Include="CreateElement.UInt32.cs" />
+ <Compile Include="CreateElement.UInt64.cs" />
+ <Compile Include="CreateVector.Byte.cs" />
+ <Compile Include="CreateVector.Double.cs" />
+ <Compile Include="CreateVector.Int16.cs" />
+ <Compile Include="CreateVector.Int32.cs" />
+ <Compile Include="CreateVector.Int64.cs" />
+ <Compile Include="CreateVector.SByte.cs" />
+ <Compile Include="CreateVector.Single.cs" />
+ <Compile Include="CreateVector.UInt16.cs" />
+ <Compile Include="CreateVector.UInt32.cs" />
+ <Compile Include="CreateVector.UInt64.cs" />
+ <Compile Include="CreateScalar.Byte.cs" />
+ <Compile Include="CreateScalar.Double.cs" />
+ <Compile Include="CreateScalar.Int16.cs" />
+ <Compile Include="CreateScalar.Int32.cs" />
+ <Compile Include="CreateScalar.Int64.cs" />
+ <Compile Include="CreateScalar.SByte.cs" />
+ <Compile Include="CreateScalar.Single.cs" />
+ <Compile Include="CreateScalar.UInt16.cs" />
+ <Compile Include="CreateScalar.UInt32.cs" />
+ <Compile Include="CreateScalar.UInt64.cs" />
+ <Compile Include="CreateScalarUnsafe.Byte.cs" />
+ <Compile Include="CreateScalarUnsafe.Double.cs" />
+ <Compile Include="CreateScalarUnsafe.Int16.cs" />
+ <Compile Include="CreateScalarUnsafe.Int32.cs" />
+ <Compile Include="CreateScalarUnsafe.Int64.cs" />
+ <Compile Include="CreateScalarUnsafe.SByte.cs" />
+ <Compile Include="CreateScalarUnsafe.Single.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt16.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt32.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt64.cs" />
+ <Compile Include="Program.Vector128.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128/Vector128_ro.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Vector128_ro.csproj
new file mode 100644
index 0000000000..f5d8ef2bfb
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128/Vector128_ro.csproj
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Embedded</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Create.Byte.cs" />
+ <Compile Include="Create.Double.cs" />
+ <Compile Include="Create.Int16.cs" />
+ <Compile Include="Create.Int32.cs" />
+ <Compile Include="Create.Int64.cs" />
+ <Compile Include="Create.SByte.cs" />
+ <Compile Include="Create.Single.cs" />
+ <Compile Include="Create.UInt16.cs" />
+ <Compile Include="Create.UInt32.cs" />
+ <Compile Include="Create.UInt64.cs" />
+ <Compile Include="CreateElement.Byte.cs" />
+ <Compile Include="CreateElement.Double.cs" />
+ <Compile Include="CreateElement.Int16.cs" />
+ <Compile Include="CreateElement.Int32.cs" />
+ <Compile Include="CreateElement.Int64.cs" />
+ <Compile Include="CreateElement.SByte.cs" />
+ <Compile Include="CreateElement.Single.cs" />
+ <Compile Include="CreateElement.UInt16.cs" />
+ <Compile Include="CreateElement.UInt32.cs" />
+ <Compile Include="CreateElement.UInt64.cs" />
+ <Compile Include="CreateVector.Byte.cs" />
+ <Compile Include="CreateVector.Double.cs" />
+ <Compile Include="CreateVector.Int16.cs" />
+ <Compile Include="CreateVector.Int32.cs" />
+ <Compile Include="CreateVector.Int64.cs" />
+ <Compile Include="CreateVector.SByte.cs" />
+ <Compile Include="CreateVector.Single.cs" />
+ <Compile Include="CreateVector.UInt16.cs" />
+ <Compile Include="CreateVector.UInt32.cs" />
+ <Compile Include="CreateVector.UInt64.cs" />
+ <Compile Include="CreateScalar.Byte.cs" />
+ <Compile Include="CreateScalar.Double.cs" />
+ <Compile Include="CreateScalar.Int16.cs" />
+ <Compile Include="CreateScalar.Int32.cs" />
+ <Compile Include="CreateScalar.Int64.cs" />
+ <Compile Include="CreateScalar.SByte.cs" />
+ <Compile Include="CreateScalar.Single.cs" />
+ <Compile Include="CreateScalar.UInt16.cs" />
+ <Compile Include="CreateScalar.UInt32.cs" />
+ <Compile Include="CreateScalar.UInt64.cs" />
+ <Compile Include="CreateScalarUnsafe.Byte.cs" />
+ <Compile Include="CreateScalarUnsafe.Double.cs" />
+ <Compile Include="CreateScalarUnsafe.Int16.cs" />
+ <Compile Include="CreateScalarUnsafe.Int32.cs" />
+ <Compile Include="CreateScalarUnsafe.Int64.cs" />
+ <Compile Include="CreateScalarUnsafe.SByte.cs" />
+ <Compile Include="CreateScalarUnsafe.Single.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt16.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt32.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt64.cs" />
+ <Compile Include="Program.Vector128.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Byte.cs
new file mode 100644
index 0000000000..01394c6810
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Byte.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsByte()
+ {
+ var test = new VectorAs__AsByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector128<Byte> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector128<Byte> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ Vector128<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector128<Byte> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ object byteResult = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<byte>)(byteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ object doubleResult = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<double>)(doubleResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ object shortResult = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<short>)(shortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ object intResult = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<int>)(intResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ object longResult = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<long>)(longResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ object sbyteResult = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<sbyte>)(sbyteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ object floatResult = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<float>)(floatResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ object ushortResult = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ushort>)(ushortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ object uintResult = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<uint>)(uintResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetByte());
+ object ulongResult = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector128<T> result, Vector128<Byte> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+
+ Byte[] valueElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Double.cs
new file mode 100644
index 0000000000..7f4538cb5d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Double.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsDouble()
+ {
+ var test = new VectorAs__AsDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsDouble
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector128<Double> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector128<Double> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ Vector128<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector128<Double> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ object byteResult = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<byte>)(byteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ object doubleResult = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<double>)(doubleResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ object shortResult = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<short>)(shortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ object intResult = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<int>)(intResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ object longResult = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<long>)(longResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ object sbyteResult = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<sbyte>)(sbyteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ object floatResult = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<float>)(floatResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ object ushortResult = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ushort>)(ushortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ object uintResult = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<uint>)(uintResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetDouble());
+ object ulongResult = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector128<T> result, Vector128<Double> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+
+ Double[] valueElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int16.cs
new file mode 100644
index 0000000000..ec8bbf7433
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int16.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsInt16()
+ {
+ var test = new VectorAs__AsInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector128<Int16> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector128<Int16> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ Vector128<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector128<Int16> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ object byteResult = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<byte>)(byteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ object doubleResult = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<double>)(doubleResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ object shortResult = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<short>)(shortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ object intResult = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<int>)(intResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ object longResult = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<long>)(longResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ object sbyteResult = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<sbyte>)(sbyteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ object floatResult = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<float>)(floatResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ object ushortResult = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ushort>)(ushortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ object uintResult = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<uint>)(uintResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt16());
+ object ulongResult = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector128<T> result, Vector128<Int16> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+
+ Int16[] valueElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int32.cs
new file mode 100644
index 0000000000..233cf35c08
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int32.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsInt32()
+ {
+ var test = new VectorAs__AsInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector128<Int32> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector128<Int32> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ Vector128<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector128<Int32> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ object byteResult = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<byte>)(byteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ object doubleResult = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<double>)(doubleResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ object shortResult = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<short>)(shortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ object intResult = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<int>)(intResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ object longResult = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<long>)(longResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ object sbyteResult = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<sbyte>)(sbyteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ object floatResult = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<float>)(floatResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ object ushortResult = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ushort>)(ushortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ object uintResult = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<uint>)(uintResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt32());
+ object ulongResult = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector128<T> result, Vector128<Int32> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+
+ Int32[] valueElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int64.cs
new file mode 100644
index 0000000000..320c6d920d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int64.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsInt64()
+ {
+ var test = new VectorAs__AsInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector128<Int64> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector128<Int64> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ Vector128<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector128<Int64> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ object byteResult = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<byte>)(byteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ object doubleResult = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<double>)(doubleResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ object shortResult = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<short>)(shortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ object intResult = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<int>)(intResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ object longResult = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<long>)(longResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ object sbyteResult = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<sbyte>)(sbyteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ object floatResult = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<float>)(floatResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ object ushortResult = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ushort>)(ushortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ object uintResult = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<uint>)(uintResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetInt64());
+ object ulongResult = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector128<T> result, Vector128<Int64> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+
+ Int64[] valueElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.SByte.cs
new file mode 100644
index 0000000000..e3068dc9dc
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.SByte.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsSByte()
+ {
+ var test = new VectorAs__AsSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsSByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector128<SByte> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector128<SByte> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ Vector128<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector128<SByte> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ object byteResult = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<byte>)(byteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ object doubleResult = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<double>)(doubleResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ object shortResult = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<short>)(shortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ object intResult = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<int>)(intResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ object longResult = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<long>)(longResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ object sbyteResult = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<sbyte>)(sbyteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ object floatResult = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<float>)(floatResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ object ushortResult = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ushort>)(ushortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ object uintResult = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<uint>)(uintResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSByte());
+ object ulongResult = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector128<T> result, Vector128<SByte> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+
+ SByte[] valueElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Single.cs
new file mode 100644
index 0000000000..7dd18eb1fc
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Single.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsSingle()
+ {
+ var test = new VectorAs__AsSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsSingle
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector128<Single> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector128<Single> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ Vector128<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector128<Single> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ object byteResult = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<byte>)(byteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ object doubleResult = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<double>)(doubleResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ object shortResult = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<short>)(shortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ object intResult = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<int>)(intResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ object longResult = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<long>)(longResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ object sbyteResult = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<sbyte>)(sbyteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ object floatResult = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<float>)(floatResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ object ushortResult = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ushort>)(ushortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ object uintResult = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<uint>)(uintResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetSingle());
+ object ulongResult = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector128<T> result, Vector128<Single> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+
+ Single[] valueElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt16.cs
new file mode 100644
index 0000000000..09870f15a5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt16.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsUInt16()
+ {
+ var test = new VectorAs__AsUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsUInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector128<UInt16> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector128<UInt16> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ Vector128<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector128<UInt16> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ object byteResult = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<byte>)(byteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ object doubleResult = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<double>)(doubleResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ object shortResult = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<short>)(shortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ object intResult = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<int>)(intResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ object longResult = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<long>)(longResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ object sbyteResult = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<sbyte>)(sbyteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ object floatResult = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<float>)(floatResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ object ushortResult = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ushort>)(ushortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ object uintResult = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<uint>)(uintResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt16());
+ object ulongResult = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector128<T> result, Vector128<UInt16> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+
+ UInt16[] valueElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt32.cs
new file mode 100644
index 0000000000..cff2f35312
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt32.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsUInt32()
+ {
+ var test = new VectorAs__AsUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsUInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector128<UInt32> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector128<UInt32> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ Vector128<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector128<UInt32> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ object byteResult = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<byte>)(byteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ object doubleResult = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<double>)(doubleResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ object shortResult = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<short>)(shortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ object intResult = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<int>)(intResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ object longResult = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<long>)(longResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ object sbyteResult = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<sbyte>)(sbyteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ object floatResult = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<float>)(floatResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ object ushortResult = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ushort>)(ushortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ object uintResult = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<uint>)(uintResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt32());
+ object ulongResult = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector128<T> result, Vector128<UInt32> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+
+ UInt32[] valueElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt64.cs
new file mode 100644
index 0000000000..bc9004e160
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt64.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsUInt64()
+ {
+ var test = new VectorAs__AsUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsUInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector128<UInt64> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector128<UInt64> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ Vector128<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector128<UInt64> value;
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ object byteResult = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<byte>)(byteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ object doubleResult = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<double>)(doubleResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ object shortResult = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<short>)(shortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ object intResult = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<int>)(intResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ object longResult = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<long>)(longResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ object sbyteResult = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<sbyte>)(sbyteResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ object floatResult = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<float>)(floatResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ object ushortResult = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ushort>)(ushortResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ object uintResult = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<uint>)(uintResult), value);
+
+ value = Vector128.Create(TestLibrary.Generator.GetUInt64());
+ object ulongResult = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector128<T> result, Vector128<UInt64> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+
+ UInt64[] valueElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Byte.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Byte.0.cs
new file mode 100644
index 0000000000..7c6381a43e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Byte.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementByte0()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementByte0();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementByte0
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector128<Byte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Byte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ Vector128<Byte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector128<Byte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Byte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ object result2 = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.WithElement), new Type[] { typeof(int), typeof(Byte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Byte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Byte result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Byte> result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Byte[] result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Byte.15.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Byte.15.cs
new file mode 100644
index 0000000000..e3cf317162
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Byte.15.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementByte15()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementByte15();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementByte15
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 15, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector128<Byte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Byte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ Vector128<Byte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 15, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector128<Byte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Byte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ object result2 = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.WithElement), new Type[] { typeof(int), typeof(Byte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Byte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(15 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(15 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(15 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(15 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Byte result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[15])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.GetElement(15): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Byte> result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Byte[] result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 15) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[15] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.WithElement(15): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Byte.7.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Byte.7.cs
new file mode 100644
index 0000000000..b72c50375d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Byte.7.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementByte7()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementByte7();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementByte7
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector128<Byte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Byte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ Vector128<Byte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector128<Byte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Byte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ object result2 = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.WithElement), new Type[] { typeof(int), typeof(Byte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Byte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(7 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(7 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Byte result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[7])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.GetElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Byte> result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Byte[] result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 7) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[7] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.WithElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Double.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Double.0.cs
new file mode 100644
index 0000000000..d5f592c9a8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Double.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementDouble0()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementDouble0();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementDouble0
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector128<Double> value = Vector128.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Double result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Double insertedValue = TestLibrary.Generator.GetDouble();
+
+ try
+ {
+ Vector128<Double> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector128<Double> value = Vector128.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Double)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Double insertedValue = TestLibrary.Generator.GetDouble();
+
+ try
+ {
+ object result2 = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.WithElement), new Type[] { typeof(int), typeof(Double) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Double>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Double result, Double[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Double> result, Double[] values, Double insertedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Double[] result, Double[] values, Double insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Double.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Double.1.cs
new file mode 100644
index 0000000000..29d00ee396
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Double.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementDouble1()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementDouble1();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementDouble1
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector128<Double> value = Vector128.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Double result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Double insertedValue = TestLibrary.Generator.GetDouble();
+
+ try
+ {
+ Vector128<Double> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector128<Double> value = Vector128.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Double)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Double insertedValue = TestLibrary.Generator.GetDouble();
+
+ try
+ {
+ object result2 = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.WithElement), new Type[] { typeof(int), typeof(Double) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Double>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Double result, Double[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Double> result, Double[] values, Double insertedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Double[] result, Double[] values, Double insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int16.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int16.0.cs
new file mode 100644
index 0000000000..86ad9c62a4
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int16.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt160()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt160();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt160
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector128<Int16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ Vector128<Int16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector128<Int16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ object result2 = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.WithElement), new Type[] { typeof(int), typeof(Int16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Int16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int16 result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Int16> result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int16[] result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int16.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int16.3.cs
new file mode 100644
index 0000000000..22315c12a6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int16.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt163()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt163();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt163
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector128<Int16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ Vector128<Int16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector128<Int16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ object result2 = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.WithElement), new Type[] { typeof(int), typeof(Int16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Int16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int16 result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Int16> result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int16[] result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int16.7.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int16.7.cs
new file mode 100644
index 0000000000..3f81ddd09e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int16.7.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt167()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt167();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt167
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector128<Int16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ Vector128<Int16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector128<Int16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ object result2 = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.WithElement), new Type[] { typeof(int), typeof(Int16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Int16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(7 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(7 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int16 result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[7])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.GetElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Int16> result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int16[] result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 7) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[7] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.WithElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int32.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int32.0.cs
new file mode 100644
index 0000000000..7753c7d6db
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int32.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt320()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt320();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt320
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector128<Int32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ Vector128<Int32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector128<Int32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ object result2 = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.WithElement), new Type[] { typeof(int), typeof(Int32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Int32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int32 result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Int32> result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int32[] result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int32.1.cs
new file mode 100644
index 0000000000..0c1a8945fe
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int32.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt321()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt321();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt321
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector128<Int32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ Vector128<Int32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector128<Int32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ object result2 = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.WithElement), new Type[] { typeof(int), typeof(Int32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Int32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int32 result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Int32> result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int32[] result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int32.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int32.3.cs
new file mode 100644
index 0000000000..ba8d9b9bf8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int32.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt323()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt323();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt323
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector128<Int32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ Vector128<Int32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector128<Int32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ object result2 = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.WithElement), new Type[] { typeof(int), typeof(Int32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Int32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int32 result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Int32> result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int32[] result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int64.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int64.0.cs
new file mode 100644
index 0000000000..0271ba7eba
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int64.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt640()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt640();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt640
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector128<Int64> value = Vector128.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int64 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int64 insertedValue = TestLibrary.Generator.GetInt64();
+
+ try
+ {
+ Vector128<Int64> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector128<Int64> value = Vector128.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int64)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int64 insertedValue = TestLibrary.Generator.GetInt64();
+
+ try
+ {
+ object result2 = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.WithElement), new Type[] { typeof(int), typeof(Int64) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Int64>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int64 result, Int64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Int64> result, Int64[] values, Int64 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int64[] result, Int64[] values, Int64 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int64.1.cs
new file mode 100644
index 0000000000..06bb07d00b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Int64.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt641()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt641();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt641
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector128<Int64> value = Vector128.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int64 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int64 insertedValue = TestLibrary.Generator.GetInt64();
+
+ try
+ {
+ Vector128<Int64> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector128<Int64> value = Vector128.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int64)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int64 insertedValue = TestLibrary.Generator.GetInt64();
+
+ try
+ {
+ object result2 = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.WithElement), new Type[] { typeof(int), typeof(Int64) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Int64>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int64 result, Int64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Int64> result, Int64[] values, Int64 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int64[] result, Int64[] values, Int64 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.SByte.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.SByte.0.cs
new file mode 100644
index 0000000000..c4e43ea878
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.SByte.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSByte0()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSByte0();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSByte0
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector128<SByte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ SByte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ Vector128<SByte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector128<SByte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((SByte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ object result2 = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.WithElement), new Type[] { typeof(int), typeof(SByte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<SByte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(SByte result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<SByte> result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(SByte[] result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.SByte.15.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.SByte.15.cs
new file mode 100644
index 0000000000..6115654f98
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.SByte.15.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSByte15()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSByte15();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSByte15
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 15, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector128<SByte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ SByte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ Vector128<SByte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 15, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector128<SByte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((SByte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ object result2 = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.WithElement), new Type[] { typeof(int), typeof(SByte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<SByte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(15 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(15 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(15 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(15 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(SByte result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[15])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.GetElement(15): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<SByte> result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(SByte[] result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 15) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[15] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.WithElement(15): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.SByte.7.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.SByte.7.cs
new file mode 100644
index 0000000000..50a34c9b2a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.SByte.7.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSByte7()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSByte7();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSByte7
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector128<SByte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ SByte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ Vector128<SByte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector128<SByte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((SByte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ object result2 = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.WithElement), new Type[] { typeof(int), typeof(SByte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<SByte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(7 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(7 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(SByte result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[7])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.GetElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<SByte> result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(SByte[] result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 7) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[7] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.WithElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Single.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Single.0.cs
new file mode 100644
index 0000000000..42d23565eb
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Single.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSingle0()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSingle0();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSingle0
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector128<Single> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Single result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ Vector128<Single> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector128<Single> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Single)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ object result2 = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.WithElement), new Type[] { typeof(int), typeof(Single) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Single>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Single result, Single[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Single> result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Single[] result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Single.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Single.1.cs
new file mode 100644
index 0000000000..ec5a69033b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Single.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSingle1()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSingle1();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSingle1
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector128<Single> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Single result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ Vector128<Single> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector128<Single> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Single)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ object result2 = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.WithElement), new Type[] { typeof(int), typeof(Single) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Single>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Single result, Single[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Single> result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Single[] result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Single.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Single.3.cs
new file mode 100644
index 0000000000..422fb6a9ae
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.Single.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSingle3()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSingle3();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSingle3
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector128<Single> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Single result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ Vector128<Single> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector128<Single> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Single)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ object result2 = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.WithElement), new Type[] { typeof(int), typeof(Single) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<Single>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Single result, Single[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Single> result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Single[] result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt16.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt16.0.cs
new file mode 100644
index 0000000000..2fa0042790
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt16.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt160()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt160();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt160
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector128<UInt16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ Vector128<UInt16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector128<UInt16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ object result2 = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.WithElement), new Type[] { typeof(int), typeof(UInt16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<UInt16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt16 result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<UInt16> result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt16[] result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt16.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt16.3.cs
new file mode 100644
index 0000000000..5e11f6ed32
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt16.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt163()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt163();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt163
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector128<UInt16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ Vector128<UInt16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector128<UInt16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ object result2 = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.WithElement), new Type[] { typeof(int), typeof(UInt16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<UInt16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt16 result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<UInt16> result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt16[] result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt16.7.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt16.7.cs
new file mode 100644
index 0000000000..5d956fae96
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt16.7.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt167()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt167();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt167
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector128<UInt16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ Vector128<UInt16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector128<UInt16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ object result2 = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.WithElement), new Type[] { typeof(int), typeof(UInt16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<UInt16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(7 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(7 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt16 result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[7])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.GetElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<UInt16> result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt16[] result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 7) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[7] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.WithElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt32.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt32.0.cs
new file mode 100644
index 0000000000..636ece15d2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt32.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt320()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt320();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt320
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector128<UInt32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ Vector128<UInt32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector128<UInt32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ object result2 = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.WithElement), new Type[] { typeof(int), typeof(UInt32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<UInt32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt32 result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<UInt32> result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt32[] result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt32.1.cs
new file mode 100644
index 0000000000..918ee3d01e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt32.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt321()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt321();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt321
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector128<UInt32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ Vector128<UInt32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector128<UInt32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ object result2 = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.WithElement), new Type[] { typeof(int), typeof(UInt32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<UInt32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt32 result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<UInt32> result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt32[] result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt32.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt32.3.cs
new file mode 100644
index 0000000000..d399d450ff
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt32.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt323()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt323();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt323
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector128<UInt32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ Vector128<UInt32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector128<UInt32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ object result2 = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.WithElement), new Type[] { typeof(int), typeof(UInt32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<UInt32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt32 result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<UInt32> result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt32[] result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt64.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt64.0.cs
new file mode 100644
index 0000000000..3b547efd9d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt64.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt640()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt640();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt640
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector128<UInt64> value = Vector128.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt64 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt64 insertedValue = TestLibrary.Generator.GetUInt64();
+
+ try
+ {
+ Vector128<UInt64> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector128<UInt64> value = Vector128.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt64)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt64 insertedValue = TestLibrary.Generator.GetUInt64();
+
+ try
+ {
+ object result2 = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.WithElement), new Type[] { typeof(int), typeof(UInt64) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<UInt64>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt64 result, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<UInt64> result, UInt64[] values, UInt64 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt64[] result, UInt64[] values, UInt64 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt64.1.cs
new file mode 100644
index 0000000000..4dd57385c2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithElement.UInt64.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt641()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt641();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt641
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector128<UInt64> value = Vector128.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt64 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt64 insertedValue = TestLibrary.Generator.GetUInt64();
+
+ try
+ {
+ Vector128<UInt64> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector128<UInt64> value = Vector128.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt64)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt64 insertedValue = TestLibrary.Generator.GetUInt64();
+
+ try
+ {
+ object result2 = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.WithElement), new Type[] { typeof(int), typeof(UInt64) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector128<UInt64>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt64 result, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<UInt64> result, UInt64[] values, UInt64 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt64[] result, UInt64[] values, UInt64 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Byte.cs
new file mode 100644
index 0000000000..bb1a047899
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Byte.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperByte()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector128<Byte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ Vector64<Byte> lowerResult = value.GetLower();
+ Vector64<Byte> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector128<Byte> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector128<Byte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ object lowerResult = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector64<Byte>)(lowerResult), (Vector64<Byte>)(upperResult), values);
+
+ object result = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.WithLower), new Type[] { typeof(Vector64<Byte>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.WithUpper), new Type[] { typeof(Vector64<Byte>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector128<Byte>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector64<Byte> lowerResult, Vector64<Byte> upperResult, Byte[] values, [CallerMemberName] string method = "")
+ {
+ Byte[] lowerElements = new Byte[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref lowerElements[0]), lowerResult);
+
+ Byte[] upperElements = new Byte[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(Byte[] lowerResult, Byte[] upperResult, Byte[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Byte> result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(Byte[] result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Double.cs
new file mode 100644
index 0000000000..8ee9eb69e3
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Double.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperDouble()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperDouble
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector128<Double> value = Vector128.Create(values[0], values[1]);
+
+ Vector64<Double> lowerResult = value.GetLower();
+ Vector64<Double> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector128<Double> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector128<Double> value = Vector128.Create(values[0], values[1]);
+
+ object lowerResult = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector64<Double>)(lowerResult), (Vector64<Double>)(upperResult), values);
+
+ object result = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.WithLower), new Type[] { typeof(Vector64<Double>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.WithUpper), new Type[] { typeof(Vector64<Double>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector128<Double>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector64<Double> lowerResult, Vector64<Double> upperResult, Double[] values, [CallerMemberName] string method = "")
+ {
+ Double[] lowerElements = new Double[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref lowerElements[0]), lowerResult);
+
+ Double[] upperElements = new Double[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(Double[] lowerResult, Double[] upperResult, Double[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Double> result, Double[] values, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(Double[] result, Double[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Int16.cs
new file mode 100644
index 0000000000..9bd2f70c1e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Int16.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperInt16()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector128<Int16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ Vector64<Int16> lowerResult = value.GetLower();
+ Vector64<Int16> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector128<Int16> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector128<Int16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object lowerResult = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector64<Int16>)(lowerResult), (Vector64<Int16>)(upperResult), values);
+
+ object result = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.WithLower), new Type[] { typeof(Vector64<Int16>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.WithUpper), new Type[] { typeof(Vector64<Int16>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector128<Int16>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector64<Int16> lowerResult, Vector64<Int16> upperResult, Int16[] values, [CallerMemberName] string method = "")
+ {
+ Int16[] lowerElements = new Int16[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref lowerElements[0]), lowerResult);
+
+ Int16[] upperElements = new Int16[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(Int16[] lowerResult, Int16[] upperResult, Int16[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Int16> result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(Int16[] result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Int32.cs
new file mode 100644
index 0000000000..7554b593a8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Int32.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperInt32()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector128<Int32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ Vector64<Int32> lowerResult = value.GetLower();
+ Vector64<Int32> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector128<Int32> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector128<Int32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ object lowerResult = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector64<Int32>)(lowerResult), (Vector64<Int32>)(upperResult), values);
+
+ object result = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.WithLower), new Type[] { typeof(Vector64<Int32>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.WithUpper), new Type[] { typeof(Vector64<Int32>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector128<Int32>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector64<Int32> lowerResult, Vector64<Int32> upperResult, Int32[] values, [CallerMemberName] string method = "")
+ {
+ Int32[] lowerElements = new Int32[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref lowerElements[0]), lowerResult);
+
+ Int32[] upperElements = new Int32[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(Int32[] lowerResult, Int32[] upperResult, Int32[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Int32> result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(Int32[] result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Int64.cs
new file mode 100644
index 0000000000..7230ffaeee
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Int64.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperInt64()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector128<Int64> value = Vector128.Create(values[0], values[1]);
+
+ Vector64<Int64> lowerResult = value.GetLower();
+ Vector64<Int64> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector128<Int64> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector128<Int64> value = Vector128.Create(values[0], values[1]);
+
+ object lowerResult = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector64<Int64>)(lowerResult), (Vector64<Int64>)(upperResult), values);
+
+ object result = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.WithLower), new Type[] { typeof(Vector64<Int64>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.WithUpper), new Type[] { typeof(Vector64<Int64>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector128<Int64>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector64<Int64> lowerResult, Vector64<Int64> upperResult, Int64[] values, [CallerMemberName] string method = "")
+ {
+ Int64[] lowerElements = new Int64[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref lowerElements[0]), lowerResult);
+
+ Int64[] upperElements = new Int64[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(Int64[] lowerResult, Int64[] upperResult, Int64[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Int64> result, Int64[] values, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(Int64[] result, Int64[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.SByte.cs
new file mode 100644
index 0000000000..1d2740a391
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.SByte.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperSByte()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperSByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector128<SByte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ Vector64<SByte> lowerResult = value.GetLower();
+ Vector64<SByte> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector128<SByte> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector128<SByte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ object lowerResult = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector64<SByte>)(lowerResult), (Vector64<SByte>)(upperResult), values);
+
+ object result = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.WithLower), new Type[] { typeof(Vector64<SByte>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.WithUpper), new Type[] { typeof(Vector64<SByte>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector128<SByte>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector64<SByte> lowerResult, Vector64<SByte> upperResult, SByte[] values, [CallerMemberName] string method = "")
+ {
+ SByte[] lowerElements = new SByte[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref lowerElements[0]), lowerResult);
+
+ SByte[] upperElements = new SByte[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(SByte[] lowerResult, SByte[] upperResult, SByte[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<SByte> result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(SByte[] result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Single.cs
new file mode 100644
index 0000000000..e5920b1247
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.Single.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperSingle()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperSingle
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector128<Single> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ Vector64<Single> lowerResult = value.GetLower();
+ Vector64<Single> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector128<Single> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector128<Single> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ object lowerResult = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector64<Single>)(lowerResult), (Vector64<Single>)(upperResult), values);
+
+ object result = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.WithLower), new Type[] { typeof(Vector64<Single>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.WithUpper), new Type[] { typeof(Vector64<Single>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector128<Single>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector64<Single> lowerResult, Vector64<Single> upperResult, Single[] values, [CallerMemberName] string method = "")
+ {
+ Single[] lowerElements = new Single[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref lowerElements[0]), lowerResult);
+
+ Single[] upperElements = new Single[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(Single[] lowerResult, Single[] upperResult, Single[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<Single> result, Single[] values, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(Single[] result, Single[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.UInt16.cs
new file mode 100644
index 0000000000..fd18b77d79
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.UInt16.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperUInt16()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperUInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector128<UInt16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ Vector64<UInt16> lowerResult = value.GetLower();
+ Vector64<UInt16> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector128<UInt16> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector128<UInt16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object lowerResult = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector64<UInt16>)(lowerResult), (Vector64<UInt16>)(upperResult), values);
+
+ object result = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.WithLower), new Type[] { typeof(Vector64<UInt16>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.WithUpper), new Type[] { typeof(Vector64<UInt16>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector128<UInt16>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector64<UInt16> lowerResult, Vector64<UInt16> upperResult, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ UInt16[] lowerElements = new UInt16[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref lowerElements[0]), lowerResult);
+
+ UInt16[] upperElements = new UInt16[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(UInt16[] lowerResult, UInt16[] upperResult, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<UInt16> result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(UInt16[] result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.UInt32.cs
new file mode 100644
index 0000000000..64bce168b1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.UInt32.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperUInt32()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperUInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector128<UInt32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ Vector64<UInt32> lowerResult = value.GetLower();
+ Vector64<UInt32> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector128<UInt32> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector128<UInt32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ object lowerResult = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector64<UInt32>)(lowerResult), (Vector64<UInt32>)(upperResult), values);
+
+ object result = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.WithLower), new Type[] { typeof(Vector64<UInt32>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.WithUpper), new Type[] { typeof(Vector64<UInt32>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector128<UInt32>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector64<UInt32> lowerResult, Vector64<UInt32> upperResult, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ UInt32[] lowerElements = new UInt32[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref lowerElements[0]), lowerResult);
+
+ UInt32[] upperElements = new UInt32[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(UInt32[] lowerResult, UInt32[] upperResult, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<UInt32> result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(UInt32[] result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.UInt64.cs
new file mode 100644
index 0000000000..cf3d7b710f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/GetAndWithLowerAndUpper.UInt64.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperUInt64()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperUInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector128<UInt64> value = Vector128.Create(values[0], values[1]);
+
+ Vector64<UInt64> lowerResult = value.GetLower();
+ Vector64<UInt64> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector128<UInt64> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector128<UInt64> value = Vector128.Create(values[0], values[1]);
+
+ object lowerResult = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector64<UInt64>)(lowerResult), (Vector64<UInt64>)(upperResult), values);
+
+ object result = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.WithLower), new Type[] { typeof(Vector64<UInt64>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.WithUpper), new Type[] { typeof(Vector64<UInt64>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector128<UInt64>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector64<UInt64> lowerResult, Vector64<UInt64> upperResult, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ UInt64[] lowerElements = new UInt64[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref lowerElements[0]), lowerResult);
+
+ UInt64[] upperElements = new UInt64[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(UInt64[] lowerResult, UInt64[] upperResult, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector128<UInt64> result, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(UInt64[] result, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Program.Vector128_1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Program.Vector128_1.cs
new file mode 100644
index 0000000000..24fed272d4
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Program.Vector128_1.cs
@@ -0,0 +1,95 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["Zero.Byte"] = ZeroByte,
+ ["Zero.Double"] = ZeroDouble,
+ ["Zero.Int16"] = ZeroInt16,
+ ["Zero.Int32"] = ZeroInt32,
+ ["Zero.Int64"] = ZeroInt64,
+ ["Zero.SByte"] = ZeroSByte,
+ ["Zero.Single"] = ZeroSingle,
+ ["Zero.UInt16"] = ZeroUInt16,
+ ["Zero.UInt32"] = ZeroUInt32,
+ ["Zero.UInt64"] = ZeroUInt64,
+ ["As.Byte"] = AsByte,
+ ["As.Double"] = AsDouble,
+ ["As.Int16"] = AsInt16,
+ ["As.Int32"] = AsInt32,
+ ["As.Int64"] = AsInt64,
+ ["As.SByte"] = AsSByte,
+ ["As.Single"] = AsSingle,
+ ["As.UInt16"] = AsUInt16,
+ ["As.UInt32"] = AsUInt32,
+ ["As.UInt64"] = AsUInt64,
+ ["GetAndWithElement.Byte.0"] = GetAndWithElementByte0,
+ ["GetAndWithElement.Byte.7"] = GetAndWithElementByte7,
+ ["GetAndWithElement.Byte.15"] = GetAndWithElementByte15,
+ ["GetAndWithElement.Double.0"] = GetAndWithElementDouble0,
+ ["GetAndWithElement.Double.1"] = GetAndWithElementDouble1,
+ ["GetAndWithElement.Int16.0"] = GetAndWithElementInt160,
+ ["GetAndWithElement.Int16.3"] = GetAndWithElementInt163,
+ ["GetAndWithElement.Int16.7"] = GetAndWithElementInt167,
+ ["GetAndWithElement.Int32.0"] = GetAndWithElementInt320,
+ ["GetAndWithElement.Int32.1"] = GetAndWithElementInt321,
+ ["GetAndWithElement.Int32.3"] = GetAndWithElementInt323,
+ ["GetAndWithElement.Int64.0"] = GetAndWithElementInt640,
+ ["GetAndWithElement.Int64.1"] = GetAndWithElementInt641,
+ ["GetAndWithElement.SByte.0"] = GetAndWithElementSByte0,
+ ["GetAndWithElement.SByte.7"] = GetAndWithElementSByte7,
+ ["GetAndWithElement.SByte.15"] = GetAndWithElementSByte15,
+ ["GetAndWithElement.Single.0"] = GetAndWithElementSingle0,
+ ["GetAndWithElement.Single.1"] = GetAndWithElementSingle1,
+ ["GetAndWithElement.Single.3"] = GetAndWithElementSingle3,
+ ["GetAndWithElement.UInt16.0"] = GetAndWithElementUInt160,
+ ["GetAndWithElement.UInt16.3"] = GetAndWithElementUInt163,
+ ["GetAndWithElement.UInt16.7"] = GetAndWithElementUInt167,
+ ["GetAndWithElement.UInt32.0"] = GetAndWithElementUInt320,
+ ["GetAndWithElement.UInt32.1"] = GetAndWithElementUInt321,
+ ["GetAndWithElement.UInt32.3"] = GetAndWithElementUInt323,
+ ["GetAndWithElement.UInt64.0"] = GetAndWithElementUInt640,
+ ["GetAndWithElement.UInt64.1"] = GetAndWithElementUInt641,
+ ["GetAndWithLowerAndUpper.Byte"] = GetAndWithLowerAndUpperByte,
+ ["GetAndWithLowerAndUpper.Double"] = GetAndWithLowerAndUpperDouble,
+ ["GetAndWithLowerAndUpper.Int16"] = GetAndWithLowerAndUpperInt16,
+ ["GetAndWithLowerAndUpper.Int32"] = GetAndWithLowerAndUpperInt32,
+ ["GetAndWithLowerAndUpper.Int64"] = GetAndWithLowerAndUpperInt64,
+ ["GetAndWithLowerAndUpper.SByte"] = GetAndWithLowerAndUpperSByte,
+ ["GetAndWithLowerAndUpper.Single"] = GetAndWithLowerAndUpperSingle,
+ ["GetAndWithLowerAndUpper.UInt16"] = GetAndWithLowerAndUpperUInt16,
+ ["GetAndWithLowerAndUpper.UInt32"] = GetAndWithLowerAndUpperUInt32,
+ ["GetAndWithLowerAndUpper.UInt64"] = GetAndWithLowerAndUpperUInt64,
+ ["ToScalar.Byte"] = ToScalarByte,
+ ["ToScalar.Double"] = ToScalarDouble,
+ ["ToScalar.Int16"] = ToScalarInt16,
+ ["ToScalar.Int32"] = ToScalarInt32,
+ ["ToScalar.Int64"] = ToScalarInt64,
+ ["ToScalar.SByte"] = ToScalarSByte,
+ ["ToScalar.Single"] = ToScalarSingle,
+ ["ToScalar.UInt16"] = ToScalarUInt16,
+ ["ToScalar.UInt32"] = ToScalarUInt32,
+ ["ToScalar.UInt64"] = ToScalarUInt64,
+ ["ToVector256.Byte"] = ToVector256Byte,
+ ["ToVector256.Double"] = ToVector256Double,
+ ["ToVector256.Int16"] = ToVector256Int16,
+ ["ToVector256.Int32"] = ToVector256Int32,
+ ["ToVector256.Int64"] = ToVector256Int64,
+ ["ToVector256.SByte"] = ToVector256SByte,
+ ["ToVector256.Single"] = ToVector256Single,
+ ["ToVector256.UInt16"] = ToVector256UInt16,
+ ["ToVector256.UInt32"] = ToVector256UInt32,
+ ["ToVector256.UInt64"] = ToVector256UInt64,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Byte.cs
new file mode 100644
index 0000000000..75cbf712f8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Byte.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarByte()
+ {
+ var test = new VectorToScalar__ToScalarByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector128<Byte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ Byte result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector128<Byte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ object result = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Byte)(result), values);
+ }
+
+ private void ValidateResult(Byte result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Double.cs
new file mode 100644
index 0000000000..471b8a336c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Double.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarDouble()
+ {
+ var test = new VectorToScalar__ToScalarDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarDouble
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector128<Double> value = Vector128.Create(values[0], values[1]);
+
+ Double result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector128<Double> value = Vector128.Create(values[0], values[1]);
+
+ object result = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Double)(result), values);
+ }
+
+ private void ValidateResult(Double result, Double[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Int16.cs
new file mode 100644
index 0000000000..54777c9589
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Int16.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarInt16()
+ {
+ var test = new VectorToScalar__ToScalarInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector128<Int16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ Int16 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector128<Int16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object result = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Int16)(result), values);
+ }
+
+ private void ValidateResult(Int16 result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Int32.cs
new file mode 100644
index 0000000000..4ba00f9792
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Int32.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarInt32()
+ {
+ var test = new VectorToScalar__ToScalarInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector128<Int32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ Int32 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector128<Int32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ object result = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Int32)(result), values);
+ }
+
+ private void ValidateResult(Int32 result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Int64.cs
new file mode 100644
index 0000000000..f3e2d1faac
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Int64.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarInt64()
+ {
+ var test = new VectorToScalar__ToScalarInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector128<Int64> value = Vector128.Create(values[0], values[1]);
+
+ Int64 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector128<Int64> value = Vector128.Create(values[0], values[1]);
+
+ object result = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Int64)(result), values);
+ }
+
+ private void ValidateResult(Int64 result, Int64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.SByte.cs
new file mode 100644
index 0000000000..db795978a3
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.SByte.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarSByte()
+ {
+ var test = new VectorToScalar__ToScalarSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarSByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector128<SByte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ SByte result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector128<SByte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ object result = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((SByte)(result), values);
+ }
+
+ private void ValidateResult(SByte result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Single.cs
new file mode 100644
index 0000000000..683987cba8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.Single.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarSingle()
+ {
+ var test = new VectorToScalar__ToScalarSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarSingle
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector128<Single> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ Single result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector128<Single> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ object result = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Single)(result), values);
+ }
+
+ private void ValidateResult(Single result, Single[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.UInt16.cs
new file mode 100644
index 0000000000..cfd8a6e65a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.UInt16.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarUInt16()
+ {
+ var test = new VectorToScalar__ToScalarUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarUInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector128<UInt16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ UInt16 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector128<UInt16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object result = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((UInt16)(result), values);
+ }
+
+ private void ValidateResult(UInt16 result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.UInt32.cs
new file mode 100644
index 0000000000..912e3acb36
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.UInt32.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarUInt32()
+ {
+ var test = new VectorToScalar__ToScalarUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarUInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector128<UInt32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ UInt32 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector128<UInt32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ object result = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((UInt32)(result), values);
+ }
+
+ private void ValidateResult(UInt32 result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.UInt64.cs
new file mode 100644
index 0000000000..c73eb28510
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToScalar.UInt64.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarUInt64()
+ {
+ var test = new VectorToScalar__ToScalarUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarUInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector128<UInt64> value = Vector128.Create(values[0], values[1]);
+
+ UInt64 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector128<UInt64> value = Vector128.Create(values[0], values[1]);
+
+ object result = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((UInt64)(result), values);
+ }
+
+ private void ValidateResult(UInt64 result, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Byte.cs
new file mode 100644
index 0000000000..3ac4bd5cf4
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Byte.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector256Byte()
+ {
+ var test = new VectorExtend__ToVector256Byte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector256Byte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector128<Byte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ Vector256<Byte> result = value.ToVector256();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector256<Byte> unsafeResult = value.ToVector256Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector128<Byte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ object result = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<Byte>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector128<Byte>)
+ .GetMethod(nameof(Vector128<Byte>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<Byte>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector256<Byte> result, Byte[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(Byte[] result, Byte[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Byte>.ToVector256{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Double.cs
new file mode 100644
index 0000000000..a3d553b3c5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Double.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector256Double()
+ {
+ var test = new VectorExtend__ToVector256Double();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector256Double
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector128<Double> value = Vector128.Create(values[0], values[1]);
+
+ Vector256<Double> result = value.ToVector256();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector256<Double> unsafeResult = value.ToVector256Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector128<Double> value = Vector128.Create(values[0], values[1]);
+
+ object result = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<Double>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector128<Double>)
+ .GetMethod(nameof(Vector128<Double>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<Double>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector256<Double> result, Double[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(Double[] result, Double[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Double>.ToVector256{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Int16.cs
new file mode 100644
index 0000000000..ab17989232
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Int16.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector256Int16()
+ {
+ var test = new VectorExtend__ToVector256Int16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector256Int16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector128<Int16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ Vector256<Int16> result = value.ToVector256();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector256<Int16> unsafeResult = value.ToVector256Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector128<Int16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object result = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<Int16>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector128<Int16>)
+ .GetMethod(nameof(Vector128<Int16>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<Int16>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector256<Int16> result, Int16[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(Int16[] result, Int16[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int16>.ToVector256{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Int32.cs
new file mode 100644
index 0000000000..c111973b53
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Int32.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector256Int32()
+ {
+ var test = new VectorExtend__ToVector256Int32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector256Int32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector128<Int32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ Vector256<Int32> result = value.ToVector256();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector256<Int32> unsafeResult = value.ToVector256Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector128<Int32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ object result = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<Int32>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector128<Int32>)
+ .GetMethod(nameof(Vector128<Int32>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<Int32>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector256<Int32> result, Int32[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(Int32[] result, Int32[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int32>.ToVector256{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Int64.cs
new file mode 100644
index 0000000000..4d0b9313fd
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Int64.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector256Int64()
+ {
+ var test = new VectorExtend__ToVector256Int64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector256Int64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector128<Int64> value = Vector128.Create(values[0], values[1]);
+
+ Vector256<Int64> result = value.ToVector256();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector256<Int64> unsafeResult = value.ToVector256Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector128<Int64> value = Vector128.Create(values[0], values[1]);
+
+ object result = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<Int64>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector128<Int64>)
+ .GetMethod(nameof(Vector128<Int64>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<Int64>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector256<Int64> result, Int64[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(Int64[] result, Int64[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Int64>.ToVector256{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.SByte.cs
new file mode 100644
index 0000000000..247735903c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.SByte.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector256SByte()
+ {
+ var test = new VectorExtend__ToVector256SByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector256SByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector128<SByte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ Vector256<SByte> result = value.ToVector256();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector256<SByte> unsafeResult = value.ToVector256Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector128<SByte> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ object result = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<SByte>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector128<SByte>)
+ .GetMethod(nameof(Vector128<SByte>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<SByte>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector256<SByte> result, SByte[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(SByte[] result, SByte[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<SByte>.ToVector256{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Single.cs
new file mode 100644
index 0000000000..674dee6091
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.Single.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector256Single()
+ {
+ var test = new VectorExtend__ToVector256Single();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector256Single
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector128<Single> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ Vector256<Single> result = value.ToVector256();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector256<Single> unsafeResult = value.ToVector256Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector128<Single> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ object result = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<Single>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector128<Single>)
+ .GetMethod(nameof(Vector128<Single>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<Single>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector256<Single> result, Single[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(Single[] result, Single[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<Single>.ToVector256{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.UInt16.cs
new file mode 100644
index 0000000000..9761b39724
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.UInt16.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector256UInt16()
+ {
+ var test = new VectorExtend__ToVector256UInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector256UInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector128<UInt16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ Vector256<UInt16> result = value.ToVector256();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector256<UInt16> unsafeResult = value.ToVector256Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector128<UInt16> value = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object result = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<UInt16>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector128<UInt16>)
+ .GetMethod(nameof(Vector128<UInt16>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<UInt16>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector256<UInt16> result, UInt16[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(UInt16[] result, UInt16[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt16>.ToVector256{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.UInt32.cs
new file mode 100644
index 0000000000..df2df66a0b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.UInt32.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector256UInt32()
+ {
+ var test = new VectorExtend__ToVector256UInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector256UInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector128<UInt32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ Vector256<UInt32> result = value.ToVector256();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector256<UInt32> unsafeResult = value.ToVector256Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector128<UInt32> value = Vector128.Create(values[0], values[1], values[2], values[3]);
+
+ object result = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<UInt32>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector128<UInt32>)
+ .GetMethod(nameof(Vector128<UInt32>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<UInt32>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector256<UInt32> result, UInt32[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(UInt32[] result, UInt32[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt32>.ToVector256{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.UInt64.cs
new file mode 100644
index 0000000000..987b927eed
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToVector256.UInt64.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector256UInt64()
+ {
+ var test = new VectorExtend__ToVector256UInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector256UInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector128<UInt64> value = Vector128.Create(values[0], values[1]);
+
+ Vector256<UInt64> result = value.ToVector256();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector256<UInt64> unsafeResult = value.ToVector256Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector128<UInt64> value = Vector128.Create(values[0], values[1]);
+
+ object result = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<UInt64>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector128<UInt64>)
+ .GetMethod(nameof(Vector128<UInt64>.ToVector256), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<UInt64>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector256<UInt64> result, UInt64[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(UInt64[] result, UInt64[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128<UInt64>.ToVector256{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_r.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_r.csproj
new file mode 100644
index 0000000000..7d92e92129
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_r.csproj
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Embedded</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="As.Byte.cs" />
+ <Compile Include="As.Double.cs" />
+ <Compile Include="As.Int16.cs" />
+ <Compile Include="As.Int32.cs" />
+ <Compile Include="As.Int64.cs" />
+ <Compile Include="As.SByte.cs" />
+ <Compile Include="As.Single.cs" />
+ <Compile Include="As.UInt16.cs" />
+ <Compile Include="As.UInt32.cs" />
+ <Compile Include="As.UInt64.cs" />
+
+ <Compile Include="GetAndWithElement.Byte.0.cs" />
+ <Compile Include="GetAndWithElement.Byte.7.cs" />
+ <Compile Include="GetAndWithElement.Byte.15.cs" />
+ <Compile Include="GetAndWithElement.Double.0.cs" />
+ <Compile Include="GetAndWithElement.Double.1.cs" />
+ <Compile Include="GetAndWithElement.Int16.0.cs" />
+ <Compile Include="GetAndWithElement.Int16.3.cs" />
+ <Compile Include="GetAndWithElement.Int16.7.cs" />
+ <Compile Include="GetAndWithElement.Int32.0.cs" />
+ <Compile Include="GetAndWithElement.Int32.1.cs" />
+ <Compile Include="GetAndWithElement.Int32.3.cs" />
+ <Compile Include="GetAndWithElement.Int64.0.cs" />
+ <Compile Include="GetAndWithElement.Int64.1.cs" />
+ <Compile Include="GetAndWithElement.SByte.0.cs" />
+ <Compile Include="GetAndWithElement.SByte.7.cs" />
+ <Compile Include="GetAndWithElement.SByte.15.cs" />
+ <Compile Include="GetAndWithElement.Single.0.cs" />
+ <Compile Include="GetAndWithElement.Single.1.cs" />
+ <Compile Include="GetAndWithElement.Single.3.cs" />
+ <Compile Include="GetAndWithElement.UInt16.0.cs" />
+ <Compile Include="GetAndWithElement.UInt16.3.cs" />
+ <Compile Include="GetAndWithElement.UInt16.7.cs" />
+ <Compile Include="GetAndWithElement.UInt32.0.cs" />
+ <Compile Include="GetAndWithElement.UInt32.1.cs" />
+ <Compile Include="GetAndWithElement.UInt32.3.cs" />
+ <Compile Include="GetAndWithElement.UInt64.0.cs" />
+ <Compile Include="GetAndWithElement.UInt64.1.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Byte.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Double.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Int16.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Int32.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Int64.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.SByte.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Single.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.UInt16.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.UInt32.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.UInt64.cs" />
+ <Compile Include="ToScalar.Byte.cs" />
+ <Compile Include="ToScalar.Double.cs" />
+ <Compile Include="ToScalar.Int16.cs" />
+ <Compile Include="ToScalar.Int32.cs" />
+ <Compile Include="ToScalar.Int64.cs" />
+ <Compile Include="ToScalar.SByte.cs" />
+ <Compile Include="ToScalar.Single.cs" />
+ <Compile Include="ToScalar.UInt16.cs" />
+ <Compile Include="ToScalar.UInt32.cs" />
+ <Compile Include="ToScalar.UInt64.cs" />
+ <Compile Include="ToVector256.Byte.cs" />
+ <Compile Include="ToVector256.Double.cs" />
+ <Compile Include="ToVector256.Int16.cs" />
+ <Compile Include="ToVector256.Int32.cs" />
+ <Compile Include="ToVector256.Int64.cs" />
+ <Compile Include="ToVector256.SByte.cs" />
+ <Compile Include="ToVector256.Single.cs" />
+ <Compile Include="ToVector256.UInt16.cs" />
+ <Compile Include="ToVector256.UInt32.cs" />
+ <Compile Include="ToVector256.UInt64.cs" />
+ <Compile Include="Zero.Byte.cs" />
+ <Compile Include="Zero.Double.cs" />
+ <Compile Include="Zero.Int16.cs" />
+ <Compile Include="Zero.Int32.cs" />
+ <Compile Include="Zero.Int64.cs" />
+ <Compile Include="Zero.SByte.cs" />
+ <Compile Include="Zero.Single.cs" />
+ <Compile Include="Zero.UInt16.cs" />
+ <Compile Include="Zero.UInt32.cs" />
+ <Compile Include="Zero.UInt64.cs" />
+ <Compile Include="Program.Vector128_1.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_ro.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_ro.csproj
new file mode 100644
index 0000000000..1e524979c6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_ro.csproj
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Embedded</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="As.Byte.cs" />
+ <Compile Include="As.Double.cs" />
+ <Compile Include="As.Int16.cs" />
+ <Compile Include="As.Int32.cs" />
+ <Compile Include="As.Int64.cs" />
+ <Compile Include="As.SByte.cs" />
+ <Compile Include="As.Single.cs" />
+ <Compile Include="As.UInt16.cs" />
+ <Compile Include="As.UInt32.cs" />
+ <Compile Include="As.UInt64.cs" />
+ <Compile Include="GetAndWithElement.Byte.0.cs" />
+ <Compile Include="GetAndWithElement.Byte.7.cs" />
+ <Compile Include="GetAndWithElement.Byte.15.cs" />
+ <Compile Include="GetAndWithElement.Double.0.cs" />
+ <Compile Include="GetAndWithElement.Double.1.cs" />
+ <Compile Include="GetAndWithElement.Int16.0.cs" />
+ <Compile Include="GetAndWithElement.Int16.3.cs" />
+ <Compile Include="GetAndWithElement.Int16.7.cs" />
+ <Compile Include="GetAndWithElement.Int32.0.cs" />
+ <Compile Include="GetAndWithElement.Int32.1.cs" />
+ <Compile Include="GetAndWithElement.Int32.3.cs" />
+ <Compile Include="GetAndWithElement.Int64.0.cs" />
+ <Compile Include="GetAndWithElement.Int64.1.cs" />
+ <Compile Include="GetAndWithElement.SByte.0.cs" />
+ <Compile Include="GetAndWithElement.SByte.7.cs" />
+ <Compile Include="GetAndWithElement.SByte.15.cs" />
+ <Compile Include="GetAndWithElement.Single.0.cs" />
+ <Compile Include="GetAndWithElement.Single.1.cs" />
+ <Compile Include="GetAndWithElement.Single.3.cs" />
+ <Compile Include="GetAndWithElement.UInt16.0.cs" />
+ <Compile Include="GetAndWithElement.UInt16.3.cs" />
+ <Compile Include="GetAndWithElement.UInt16.7.cs" />
+ <Compile Include="GetAndWithElement.UInt32.0.cs" />
+ <Compile Include="GetAndWithElement.UInt32.1.cs" />
+ <Compile Include="GetAndWithElement.UInt32.3.cs" />
+ <Compile Include="GetAndWithElement.UInt64.0.cs" />
+ <Compile Include="GetAndWithElement.UInt64.1.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Byte.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Double.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Int16.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Int32.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Int64.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.SByte.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Single.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.UInt16.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.UInt32.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.UInt64.cs" />
+ <Compile Include="ToScalar.Byte.cs" />
+ <Compile Include="ToScalar.Double.cs" />
+ <Compile Include="ToScalar.Int16.cs" />
+ <Compile Include="ToScalar.Int32.cs" />
+ <Compile Include="ToScalar.Int64.cs" />
+ <Compile Include="ToScalar.SByte.cs" />
+ <Compile Include="ToScalar.Single.cs" />
+ <Compile Include="ToScalar.UInt16.cs" />
+ <Compile Include="ToScalar.UInt32.cs" />
+ <Compile Include="ToScalar.UInt64.cs" />
+ <Compile Include="ToVector256.Byte.cs" />
+ <Compile Include="ToVector256.Double.cs" />
+ <Compile Include="ToVector256.Int16.cs" />
+ <Compile Include="ToVector256.Int32.cs" />
+ <Compile Include="ToVector256.Int64.cs" />
+ <Compile Include="ToVector256.SByte.cs" />
+ <Compile Include="ToVector256.Single.cs" />
+ <Compile Include="ToVector256.UInt16.cs" />
+ <Compile Include="ToVector256.UInt32.cs" />
+ <Compile Include="ToVector256.UInt64.cs" />
+ <Compile Include="Zero.Byte.cs" />
+ <Compile Include="Zero.Double.cs" />
+ <Compile Include="Zero.Int16.cs" />
+ <Compile Include="Zero.Int32.cs" />
+ <Compile Include="Zero.Int64.cs" />
+ <Compile Include="Zero.SByte.cs" />
+ <Compile Include="Zero.Single.cs" />
+ <Compile Include="Zero.UInt16.cs" />
+ <Compile Include="Zero.UInt32.cs" />
+ <Compile Include="Zero.UInt64.cs" />
+ <Compile Include="Program.Vector128_1.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Byte.cs
new file mode 100644
index 0000000000..c9bee9a352
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Byte.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroByte()
+ {
+ var test = new VectorZero__ZeroByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector128<Byte> result = Vector128<Byte>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector128<Byte>)
+ .GetProperty(nameof(Vector128<Byte>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector128<Byte>)(result));
+ }
+
+ private void ValidateResult(Vector128<Byte> result, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Zero(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Double.cs
new file mode 100644
index 0000000000..c874641e07
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Double.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroDouble()
+ {
+ var test = new VectorZero__ZeroDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroDouble
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector128<Double> result = Vector128<Double>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector128<Double>)
+ .GetProperty(nameof(Vector128<Double>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector128<Double>)(result));
+ }
+
+ private void ValidateResult(Vector128<Double> result, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Zero(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Int16.cs
new file mode 100644
index 0000000000..896806f713
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Int16.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroInt16()
+ {
+ var test = new VectorZero__ZeroInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector128<Int16> result = Vector128<Int16>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector128<Int16>)
+ .GetProperty(nameof(Vector128<Int16>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector128<Int16>)(result));
+ }
+
+ private void ValidateResult(Vector128<Int16> result, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Zero(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Int32.cs
new file mode 100644
index 0000000000..1a68bbeab9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Int32.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroInt32()
+ {
+ var test = new VectorZero__ZeroInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector128<Int32> result = Vector128<Int32>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector128<Int32>)
+ .GetProperty(nameof(Vector128<Int32>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector128<Int32>)(result));
+ }
+
+ private void ValidateResult(Vector128<Int32> result, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Zero(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Int64.cs
new file mode 100644
index 0000000000..4b1ed7656b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Int64.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroInt64()
+ {
+ var test = new VectorZero__ZeroInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector128<Int64> result = Vector128<Int64>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector128<Int64>)
+ .GetProperty(nameof(Vector128<Int64>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector128<Int64>)(result));
+ }
+
+ private void ValidateResult(Vector128<Int64> result, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Zero(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.SByte.cs
new file mode 100644
index 0000000000..14d59b20c8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.SByte.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroSByte()
+ {
+ var test = new VectorZero__ZeroSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroSByte
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector128<SByte> result = Vector128<SByte>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector128<SByte>)
+ .GetProperty(nameof(Vector128<SByte>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector128<SByte>)(result));
+ }
+
+ private void ValidateResult(Vector128<SByte> result, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Zero(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Single.cs
new file mode 100644
index 0000000000..a734db183b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.Single.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroSingle()
+ {
+ var test = new VectorZero__ZeroSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroSingle
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector128<Single> result = Vector128<Single>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector128<Single>)
+ .GetProperty(nameof(Vector128<Single>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector128<Single>)(result));
+ }
+
+ private void ValidateResult(Vector128<Single> result, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Zero(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.UInt16.cs
new file mode 100644
index 0000000000..8aa3b9b311
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.UInt16.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroUInt16()
+ {
+ var test = new VectorZero__ZeroUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroUInt16
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector128<UInt16> result = Vector128<UInt16>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector128<UInt16>)
+ .GetProperty(nameof(Vector128<UInt16>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector128<UInt16>)(result));
+ }
+
+ private void ValidateResult(Vector128<UInt16> result, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Zero(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.UInt32.cs
new file mode 100644
index 0000000000..5d85256cc9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.UInt32.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroUInt32()
+ {
+ var test = new VectorZero__ZeroUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroUInt32
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector128<UInt32> result = Vector128<UInt32>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector128<UInt32>)
+ .GetProperty(nameof(Vector128<UInt32>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector128<UInt32>)(result));
+ }
+
+ private void ValidateResult(Vector128<UInt32> result, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Zero(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.UInt64.cs
new file mode 100644
index 0000000000..544891b54d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Zero.UInt64.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroUInt64()
+ {
+ var test = new VectorZero__ZeroUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroUInt64
+ {
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector128<UInt64> result = Vector128<UInt64>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector128<UInt64>)
+ .GetProperty(nameof(Vector128<UInt64>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector128<UInt64>)(result));
+ }
+
+ private void ValidateResult(Vector128<UInt64> result, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector128.Zero(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Byte.cs
new file mode 100644
index 0000000000..cf801d98c0
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Byte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateByte()
+ {
+ var test = new VectorCreate__CreateByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ Vector256<Byte> result = Vector256.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Byte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Byte>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Byte> result, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Double.cs
new file mode 100644
index 0000000000..d90d559f31
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Double.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateDouble()
+ {
+ var test = new VectorCreate__CreateDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateDouble
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ Vector256<Double> result = Vector256.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Double) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Double>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Double> result, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Int16.cs
new file mode 100644
index 0000000000..8e2147599e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Int16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateInt16()
+ {
+ var test = new VectorCreate__CreateInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ Vector256<Int16> result = Vector256.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Int16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Int16>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Int16> result, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Int32.cs
new file mode 100644
index 0000000000..2d39b41cdf
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Int32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateInt32()
+ {
+ var test = new VectorCreate__CreateInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ Vector256<Int32> result = Vector256.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Int32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Int32>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Int32> result, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Int64.cs
new file mode 100644
index 0000000000..1fd8d6499c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Int64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateInt64()
+ {
+ var test = new VectorCreate__CreateInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ Vector256<Int64> result = Vector256.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Int64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Int64>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Int64> result, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.SByte.cs
new file mode 100644
index 0000000000..08768e1167
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.SByte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateSByte()
+ {
+ var test = new VectorCreate__CreateSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateSByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ Vector256<SByte> result = Vector256.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(SByte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<SByte>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<SByte> result, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Single.cs
new file mode 100644
index 0000000000..507ed26e53
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.Single.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateSingle()
+ {
+ var test = new VectorCreate__CreateSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateSingle
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ Vector256<Single> result = Vector256.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Single) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Single>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Single> result, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.UInt16.cs
new file mode 100644
index 0000000000..f81d47771b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.UInt16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateUInt16()
+ {
+ var test = new VectorCreate__CreateUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateUInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ Vector256<UInt16> result = Vector256.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(UInt16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<UInt16>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<UInt16> result, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.UInt32.cs
new file mode 100644
index 0000000000..2f2c7880ad
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.UInt32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateUInt32()
+ {
+ var test = new VectorCreate__CreateUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateUInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ Vector256<UInt32> result = Vector256.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(UInt32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<UInt32>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<UInt32> result, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.UInt64.cs
new file mode 100644
index 0000000000..15b01afa47
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Create.UInt64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateUInt64()
+ {
+ var test = new VectorCreate__CreateUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateUInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ Vector256<UInt64> result = Vector256.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(UInt64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<UInt64>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<UInt64> result, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Byte.cs
new file mode 100644
index 0000000000..e098284231
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Byte.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementByte()
+ {
+ var test = new VectorCreate__CreateElementByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector256<Byte> result = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Byte);
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31] });
+
+ ValidateResult((Vector256<Byte>)(result), values);
+ }
+
+ private void ValidateResult(Vector256<Byte> result, Byte[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Double.cs
new file mode 100644
index 0000000000..e78e15f6fa
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Double.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementDouble()
+ {
+ var test = new VectorCreate__CreateElementDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementDouble
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector256<Double> result = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Double);
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3] });
+
+ ValidateResult((Vector256<Double>)(result), values);
+ }
+
+ private void ValidateResult(Vector256<Double> result, Double[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Int16.cs
new file mode 100644
index 0000000000..83827307e7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Int16.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementInt16()
+ {
+ var test = new VectorCreate__CreateElementInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector256<Int16> result = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Int16);
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15] });
+
+ ValidateResult((Vector256<Int16>)(result), values);
+ }
+
+ private void ValidateResult(Vector256<Int16> result, Int16[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Int32.cs
new file mode 100644
index 0000000000..1c0ab74f2f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Int32.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementInt32()
+ {
+ var test = new VectorCreate__CreateElementInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector256<Int32> result = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Int32);
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7] });
+
+ ValidateResult((Vector256<Int32>)(result), values);
+ }
+
+ private void ValidateResult(Vector256<Int32> result, Int32[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Int64.cs
new file mode 100644
index 0000000000..6ef8569532
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Int64.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementInt64()
+ {
+ var test = new VectorCreate__CreateElementInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector256<Int64> result = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Int64);
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3] });
+
+ ValidateResult((Vector256<Int64>)(result), values);
+ }
+
+ private void ValidateResult(Vector256<Int64> result, Int64[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.SByte.cs
new file mode 100644
index 0000000000..95e4d16b74
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.SByte.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementSByte()
+ {
+ var test = new VectorCreate__CreateElementSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementSByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector256<SByte> result = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(SByte);
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31] });
+
+ ValidateResult((Vector256<SByte>)(result), values);
+ }
+
+ private void ValidateResult(Vector256<SByte> result, SByte[] expectedValues, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Single.cs
new file mode 100644
index 0000000000..7f1e75dbd6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.Single.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementSingle()
+ {
+ var test = new VectorCreate__CreateElementSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementSingle
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector256<Single> result = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Single);
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7] });
+
+ ValidateResult((Vector256<Single>)(result), values);
+ }
+
+ private void ValidateResult(Vector256<Single> result, Single[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.UInt16.cs
new file mode 100644
index 0000000000..dde57f1b29
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.UInt16.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementUInt16()
+ {
+ var test = new VectorCreate__CreateElementUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementUInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector256<UInt16> result = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(UInt16);
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15] });
+
+ ValidateResult((Vector256<UInt16>)(result), values);
+ }
+
+ private void ValidateResult(Vector256<UInt16> result, UInt16[] expectedValues, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.UInt32.cs
new file mode 100644
index 0000000000..d10f7b72d5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.UInt32.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementUInt32()
+ {
+ var test = new VectorCreate__CreateElementUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementUInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector256<UInt32> result = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(UInt32);
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7] });
+
+ ValidateResult((Vector256<UInt32>)(result), values);
+ }
+
+ private void ValidateResult(Vector256<UInt32> result, UInt32[] expectedValues, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.UInt64.cs
new file mode 100644
index 0000000000..741f10e123
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateElement.UInt64.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementUInt64()
+ {
+ var test = new VectorCreate__CreateElementUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementUInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector256<UInt64> result = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(UInt64);
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3] });
+
+ ValidateResult((Vector256<UInt64>)(result), values);
+ }
+
+ private void ValidateResult(Vector256<UInt64> result, UInt64[] expectedValues, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Byte.cs
new file mode 100644
index 0000000000..a01b2f830c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Byte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarByte()
+ {
+ var test = new VectorCreate__CreateScalarByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ Vector256<Byte> result = Vector256.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalar), new Type[] { typeof(Byte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Byte>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Byte> result, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalar(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Double.cs
new file mode 100644
index 0000000000..8e436125d4
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Double.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarDouble()
+ {
+ var test = new VectorCreate__CreateScalarDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarDouble
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ Vector256<Double> result = Vector256.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalar), new Type[] { typeof(Double) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Double>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Double> result, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalar(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Int16.cs
new file mode 100644
index 0000000000..b0c521a077
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Int16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarInt16()
+ {
+ var test = new VectorCreate__CreateScalarInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ Vector256<Int16> result = Vector256.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalar), new Type[] { typeof(Int16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Int16>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Int16> result, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalar(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Int32.cs
new file mode 100644
index 0000000000..4f17d3833d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Int32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarInt32()
+ {
+ var test = new VectorCreate__CreateScalarInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ Vector256<Int32> result = Vector256.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalar), new Type[] { typeof(Int32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Int32>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Int32> result, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalar(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Int64.cs
new file mode 100644
index 0000000000..7ffa367a4e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Int64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarInt64()
+ {
+ var test = new VectorCreate__CreateScalarInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ Vector256<Int64> result = Vector256.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalar), new Type[] { typeof(Int64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Int64>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Int64> result, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalar(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.SByte.cs
new file mode 100644
index 0000000000..5a287d0895
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.SByte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarSByte()
+ {
+ var test = new VectorCreate__CreateScalarSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarSByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ Vector256<SByte> result = Vector256.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalar), new Type[] { typeof(SByte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<SByte>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<SByte> result, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalar(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Single.cs
new file mode 100644
index 0000000000..d630661158
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.Single.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarSingle()
+ {
+ var test = new VectorCreate__CreateScalarSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarSingle
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ Vector256<Single> result = Vector256.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalar), new Type[] { typeof(Single) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Single>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Single> result, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalar(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.UInt16.cs
new file mode 100644
index 0000000000..266123d4f1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.UInt16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUInt16()
+ {
+ var test = new VectorCreate__CreateScalarUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ Vector256<UInt16> result = Vector256.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalar), new Type[] { typeof(UInt16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<UInt16>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<UInt16> result, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalar(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.UInt32.cs
new file mode 100644
index 0000000000..f4ba583b48
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.UInt32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUInt32()
+ {
+ var test = new VectorCreate__CreateScalarUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ Vector256<UInt32> result = Vector256.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalar), new Type[] { typeof(UInt32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<UInt32>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<UInt32> result, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalar(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.UInt64.cs
new file mode 100644
index 0000000000..ea4c586c82
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalar.UInt64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUInt64()
+ {
+ var test = new VectorCreate__CreateScalarUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ Vector256<UInt64> result = Vector256.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalar), new Type[] { typeof(UInt64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<UInt64>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<UInt64> result, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalar(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Byte.cs
new file mode 100644
index 0000000000..8c58813f58
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Byte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeByte()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ Vector256<Byte> result = Vector256.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalarUnsafe), new Type[] { typeof(Byte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Byte>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Byte> result, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalarUnsafe(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Double.cs
new file mode 100644
index 0000000000..6ec1707062
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Double.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeDouble()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeDouble
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ Vector256<Double> result = Vector256.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalarUnsafe), new Type[] { typeof(Double) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Double>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Double> result, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalarUnsafe(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Int16.cs
new file mode 100644
index 0000000000..98f4bda7c2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Int16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeInt16()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ Vector256<Int16> result = Vector256.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalarUnsafe), new Type[] { typeof(Int16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Int16>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Int16> result, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalarUnsafe(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Int32.cs
new file mode 100644
index 0000000000..9d26ae5be2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Int32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeInt32()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ Vector256<Int32> result = Vector256.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalarUnsafe), new Type[] { typeof(Int32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Int32>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Int32> result, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalarUnsafe(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Int64.cs
new file mode 100644
index 0000000000..c64e57d45b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Int64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeInt64()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ Vector256<Int64> result = Vector256.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalarUnsafe), new Type[] { typeof(Int64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Int64>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Int64> result, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalarUnsafe(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.SByte.cs
new file mode 100644
index 0000000000..20109ada1d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.SByte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeSByte()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeSByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ Vector256<SByte> result = Vector256.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalarUnsafe), new Type[] { typeof(SByte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<SByte>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<SByte> result, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalarUnsafe(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Single.cs
new file mode 100644
index 0000000000..62468e6bc0
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.Single.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeSingle()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeSingle
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ Vector256<Single> result = Vector256.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalarUnsafe), new Type[] { typeof(Single) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<Single>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<Single> result, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalarUnsafe(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.UInt16.cs
new file mode 100644
index 0000000000..4d8ce60027
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.UInt16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeUInt16()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeUInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ Vector256<UInt16> result = Vector256.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalarUnsafe), new Type[] { typeof(UInt16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<UInt16>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<UInt16> result, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalarUnsafe(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.UInt32.cs
new file mode 100644
index 0000000000..7470a64093
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.UInt32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeUInt32()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeUInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ Vector256<UInt32> result = Vector256.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalarUnsafe), new Type[] { typeof(UInt32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<UInt32>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<UInt32> result, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalarUnsafe(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.UInt64.cs
new file mode 100644
index 0000000000..631476cd64
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateScalarUnsafe.UInt64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeUInt64()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeUInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ Vector256<UInt64> result = Vector256.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.CreateScalarUnsafe), new Type[] { typeof(UInt64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector256<UInt64>)(result), value);
+ }
+
+ private void ValidateResult(Vector256<UInt64> result, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.CreateScalarUnsafe(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Byte.cs
new file mode 100644
index 0000000000..a7b8c76c3c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Byte.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorByte()
+ {
+ var test = new VectorCreate__CreateVectorByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte lowerValue = TestLibrary.Generator.GetByte();
+ Vector128<Byte> lower = Vector128.Create(lowerValue);
+
+ Byte upperValue = TestLibrary.Generator.GetByte();
+ Vector128<Byte> upper = Vector128.Create(upperValue);
+
+ Vector256<Byte> result = Vector256.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte lowerValue = TestLibrary.Generator.GetByte();
+ Vector128<Byte> lower = Vector128.Create(lowerValue);
+
+ Byte upperValue = TestLibrary.Generator.GetByte();
+ Vector128<Byte> upper = Vector128.Create(upperValue);
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Vector128<Byte>), typeof(Vector128<Byte>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector256<Byte>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector256<Byte> result, Byte expectedLowerValue, Byte expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte expectedLowerValue, Byte expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Double.cs
new file mode 100644
index 0000000000..59b5451728
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Double.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorDouble()
+ {
+ var test = new VectorCreate__CreateVectorDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorDouble
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double lowerValue = TestLibrary.Generator.GetDouble();
+ Vector128<Double> lower = Vector128.Create(lowerValue);
+
+ Double upperValue = TestLibrary.Generator.GetDouble();
+ Vector128<Double> upper = Vector128.Create(upperValue);
+
+ Vector256<Double> result = Vector256.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double lowerValue = TestLibrary.Generator.GetDouble();
+ Vector128<Double> lower = Vector128.Create(lowerValue);
+
+ Double upperValue = TestLibrary.Generator.GetDouble();
+ Vector128<Double> upper = Vector128.Create(upperValue);
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Vector128<Double>), typeof(Vector128<Double>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector256<Double>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector256<Double> result, Double expectedLowerValue, Double expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double expectedLowerValue, Double expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Int16.cs
new file mode 100644
index 0000000000..fd1e89dfce
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Int16.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorInt16()
+ {
+ var test = new VectorCreate__CreateVectorInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16 lowerValue = TestLibrary.Generator.GetInt16();
+ Vector128<Int16> lower = Vector128.Create(lowerValue);
+
+ Int16 upperValue = TestLibrary.Generator.GetInt16();
+ Vector128<Int16> upper = Vector128.Create(upperValue);
+
+ Vector256<Int16> result = Vector256.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16 lowerValue = TestLibrary.Generator.GetInt16();
+ Vector128<Int16> lower = Vector128.Create(lowerValue);
+
+ Int16 upperValue = TestLibrary.Generator.GetInt16();
+ Vector128<Int16> upper = Vector128.Create(upperValue);
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Vector128<Int16>), typeof(Vector128<Int16>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector256<Int16>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector256<Int16> result, Int16 expectedLowerValue, Int16 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16 expectedLowerValue, Int16 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Int32.cs
new file mode 100644
index 0000000000..bd2628143b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Int32.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorInt32()
+ {
+ var test = new VectorCreate__CreateVectorInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32 lowerValue = TestLibrary.Generator.GetInt32();
+ Vector128<Int32> lower = Vector128.Create(lowerValue);
+
+ Int32 upperValue = TestLibrary.Generator.GetInt32();
+ Vector128<Int32> upper = Vector128.Create(upperValue);
+
+ Vector256<Int32> result = Vector256.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32 lowerValue = TestLibrary.Generator.GetInt32();
+ Vector128<Int32> lower = Vector128.Create(lowerValue);
+
+ Int32 upperValue = TestLibrary.Generator.GetInt32();
+ Vector128<Int32> upper = Vector128.Create(upperValue);
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Vector128<Int32>), typeof(Vector128<Int32>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector256<Int32>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector256<Int32> result, Int32 expectedLowerValue, Int32 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32 expectedLowerValue, Int32 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Int64.cs
new file mode 100644
index 0000000000..2718a8f6d5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Int64.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorInt64()
+ {
+ var test = new VectorCreate__CreateVectorInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64 lowerValue = TestLibrary.Generator.GetInt64();
+ Vector128<Int64> lower = Vector128.Create(lowerValue);
+
+ Int64 upperValue = TestLibrary.Generator.GetInt64();
+ Vector128<Int64> upper = Vector128.Create(upperValue);
+
+ Vector256<Int64> result = Vector256.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64 lowerValue = TestLibrary.Generator.GetInt64();
+ Vector128<Int64> lower = Vector128.Create(lowerValue);
+
+ Int64 upperValue = TestLibrary.Generator.GetInt64();
+ Vector128<Int64> upper = Vector128.Create(upperValue);
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Vector128<Int64>), typeof(Vector128<Int64>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector256<Int64>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector256<Int64> result, Int64 expectedLowerValue, Int64 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64 expectedLowerValue, Int64 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.SByte.cs
new file mode 100644
index 0000000000..9d5778a617
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.SByte.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorSByte()
+ {
+ var test = new VectorCreate__CreateVectorSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorSByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte lowerValue = TestLibrary.Generator.GetSByte();
+ Vector128<SByte> lower = Vector128.Create(lowerValue);
+
+ SByte upperValue = TestLibrary.Generator.GetSByte();
+ Vector128<SByte> upper = Vector128.Create(upperValue);
+
+ Vector256<SByte> result = Vector256.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte lowerValue = TestLibrary.Generator.GetSByte();
+ Vector128<SByte> lower = Vector128.Create(lowerValue);
+
+ SByte upperValue = TestLibrary.Generator.GetSByte();
+ Vector128<SByte> upper = Vector128.Create(upperValue);
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Vector128<SByte>), typeof(Vector128<SByte>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector256<SByte>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector256<SByte> result, SByte expectedLowerValue, SByte expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte expectedLowerValue, SByte expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Single.cs
new file mode 100644
index 0000000000..67ac16a8cb
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.Single.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorSingle()
+ {
+ var test = new VectorCreate__CreateVectorSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorSingle
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single lowerValue = TestLibrary.Generator.GetSingle();
+ Vector128<Single> lower = Vector128.Create(lowerValue);
+
+ Single upperValue = TestLibrary.Generator.GetSingle();
+ Vector128<Single> upper = Vector128.Create(upperValue);
+
+ Vector256<Single> result = Vector256.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single lowerValue = TestLibrary.Generator.GetSingle();
+ Vector128<Single> lower = Vector128.Create(lowerValue);
+
+ Single upperValue = TestLibrary.Generator.GetSingle();
+ Vector128<Single> upper = Vector128.Create(upperValue);
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector256<Single>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector256<Single> result, Single expectedLowerValue, Single expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single expectedLowerValue, Single expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.UInt16.cs
new file mode 100644
index 0000000000..65c53f79c4
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.UInt16.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorUInt16()
+ {
+ var test = new VectorCreate__CreateVectorUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorUInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16 lowerValue = TestLibrary.Generator.GetUInt16();
+ Vector128<UInt16> lower = Vector128.Create(lowerValue);
+
+ UInt16 upperValue = TestLibrary.Generator.GetUInt16();
+ Vector128<UInt16> upper = Vector128.Create(upperValue);
+
+ Vector256<UInt16> result = Vector256.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16 lowerValue = TestLibrary.Generator.GetUInt16();
+ Vector128<UInt16> lower = Vector128.Create(lowerValue);
+
+ UInt16 upperValue = TestLibrary.Generator.GetUInt16();
+ Vector128<UInt16> upper = Vector128.Create(upperValue);
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Vector128<UInt16>), typeof(Vector128<UInt16>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector256<UInt16>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector256<UInt16> result, UInt16 expectedLowerValue, UInt16 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16 expectedLowerValue, UInt16 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.UInt32.cs
new file mode 100644
index 0000000000..8be70914fb
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.UInt32.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorUInt32()
+ {
+ var test = new VectorCreate__CreateVectorUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorUInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32 lowerValue = TestLibrary.Generator.GetUInt32();
+ Vector128<UInt32> lower = Vector128.Create(lowerValue);
+
+ UInt32 upperValue = TestLibrary.Generator.GetUInt32();
+ Vector128<UInt32> upper = Vector128.Create(upperValue);
+
+ Vector256<UInt32> result = Vector256.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32 lowerValue = TestLibrary.Generator.GetUInt32();
+ Vector128<UInt32> lower = Vector128.Create(lowerValue);
+
+ UInt32 upperValue = TestLibrary.Generator.GetUInt32();
+ Vector128<UInt32> upper = Vector128.Create(upperValue);
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector256<UInt32>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector256<UInt32> result, UInt32 expectedLowerValue, UInt32 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32 expectedLowerValue, UInt32 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.UInt64.cs
new file mode 100644
index 0000000000..ba5dd72078
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/CreateVector.UInt64.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateVectorUInt64()
+ {
+ var test = new VectorCreate__CreateVectorUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateVectorUInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64 lowerValue = TestLibrary.Generator.GetUInt64();
+ Vector128<UInt64> lower = Vector128.Create(lowerValue);
+
+ UInt64 upperValue = TestLibrary.Generator.GetUInt64();
+ Vector128<UInt64> upper = Vector128.Create(upperValue);
+
+ Vector256<UInt64> result = Vector256.Create(lower, upper);
+
+ ValidateResult(result, lowerValue, upperValue);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64 lowerValue = TestLibrary.Generator.GetUInt64();
+ Vector128<UInt64> lower = Vector128.Create(lowerValue);
+
+ UInt64 upperValue = TestLibrary.Generator.GetUInt64();
+ Vector128<UInt64> upper = Vector128.Create(upperValue);
+
+ object result = typeof(Vector256)
+ .GetMethod(nameof(Vector256.Create), new Type[] { typeof(Vector128<UInt64>), typeof(Vector128<UInt64>) })
+ .Invoke(null, new object[] { lower, upper });
+
+ ValidateResult((Vector256<UInt64>)(result), lowerValue, upperValue);
+ }
+
+ private void ValidateResult(Vector256<UInt64> result, UInt64 expectedLowerValue, UInt64 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedLowerValue, expectedUpperValue, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64 expectedLowerValue, UInt64 expectedUpperValue, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount / 2; i++)
+ {
+ if (resultElements[i] != expectedLowerValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ for (var i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedUpperValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Create(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" lower: {expectedLowerValue}");
+ TestLibrary.TestFramework.LogInformation($" upper: {expectedUpperValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/Program.Vector256.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Program.Vector256.cs
new file mode 100644
index 0000000000..3ee1de45ac
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Program.Vector256.cs
@@ -0,0 +1,68 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["Create.Byte"] = CreateByte,
+ ["Create.Double"] = CreateDouble,
+ ["Create.Int16"] = CreateInt16,
+ ["Create.Int32"] = CreateInt32,
+ ["Create.Int64"] = CreateInt64,
+ ["Create.SByte"] = CreateSByte,
+ ["Create.Single"] = CreateSingle,
+ ["Create.UInt16"] = CreateUInt16,
+ ["Create.UInt32"] = CreateUInt32,
+ ["Create.UInt64"] = CreateUInt64,
+ ["CreateScalar.Byte"] = CreateScalarByte,
+ ["CreateScalar.Double"] = CreateScalarDouble,
+ ["CreateScalar.Int16"] = CreateScalarInt16,
+ ["CreateScalar.Int32"] = CreateScalarInt32,
+ ["CreateScalar.Int64"] = CreateScalarInt64,
+ ["CreateScalar.SByte"] = CreateScalarSByte,
+ ["CreateScalar.Single"] = CreateScalarSingle,
+ ["CreateScalar.UInt16"] = CreateScalarUInt16,
+ ["CreateScalar.UInt32"] = CreateScalarUInt32,
+ ["CreateScalar.UInt64"] = CreateScalarUInt64,
+ ["CreateScalarUnsafe.Byte"] = CreateScalarUnsafeByte,
+ ["CreateScalarUnsafe.Double"] = CreateScalarUnsafeDouble,
+ ["CreateScalarUnsafe.Int16"] = CreateScalarUnsafeInt16,
+ ["CreateScalarUnsafe.Int32"] = CreateScalarUnsafeInt32,
+ ["CreateScalarUnsafe.Int64"] = CreateScalarUnsafeInt64,
+ ["CreateScalarUnsafe.SByte"] = CreateScalarUnsafeSByte,
+ ["CreateScalarUnsafe.Single"] = CreateScalarUnsafeSingle,
+ ["CreateScalarUnsafe.UInt16"] = CreateScalarUnsafeUInt16,
+ ["CreateScalarUnsafe.UInt32"] = CreateScalarUnsafeUInt32,
+ ["CreateScalarUnsafe.UInt64"] = CreateScalarUnsafeUInt64,
+ ["CreateElement.Byte"] = CreateElementByte,
+ ["CreateElement.Double"] = CreateElementDouble,
+ ["CreateElement.Int16"] = CreateElementInt16,
+ ["CreateElement.Int32"] = CreateElementInt32,
+ ["CreateElement.Int64"] = CreateElementInt64,
+ ["CreateElement.SByte"] = CreateElementSByte,
+ ["CreateElement.Single"] = CreateElementSingle,
+ ["CreateElement.UInt16"] = CreateElementUInt16,
+ ["CreateElement.UInt32"] = CreateElementUInt32,
+ ["CreateElement.UInt64"] = CreateElementUInt64,
+ ["CreateVector.Byte"] = CreateVectorByte,
+ ["CreateVector.Double"] = CreateVectorDouble,
+ ["CreateVector.Int16"] = CreateVectorInt16,
+ ["CreateVector.Int32"] = CreateVectorInt32,
+ ["CreateVector.Int64"] = CreateVectorInt64,
+ ["CreateVector.SByte"] = CreateVectorSByte,
+ ["CreateVector.Single"] = CreateVectorSingle,
+ ["CreateVector.UInt16"] = CreateVectorUInt16,
+ ["CreateVector.UInt32"] = CreateVectorUInt32,
+ ["CreateVector.UInt64"] = CreateVectorUInt64,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/Vector256_r.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Vector256_r.csproj
new file mode 100644
index 0000000000..19d0f9de20
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Vector256_r.csproj
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Embedded</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Create.Byte.cs" />
+ <Compile Include="Create.Double.cs" />
+ <Compile Include="Create.Int16.cs" />
+ <Compile Include="Create.Int32.cs" />
+ <Compile Include="Create.Int64.cs" />
+ <Compile Include="Create.SByte.cs" />
+ <Compile Include="Create.Single.cs" />
+ <Compile Include="Create.UInt16.cs" />
+ <Compile Include="Create.UInt32.cs" />
+ <Compile Include="Create.UInt64.cs" />
+ <Compile Include="CreateElement.Byte.cs" />
+ <Compile Include="CreateElement.Double.cs" />
+ <Compile Include="CreateElement.Int16.cs" />
+ <Compile Include="CreateElement.Int32.cs" />
+ <Compile Include="CreateElement.Int64.cs" />
+ <Compile Include="CreateElement.SByte.cs" />
+ <Compile Include="CreateElement.Single.cs" />
+ <Compile Include="CreateElement.UInt16.cs" />
+ <Compile Include="CreateElement.UInt32.cs" />
+ <Compile Include="CreateElement.UInt64.cs" />
+ <Compile Include="CreateVector.Byte.cs" />
+ <Compile Include="CreateVector.Double.cs" />
+ <Compile Include="CreateVector.Int16.cs" />
+ <Compile Include="CreateVector.Int32.cs" />
+ <Compile Include="CreateVector.Int64.cs" />
+ <Compile Include="CreateVector.SByte.cs" />
+ <Compile Include="CreateVector.Single.cs" />
+ <Compile Include="CreateVector.UInt16.cs" />
+ <Compile Include="CreateVector.UInt32.cs" />
+ <Compile Include="CreateVector.UInt64.cs" />
+ <Compile Include="CreateScalar.Byte.cs" />
+ <Compile Include="CreateScalar.Double.cs" />
+ <Compile Include="CreateScalar.Int16.cs" />
+ <Compile Include="CreateScalar.Int32.cs" />
+ <Compile Include="CreateScalar.Int64.cs" />
+ <Compile Include="CreateScalar.SByte.cs" />
+ <Compile Include="CreateScalar.Single.cs" />
+ <Compile Include="CreateScalar.UInt16.cs" />
+ <Compile Include="CreateScalar.UInt32.cs" />
+ <Compile Include="CreateScalar.UInt64.cs" />
+ <Compile Include="CreateScalarUnsafe.Byte.cs" />
+ <Compile Include="CreateScalarUnsafe.Double.cs" />
+ <Compile Include="CreateScalarUnsafe.Int16.cs" />
+ <Compile Include="CreateScalarUnsafe.Int32.cs" />
+ <Compile Include="CreateScalarUnsafe.Int64.cs" />
+ <Compile Include="CreateScalarUnsafe.SByte.cs" />
+ <Compile Include="CreateScalarUnsafe.Single.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt16.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt32.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt64.cs" />
+ <Compile Include="Program.Vector256.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256/Vector256_ro.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Vector256_ro.csproj
new file mode 100644
index 0000000000..52cb263ad7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256/Vector256_ro.csproj
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Embedded</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Create.Byte.cs" />
+ <Compile Include="Create.Double.cs" />
+ <Compile Include="Create.Int16.cs" />
+ <Compile Include="Create.Int32.cs" />
+ <Compile Include="Create.Int64.cs" />
+ <Compile Include="Create.SByte.cs" />
+ <Compile Include="Create.Single.cs" />
+ <Compile Include="Create.UInt16.cs" />
+ <Compile Include="Create.UInt32.cs" />
+ <Compile Include="Create.UInt64.cs" />
+ <Compile Include="CreateElement.Byte.cs" />
+ <Compile Include="CreateElement.Double.cs" />
+ <Compile Include="CreateElement.Int16.cs" />
+ <Compile Include="CreateElement.Int32.cs" />
+ <Compile Include="CreateElement.Int64.cs" />
+ <Compile Include="CreateElement.SByte.cs" />
+ <Compile Include="CreateElement.Single.cs" />
+ <Compile Include="CreateElement.UInt16.cs" />
+ <Compile Include="CreateElement.UInt32.cs" />
+ <Compile Include="CreateElement.UInt64.cs" />
+ <Compile Include="CreateVector.Byte.cs" />
+ <Compile Include="CreateVector.Double.cs" />
+ <Compile Include="CreateVector.Int16.cs" />
+ <Compile Include="CreateVector.Int32.cs" />
+ <Compile Include="CreateVector.Int64.cs" />
+ <Compile Include="CreateVector.SByte.cs" />
+ <Compile Include="CreateVector.Single.cs" />
+ <Compile Include="CreateVector.UInt16.cs" />
+ <Compile Include="CreateVector.UInt32.cs" />
+ <Compile Include="CreateVector.UInt64.cs" />
+ <Compile Include="CreateScalar.Byte.cs" />
+ <Compile Include="CreateScalar.Double.cs" />
+ <Compile Include="CreateScalar.Int16.cs" />
+ <Compile Include="CreateScalar.Int32.cs" />
+ <Compile Include="CreateScalar.Int64.cs" />
+ <Compile Include="CreateScalar.SByte.cs" />
+ <Compile Include="CreateScalar.Single.cs" />
+ <Compile Include="CreateScalar.UInt16.cs" />
+ <Compile Include="CreateScalar.UInt32.cs" />
+ <Compile Include="CreateScalar.UInt64.cs" />
+ <Compile Include="CreateScalarUnsafe.Byte.cs" />
+ <Compile Include="CreateScalarUnsafe.Double.cs" />
+ <Compile Include="CreateScalarUnsafe.Int16.cs" />
+ <Compile Include="CreateScalarUnsafe.Int32.cs" />
+ <Compile Include="CreateScalarUnsafe.Int64.cs" />
+ <Compile Include="CreateScalarUnsafe.SByte.cs" />
+ <Compile Include="CreateScalarUnsafe.Single.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt16.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt32.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt64.cs" />
+ <Compile Include="Program.Vector256.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Byte.cs
new file mode 100644
index 0000000000..40355d5655
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Byte.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsByte()
+ {
+ var test = new VectorAs__AsByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector256<Byte> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector256<Byte> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ Vector256<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector256<Byte> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ object byteResult = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<byte>)(byteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ object doubleResult = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<double>)(doubleResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ object shortResult = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<short>)(shortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ object intResult = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<int>)(intResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ object longResult = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<long>)(longResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ object sbyteResult = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<sbyte>)(sbyteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ object floatResult = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<float>)(floatResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ object ushortResult = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ushort>)(ushortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ object uintResult = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<uint>)(uintResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetByte());
+ object ulongResult = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector256<T> result, Vector256<Byte> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+
+ Byte[] valueElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Double.cs
new file mode 100644
index 0000000000..c68a344bee
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Double.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsDouble()
+ {
+ var test = new VectorAs__AsDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsDouble
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector256<Double> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector256<Double> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ Vector256<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector256<Double> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ object byteResult = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<byte>)(byteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ object doubleResult = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<double>)(doubleResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ object shortResult = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<short>)(shortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ object intResult = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<int>)(intResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ object longResult = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<long>)(longResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ object sbyteResult = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<sbyte>)(sbyteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ object floatResult = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<float>)(floatResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ object ushortResult = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ushort>)(ushortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ object uintResult = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<uint>)(uintResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetDouble());
+ object ulongResult = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector256<T> result, Vector256<Double> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+
+ Double[] valueElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int16.cs
new file mode 100644
index 0000000000..4e5cb76714
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int16.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsInt16()
+ {
+ var test = new VectorAs__AsInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector256<Int16> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector256<Int16> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ Vector256<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector256<Int16> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ object byteResult = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<byte>)(byteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ object doubleResult = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<double>)(doubleResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ object shortResult = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<short>)(shortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ object intResult = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<int>)(intResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ object longResult = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<long>)(longResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ object sbyteResult = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<sbyte>)(sbyteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ object floatResult = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<float>)(floatResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ object ushortResult = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ushort>)(ushortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ object uintResult = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<uint>)(uintResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt16());
+ object ulongResult = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector256<T> result, Vector256<Int16> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+
+ Int16[] valueElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int32.cs
new file mode 100644
index 0000000000..a5f03b8c75
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int32.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsInt32()
+ {
+ var test = new VectorAs__AsInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector256<Int32> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector256<Int32> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ Vector256<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector256<Int32> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ object byteResult = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<byte>)(byteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ object doubleResult = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<double>)(doubleResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ object shortResult = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<short>)(shortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ object intResult = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<int>)(intResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ object longResult = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<long>)(longResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ object sbyteResult = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<sbyte>)(sbyteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ object floatResult = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<float>)(floatResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ object ushortResult = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ushort>)(ushortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ object uintResult = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<uint>)(uintResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt32());
+ object ulongResult = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector256<T> result, Vector256<Int32> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+
+ Int32[] valueElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int64.cs
new file mode 100644
index 0000000000..eae24b2f2c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int64.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsInt64()
+ {
+ var test = new VectorAs__AsInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector256<Int64> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector256<Int64> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ Vector256<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector256<Int64> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ object byteResult = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<byte>)(byteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ object doubleResult = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<double>)(doubleResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ object shortResult = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<short>)(shortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ object intResult = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<int>)(intResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ object longResult = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<long>)(longResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ object sbyteResult = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<sbyte>)(sbyteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ object floatResult = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<float>)(floatResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ object ushortResult = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ushort>)(ushortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ object uintResult = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<uint>)(uintResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetInt64());
+ object ulongResult = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector256<T> result, Vector256<Int64> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+
+ Int64[] valueElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.SByte.cs
new file mode 100644
index 0000000000..495c07fe25
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.SByte.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsSByte()
+ {
+ var test = new VectorAs__AsSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsSByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector256<SByte> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector256<SByte> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ Vector256<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector256<SByte> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ object byteResult = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<byte>)(byteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ object doubleResult = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<double>)(doubleResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ object shortResult = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<short>)(shortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ object intResult = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<int>)(intResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ object longResult = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<long>)(longResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ object sbyteResult = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<sbyte>)(sbyteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ object floatResult = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<float>)(floatResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ object ushortResult = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ushort>)(ushortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ object uintResult = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<uint>)(uintResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSByte());
+ object ulongResult = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector256<T> result, Vector256<SByte> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+
+ SByte[] valueElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Single.cs
new file mode 100644
index 0000000000..218348a12e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Single.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsSingle()
+ {
+ var test = new VectorAs__AsSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsSingle
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector256<Single> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector256<Single> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ Vector256<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector256<Single> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ object byteResult = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<byte>)(byteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ object doubleResult = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<double>)(doubleResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ object shortResult = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<short>)(shortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ object intResult = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<int>)(intResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ object longResult = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<long>)(longResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ object sbyteResult = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<sbyte>)(sbyteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ object floatResult = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<float>)(floatResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ object ushortResult = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ushort>)(ushortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ object uintResult = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<uint>)(uintResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetSingle());
+ object ulongResult = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector256<T> result, Vector256<Single> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+
+ Single[] valueElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt16.cs
new file mode 100644
index 0000000000..bbc844c727
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt16.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsUInt16()
+ {
+ var test = new VectorAs__AsUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsUInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector256<UInt16> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector256<UInt16> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ Vector256<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector256<UInt16> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ object byteResult = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<byte>)(byteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ object doubleResult = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<double>)(doubleResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ object shortResult = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<short>)(shortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ object intResult = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<int>)(intResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ object longResult = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<long>)(longResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ object sbyteResult = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<sbyte>)(sbyteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ object floatResult = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<float>)(floatResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ object ushortResult = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ushort>)(ushortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ object uintResult = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<uint>)(uintResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt16());
+ object ulongResult = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector256<T> result, Vector256<UInt16> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+
+ UInt16[] valueElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt32.cs
new file mode 100644
index 0000000000..15d54828f9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt32.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsUInt32()
+ {
+ var test = new VectorAs__AsUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsUInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector256<UInt32> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector256<UInt32> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ Vector256<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector256<UInt32> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ object byteResult = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<byte>)(byteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ object doubleResult = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<double>)(doubleResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ object shortResult = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<short>)(shortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ object intResult = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<int>)(intResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ object longResult = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<long>)(longResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ object sbyteResult = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<sbyte>)(sbyteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ object floatResult = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<float>)(floatResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ object ushortResult = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ushort>)(ushortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ object uintResult = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<uint>)(uintResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt32());
+ object ulongResult = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector256<T> result, Vector256<UInt32> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+
+ UInt32[] valueElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt64.cs
new file mode 100644
index 0000000000..705614b29b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt64.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsUInt64()
+ {
+ var test = new VectorAs__AsUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsUInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector256<UInt64> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector256<UInt64> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ Vector256<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector256<UInt64> value;
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ object byteResult = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<byte>)(byteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ object doubleResult = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<double>)(doubleResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ object shortResult = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<short>)(shortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ object intResult = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<int>)(intResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ object longResult = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<long>)(longResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ object sbyteResult = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<sbyte>)(sbyteResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ object floatResult = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<float>)(floatResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ object ushortResult = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ushort>)(ushortResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ object uintResult = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<uint>)(uintResult), value);
+
+ value = Vector256.Create(TestLibrary.Generator.GetUInt64());
+ object ulongResult = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector256<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector256<T> result, Vector256<UInt64> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+
+ UInt64[] valueElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.0.cs
new file mode 100644
index 0000000000..ed34e42c2b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementByte0()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementByte0();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementByte0
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector256<Byte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Byte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ Vector256<Byte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector256<Byte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Byte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ object result2 = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.WithElement), new Type[] { typeof(int), typeof(Byte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Byte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Byte result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Byte> result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Byte[] result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.15.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.15.cs
new file mode 100644
index 0000000000..f9caea7267
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.15.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementByte15()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementByte15();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementByte15
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 15, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector256<Byte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Byte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ Vector256<Byte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 15, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector256<Byte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Byte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ object result2 = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.WithElement), new Type[] { typeof(int), typeof(Byte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Byte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(15 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(15 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(15 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(15 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Byte result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[15])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.GetElement(15): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Byte> result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Byte[] result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 15) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[15] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithElement(15): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.31.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.31.cs
new file mode 100644
index 0000000000..2d028322f5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.31.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementByte31()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementByte31();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementByte31
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 31, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector256<Byte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Byte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ Vector256<Byte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 31, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector256<Byte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Byte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ object result2 = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.WithElement), new Type[] { typeof(int), typeof(Byte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Byte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(31 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(31 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(31 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(31 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Byte result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[31])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.GetElement(31): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Byte> result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Byte[] result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 31) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[31] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithElement(31): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.7.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.7.cs
new file mode 100644
index 0000000000..07ad814163
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Byte.7.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementByte7()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementByte7();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementByte7
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector256<Byte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Byte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ Vector256<Byte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector256<Byte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Byte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ object result2 = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.WithElement), new Type[] { typeof(int), typeof(Byte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Byte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(7 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(7 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Byte result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[7])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.GetElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Byte> result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Byte[] result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 7) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[7] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Double.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Double.0.cs
new file mode 100644
index 0000000000..c04dd69ced
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Double.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementDouble0()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementDouble0();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementDouble0
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector256<Double> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Double result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Double insertedValue = TestLibrary.Generator.GetDouble();
+
+ try
+ {
+ Vector256<Double> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector256<Double> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Double)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Double insertedValue = TestLibrary.Generator.GetDouble();
+
+ try
+ {
+ object result2 = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.WithElement), new Type[] { typeof(int), typeof(Double) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Double>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Double result, Double[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Double> result, Double[] values, Double insertedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Double[] result, Double[] values, Double insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Double.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Double.1.cs
new file mode 100644
index 0000000000..166453fcaf
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Double.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementDouble1()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementDouble1();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementDouble1
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector256<Double> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Double result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Double insertedValue = TestLibrary.Generator.GetDouble();
+
+ try
+ {
+ Vector256<Double> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector256<Double> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Double)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Double insertedValue = TestLibrary.Generator.GetDouble();
+
+ try
+ {
+ object result2 = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.WithElement), new Type[] { typeof(int), typeof(Double) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Double>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Double result, Double[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Double> result, Double[] values, Double insertedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Double[] result, Double[] values, Double insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Double.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Double.3.cs
new file mode 100644
index 0000000000..4385264ed1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Double.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementDouble3()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementDouble3();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementDouble3
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector256<Double> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Double result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Double insertedValue = TestLibrary.Generator.GetDouble();
+
+ try
+ {
+ Vector256<Double> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector256<Double> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Double)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Double insertedValue = TestLibrary.Generator.GetDouble();
+
+ try
+ {
+ object result2 = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.WithElement), new Type[] { typeof(int), typeof(Double) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Double>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Double result, Double[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Double> result, Double[] values, Double insertedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Double[] result, Double[] values, Double insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.0.cs
new file mode 100644
index 0000000000..efdcd68fd0
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt160()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt160();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt160
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ Vector256<Int16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ object result2 = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.WithElement), new Type[] { typeof(int), typeof(Int16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Int16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int16 result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int16> result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int16[] result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.15.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.15.cs
new file mode 100644
index 0000000000..62cf3b1ab7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.15.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt1615()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt1615();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt1615
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 15, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ Vector256<Int16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 15, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ object result2 = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.WithElement), new Type[] { typeof(int), typeof(Int16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Int16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(15 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(15 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(15 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(15 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int16 result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[15])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.GetElement(15): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int16> result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int16[] result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 15) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[15] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithElement(15): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.3.cs
new file mode 100644
index 0000000000..8de234efdd
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt163()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt163();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt163
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ Vector256<Int16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ object result2 = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.WithElement), new Type[] { typeof(int), typeof(Int16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Int16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int16 result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int16> result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int16[] result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.7.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.7.cs
new file mode 100644
index 0000000000..ce43c7cca7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int16.7.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt167()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt167();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt167
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ Vector256<Int16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ object result2 = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.WithElement), new Type[] { typeof(int), typeof(Int16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Int16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(7 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(7 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int16 result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[7])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.GetElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int16> result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int16[] result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 7) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[7] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.0.cs
new file mode 100644
index 0000000000..e8ce032a1f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt320()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt320();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt320
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector256<Int32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ Vector256<Int32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector256<Int32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ object result2 = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.WithElement), new Type[] { typeof(int), typeof(Int32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Int32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int32 result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int32> result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int32[] result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.1.cs
new file mode 100644
index 0000000000..919d0643aa
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt321()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt321();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt321
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector256<Int32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ Vector256<Int32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector256<Int32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ object result2 = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.WithElement), new Type[] { typeof(int), typeof(Int32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Int32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int32 result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int32> result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int32[] result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.3.cs
new file mode 100644
index 0000000000..2019ac9aa4
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt323()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt323();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt323
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector256<Int32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ Vector256<Int32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector256<Int32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ object result2 = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.WithElement), new Type[] { typeof(int), typeof(Int32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Int32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int32 result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int32> result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int32[] result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.7.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.7.cs
new file mode 100644
index 0000000000..9eadcec194
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int32.7.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt327()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt327();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt327
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector256<Int32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ Vector256<Int32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector256<Int32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ object result2 = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.WithElement), new Type[] { typeof(int), typeof(Int32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Int32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(7 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(7 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int32 result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[7])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.GetElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int32> result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int32[] result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 7) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[7] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int64.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int64.0.cs
new file mode 100644
index 0000000000..d86565759c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int64.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt640()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt640();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt640
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector256<Int64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int64 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int64 insertedValue = TestLibrary.Generator.GetInt64();
+
+ try
+ {
+ Vector256<Int64> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector256<Int64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int64)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int64 insertedValue = TestLibrary.Generator.GetInt64();
+
+ try
+ {
+ object result2 = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.WithElement), new Type[] { typeof(int), typeof(Int64) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Int64>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int64 result, Int64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int64> result, Int64[] values, Int64 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int64[] result, Int64[] values, Int64 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int64.1.cs
new file mode 100644
index 0000000000..c3c1756265
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int64.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt641()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt641();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt641
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector256<Int64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int64 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int64 insertedValue = TestLibrary.Generator.GetInt64();
+
+ try
+ {
+ Vector256<Int64> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector256<Int64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int64)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int64 insertedValue = TestLibrary.Generator.GetInt64();
+
+ try
+ {
+ object result2 = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.WithElement), new Type[] { typeof(int), typeof(Int64) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Int64>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int64 result, Int64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int64> result, Int64[] values, Int64 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int64[] result, Int64[] values, Int64 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int64.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int64.3.cs
new file mode 100644
index 0000000000..39fa940a5c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Int64.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt643()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt643();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt643
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector256<Int64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int64 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int64 insertedValue = TestLibrary.Generator.GetInt64();
+
+ try
+ {
+ Vector256<Int64> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector256<Int64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int64)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int64 insertedValue = TestLibrary.Generator.GetInt64();
+
+ try
+ {
+ object result2 = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.WithElement), new Type[] { typeof(int), typeof(Int64) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Int64>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int64 result, Int64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int64> result, Int64[] values, Int64 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int64[] result, Int64[] values, Int64 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.0.cs
new file mode 100644
index 0000000000..dd08864f2e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSByte0()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSByte0();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSByte0
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector256<SByte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ SByte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ Vector256<SByte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector256<SByte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((SByte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ object result2 = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.WithElement), new Type[] { typeof(int), typeof(SByte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<SByte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(SByte result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<SByte> result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(SByte[] result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.15.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.15.cs
new file mode 100644
index 0000000000..8a0dcc179c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.15.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSByte15()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSByte15();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSByte15
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 15, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector256<SByte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ SByte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ Vector256<SByte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 15, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector256<SByte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((SByte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ object result2 = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.WithElement), new Type[] { typeof(int), typeof(SByte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<SByte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(15 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(15 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(15 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(15 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(SByte result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[15])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.GetElement(15): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<SByte> result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(SByte[] result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 15) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[15] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithElement(15): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.31.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.31.cs
new file mode 100644
index 0000000000..7e23c46d77
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.31.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSByte31()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSByte31();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSByte31
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 31, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector256<SByte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ SByte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ Vector256<SByte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 31, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector256<SByte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((SByte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ object result2 = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.WithElement), new Type[] { typeof(int), typeof(SByte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<SByte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(31 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(31 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(31 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(31 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(SByte result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[31])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.GetElement(31): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<SByte> result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(SByte[] result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 31) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[31] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithElement(31): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.7.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.7.cs
new file mode 100644
index 0000000000..6db1ea6d11
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.SByte.7.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSByte7()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSByte7();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSByte7
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector256<SByte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ SByte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ Vector256<SByte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector256<SByte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((SByte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ object result2 = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.WithElement), new Type[] { typeof(int), typeof(SByte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<SByte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(7 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(7 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(SByte result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[7])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.GetElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<SByte> result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(SByte[] result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 7) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[7] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.0.cs
new file mode 100644
index 0000000000..510ffa871d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSingle0()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSingle0();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSingle0
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector256<Single> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Single result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ Vector256<Single> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector256<Single> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Single)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ object result2 = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.WithElement), new Type[] { typeof(int), typeof(Single) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Single>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Single result, Single[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Single> result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Single[] result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.1.cs
new file mode 100644
index 0000000000..483f1e04cc
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSingle1()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSingle1();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSingle1
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector256<Single> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Single result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ Vector256<Single> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector256<Single> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Single)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ object result2 = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.WithElement), new Type[] { typeof(int), typeof(Single) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Single>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Single result, Single[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Single> result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Single[] result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.3.cs
new file mode 100644
index 0000000000..18e1b9bba2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSingle3()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSingle3();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSingle3
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector256<Single> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Single result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ Vector256<Single> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector256<Single> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Single)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ object result2 = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.WithElement), new Type[] { typeof(int), typeof(Single) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Single>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Single result, Single[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Single> result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Single[] result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.7.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.7.cs
new file mode 100644
index 0000000000..4f98f05166
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.Single.7.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSingle7()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSingle7();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSingle7
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector256<Single> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Single result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ Vector256<Single> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector256<Single> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Single)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ object result2 = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.WithElement), new Type[] { typeof(int), typeof(Single) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<Single>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(7 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(7 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Single result, Single[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[7])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.GetElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Single> result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Single[] result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 7) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[7] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.0.cs
new file mode 100644
index 0000000000..9c6aaeef87
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt160()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt160();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt160
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector256<UInt16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ Vector256<UInt16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector256<UInt16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ object result2 = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.WithElement), new Type[] { typeof(int), typeof(UInt16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<UInt16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt16 result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt16> result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt16[] result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.15.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.15.cs
new file mode 100644
index 0000000000..7676cb733c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.15.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt1615()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt1615();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt1615
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 15, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector256<UInt16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ Vector256<UInt16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 15, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector256<UInt16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ object result2 = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.WithElement), new Type[] { typeof(int), typeof(UInt16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<UInt16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(15 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(15 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(15 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(15 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt16 result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[15])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.GetElement(15): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt16> result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt16[] result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 15) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[15] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithElement(15): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.3.cs
new file mode 100644
index 0000000000..319ca8ceb6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt163()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt163();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt163
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector256<UInt16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ Vector256<UInt16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector256<UInt16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ object result2 = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.WithElement), new Type[] { typeof(int), typeof(UInt16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<UInt16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt16 result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt16> result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt16[] result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.7.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.7.cs
new file mode 100644
index 0000000000..b176d0dca7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt16.7.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt167()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt167();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt167
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector256<UInt16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ Vector256<UInt16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector256<UInt16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ object result2 = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.WithElement), new Type[] { typeof(int), typeof(UInt16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<UInt16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(7 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(7 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt16 result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[7])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.GetElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt16> result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt16[] result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 7) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[7] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.0.cs
new file mode 100644
index 0000000000..f2b264a6bc
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt320()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt320();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt320
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector256<UInt32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ Vector256<UInt32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector256<UInt32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ object result2 = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.WithElement), new Type[] { typeof(int), typeof(UInt32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<UInt32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt32 result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt32> result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt32[] result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.1.cs
new file mode 100644
index 0000000000..83b988c46e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt321()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt321();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt321
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector256<UInt32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ Vector256<UInt32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector256<UInt32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ object result2 = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.WithElement), new Type[] { typeof(int), typeof(UInt32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<UInt32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt32 result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt32> result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt32[] result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.3.cs
new file mode 100644
index 0000000000..d47e251361
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt323()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt323();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt323
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector256<UInt32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ Vector256<UInt32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector256<UInt32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ object result2 = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.WithElement), new Type[] { typeof(int), typeof(UInt32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<UInt32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt32 result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt32> result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt32[] result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.7.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.7.cs
new file mode 100644
index 0000000000..8ba9a38cf2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt32.7.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt327()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt327();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt327
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector256<UInt32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ Vector256<UInt32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector256<UInt32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ object result2 = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.WithElement), new Type[] { typeof(int), typeof(UInt32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<UInt32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(7 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(7 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt32 result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[7])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.GetElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt32> result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt32[] result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 7) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[7] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt64.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt64.0.cs
new file mode 100644
index 0000000000..5f3176d242
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt64.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt640()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt640();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt640
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector256<UInt64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt64 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt64 insertedValue = TestLibrary.Generator.GetUInt64();
+
+ try
+ {
+ Vector256<UInt64> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector256<UInt64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt64)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt64 insertedValue = TestLibrary.Generator.GetUInt64();
+
+ try
+ {
+ object result2 = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.WithElement), new Type[] { typeof(int), typeof(UInt64) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<UInt64>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt64 result, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt64> result, UInt64[] values, UInt64 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt64[] result, UInt64[] values, UInt64 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt64.1.cs
new file mode 100644
index 0000000000..cee0951663
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt64.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt641()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt641();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt641
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector256<UInt64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt64 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt64 insertedValue = TestLibrary.Generator.GetUInt64();
+
+ try
+ {
+ Vector256<UInt64> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector256<UInt64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt64)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt64 insertedValue = TestLibrary.Generator.GetUInt64();
+
+ try
+ {
+ object result2 = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.WithElement), new Type[] { typeof(int), typeof(UInt64) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<UInt64>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt64 result, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt64> result, UInt64[] values, UInt64 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt64[] result, UInt64[] values, UInt64 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt64.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt64.3.cs
new file mode 100644
index 0000000000..9c1eceecf3
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithElement.UInt64.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt643()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt643();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt643
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector256<UInt64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt64 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt64 insertedValue = TestLibrary.Generator.GetUInt64();
+
+ try
+ {
+ Vector256<UInt64> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector256<UInt64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt64)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt64 insertedValue = TestLibrary.Generator.GetUInt64();
+
+ try
+ {
+ object result2 = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.WithElement), new Type[] { typeof(int), typeof(UInt64) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector256<UInt64>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt64 result, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt64> result, UInt64[] values, UInt64 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt64[] result, UInt64[] values, UInt64 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Byte.cs
new file mode 100644
index 0000000000..1d8afc7347
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Byte.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperByte()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector256<Byte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ Vector128<Byte> lowerResult = value.GetLower();
+ Vector128<Byte> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector256<Byte> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector256<Byte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ object lowerResult = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector128<Byte>)(lowerResult), (Vector128<Byte>)(upperResult), values);
+
+ object result = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.WithLower), new Type[] { typeof(Vector128<Byte>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.WithUpper), new Type[] { typeof(Vector128<Byte>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector256<Byte>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector128<Byte> lowerResult, Vector128<Byte> upperResult, Byte[] values, [CallerMemberName] string method = "")
+ {
+ Byte[] lowerElements = new Byte[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref lowerElements[0]), lowerResult);
+
+ Byte[] upperElements = new Byte[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(Byte[] lowerResult, Byte[] upperResult, Byte[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Byte> result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(Byte[] result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Double.cs
new file mode 100644
index 0000000000..563975b818
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Double.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperDouble()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperDouble
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector256<Double> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ Vector128<Double> lowerResult = value.GetLower();
+ Vector128<Double> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector256<Double> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector256<Double> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ object lowerResult = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector128<Double>)(lowerResult), (Vector128<Double>)(upperResult), values);
+
+ object result = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.WithLower), new Type[] { typeof(Vector128<Double>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.WithUpper), new Type[] { typeof(Vector128<Double>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector256<Double>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector128<Double> lowerResult, Vector128<Double> upperResult, Double[] values, [CallerMemberName] string method = "")
+ {
+ Double[] lowerElements = new Double[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref lowerElements[0]), lowerResult);
+
+ Double[] upperElements = new Double[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(Double[] lowerResult, Double[] upperResult, Double[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Double> result, Double[] values, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(Double[] result, Double[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Int16.cs
new file mode 100644
index 0000000000..89b38e16a8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Int16.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperInt16()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ Vector128<Int16> lowerResult = value.GetLower();
+ Vector128<Int16> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector256<Int16> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ object lowerResult = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector128<Int16>)(lowerResult), (Vector128<Int16>)(upperResult), values);
+
+ object result = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.WithLower), new Type[] { typeof(Vector128<Int16>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.WithUpper), new Type[] { typeof(Vector128<Int16>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector256<Int16>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector128<Int16> lowerResult, Vector128<Int16> upperResult, Int16[] values, [CallerMemberName] string method = "")
+ {
+ Int16[] lowerElements = new Int16[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref lowerElements[0]), lowerResult);
+
+ Int16[] upperElements = new Int16[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(Int16[] lowerResult, Int16[] upperResult, Int16[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int16> result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(Int16[] result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Int32.cs
new file mode 100644
index 0000000000..6ca4f12170
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Int32.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperInt32()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector256<Int32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ Vector128<Int32> lowerResult = value.GetLower();
+ Vector128<Int32> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector256<Int32> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector256<Int32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object lowerResult = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector128<Int32>)(lowerResult), (Vector128<Int32>)(upperResult), values);
+
+ object result = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.WithLower), new Type[] { typeof(Vector128<Int32>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.WithUpper), new Type[] { typeof(Vector128<Int32>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector256<Int32>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector128<Int32> lowerResult, Vector128<Int32> upperResult, Int32[] values, [CallerMemberName] string method = "")
+ {
+ Int32[] lowerElements = new Int32[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref lowerElements[0]), lowerResult);
+
+ Int32[] upperElements = new Int32[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(Int32[] lowerResult, Int32[] upperResult, Int32[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int32> result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(Int32[] result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Int64.cs
new file mode 100644
index 0000000000..9312d8f648
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Int64.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperInt64()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector256<Int64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ Vector128<Int64> lowerResult = value.GetLower();
+ Vector128<Int64> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector256<Int64> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector256<Int64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ object lowerResult = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector128<Int64>)(lowerResult), (Vector128<Int64>)(upperResult), values);
+
+ object result = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.WithLower), new Type[] { typeof(Vector128<Int64>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.WithUpper), new Type[] { typeof(Vector128<Int64>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector256<Int64>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector128<Int64> lowerResult, Vector128<Int64> upperResult, Int64[] values, [CallerMemberName] string method = "")
+ {
+ Int64[] lowerElements = new Int64[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref lowerElements[0]), lowerResult);
+
+ Int64[] upperElements = new Int64[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(Int64[] lowerResult, Int64[] upperResult, Int64[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Int64> result, Int64[] values, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(Int64[] result, Int64[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.SByte.cs
new file mode 100644
index 0000000000..73a7357492
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.SByte.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperSByte()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperSByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector256<SByte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ Vector128<SByte> lowerResult = value.GetLower();
+ Vector128<SByte> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector256<SByte> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector256<SByte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ object lowerResult = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector128<SByte>)(lowerResult), (Vector128<SByte>)(upperResult), values);
+
+ object result = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.WithLower), new Type[] { typeof(Vector128<SByte>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.WithUpper), new Type[] { typeof(Vector128<SByte>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector256<SByte>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector128<SByte> lowerResult, Vector128<SByte> upperResult, SByte[] values, [CallerMemberName] string method = "")
+ {
+ SByte[] lowerElements = new SByte[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref lowerElements[0]), lowerResult);
+
+ SByte[] upperElements = new SByte[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(SByte[] lowerResult, SByte[] upperResult, SByte[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<SByte> result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(SByte[] result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Single.cs
new file mode 100644
index 0000000000..6f9d1f7a39
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.Single.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperSingle()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperSingle
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector256<Single> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ Vector128<Single> lowerResult = value.GetLower();
+ Vector128<Single> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector256<Single> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector256<Single> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object lowerResult = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector128<Single>)(lowerResult), (Vector128<Single>)(upperResult), values);
+
+ object result = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.WithLower), new Type[] { typeof(Vector128<Single>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.WithUpper), new Type[] { typeof(Vector128<Single>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector256<Single>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector128<Single> lowerResult, Vector128<Single> upperResult, Single[] values, [CallerMemberName] string method = "")
+ {
+ Single[] lowerElements = new Single[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref lowerElements[0]), lowerResult);
+
+ Single[] upperElements = new Single[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(Single[] lowerResult, Single[] upperResult, Single[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<Single> result, Single[] values, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(Single[] result, Single[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.UInt16.cs
new file mode 100644
index 0000000000..75a5c73623
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.UInt16.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperUInt16()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperUInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector256<UInt16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ Vector128<UInt16> lowerResult = value.GetLower();
+ Vector128<UInt16> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector256<UInt16> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector256<UInt16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ object lowerResult = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector128<UInt16>)(lowerResult), (Vector128<UInt16>)(upperResult), values);
+
+ object result = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.WithLower), new Type[] { typeof(Vector128<UInt16>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.WithUpper), new Type[] { typeof(Vector128<UInt16>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector256<UInt16>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector128<UInt16> lowerResult, Vector128<UInt16> upperResult, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ UInt16[] lowerElements = new UInt16[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref lowerElements[0]), lowerResult);
+
+ UInt16[] upperElements = new UInt16[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(UInt16[] lowerResult, UInt16[] upperResult, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt16> result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(UInt16[] result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.UInt32.cs
new file mode 100644
index 0000000000..4f07a8c8ba
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.UInt32.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperUInt32()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperUInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector256<UInt32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ Vector128<UInt32> lowerResult = value.GetLower();
+ Vector128<UInt32> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector256<UInt32> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector256<UInt32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object lowerResult = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector128<UInt32>)(lowerResult), (Vector128<UInt32>)(upperResult), values);
+
+ object result = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.WithLower), new Type[] { typeof(Vector128<UInt32>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.WithUpper), new Type[] { typeof(Vector128<UInt32>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector256<UInt32>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector128<UInt32> lowerResult, Vector128<UInt32> upperResult, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ UInt32[] lowerElements = new UInt32[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref lowerElements[0]), lowerResult);
+
+ UInt32[] upperElements = new UInt32[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(UInt32[] lowerResult, UInt32[] upperResult, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt32> result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(UInt32[] result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.UInt64.cs
new file mode 100644
index 0000000000..d8e0cf99bb
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/GetAndWithLowerAndUpper.UInt64.cs
@@ -0,0 +1,190 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithLowerAndUpperUInt64()
+ {
+ var test = new VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithLowerAndUpper__GetAndWithLowerAndUpperUInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector256<UInt64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ Vector128<UInt64> lowerResult = value.GetLower();
+ Vector128<UInt64> upperResult = value.GetUpper();
+ ValidateGetResult(lowerResult, upperResult, values);
+
+ Vector256<UInt64> result = value.WithLower(upperResult);
+ result = result.WithUpper(lowerResult);
+ ValidateWithResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector256<UInt64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ object lowerResult = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.GetLower), new Type[] { })
+ .Invoke(value, new object[] { });
+ object upperResult = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.GetUpper), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateGetResult((Vector128<UInt64>)(lowerResult), (Vector128<UInt64>)(upperResult), values);
+
+ object result = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.WithLower), new Type[] { typeof(Vector128<UInt64>) })
+ .Invoke(value, new object[] { upperResult });
+ result = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.WithUpper), new Type[] { typeof(Vector128<UInt64>) })
+ .Invoke(result, new object[] { lowerResult });
+ ValidateWithResult((Vector256<UInt64>)(result), values);
+ }
+
+ private void ValidateGetResult(Vector128<UInt64> lowerResult, Vector128<UInt64> upperResult, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ UInt64[] lowerElements = new UInt64[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref lowerElements[0]), lowerResult);
+
+ UInt64[] upperElements = new UInt64[ElementCount / 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref upperElements[0]), upperResult);
+
+ ValidateGetResult(lowerElements, upperElements, values, method);
+ }
+
+ private void ValidateGetResult(UInt64[] lowerResult, UInt64[] upperResult, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (lowerResult[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64>.GetLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", lowerResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (upperResult[i - (ElementCount / 2)] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64>.GetUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", upperResult)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector256<UInt64> result, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, method);
+ }
+
+ private void ValidateWithResult(UInt64[] result, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount / 2; i++)
+ {
+ if (result[i] != values[i + (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.WithLower(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ for (int i = ElementCount / 2; i < ElementCount; i++)
+ {
+ if (result[i] != values[i - (ElementCount / 2)])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64.WithUpper(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Program.Vector256_1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Program.Vector256_1.cs
new file mode 100644
index 0000000000..10918b027d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Program.Vector256_1.cs
@@ -0,0 +1,95 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["Zero.Byte"] = ZeroByte,
+ ["Zero.Double"] = ZeroDouble,
+ ["Zero.Int16"] = ZeroInt16,
+ ["Zero.Int32"] = ZeroInt32,
+ ["Zero.Int64"] = ZeroInt64,
+ ["Zero.SByte"] = ZeroSByte,
+ ["Zero.Single"] = ZeroSingle,
+ ["Zero.UInt16"] = ZeroUInt16,
+ ["Zero.UInt32"] = ZeroUInt32,
+ ["Zero.UInt64"] = ZeroUInt64,
+ ["As.Byte"] = AsByte,
+ ["As.Double"] = AsDouble,
+ ["As.Int16"] = AsInt16,
+ ["As.Int32"] = AsInt32,
+ ["As.Int64"] = AsInt64,
+ ["As.SByte"] = AsSByte,
+ ["As.Single"] = AsSingle,
+ ["As.UInt16"] = AsUInt16,
+ ["As.UInt32"] = AsUInt32,
+ ["As.UInt64"] = AsUInt64,
+ ["GetAndWithElement.Byte.0"] = GetAndWithElementByte0,
+ ["GetAndWithElement.Byte.7"] = GetAndWithElementByte7,
+ ["GetAndWithElement.Byte.15"] = GetAndWithElementByte15,
+ ["GetAndWithElement.Byte.31"] = GetAndWithElementByte31,
+ ["GetAndWithElement.Double.0"] = GetAndWithElementDouble0,
+ ["GetAndWithElement.Double.1"] = GetAndWithElementDouble1,
+ ["GetAndWithElement.Double.3"] = GetAndWithElementDouble3,
+ ["GetAndWithElement.Int16.0"] = GetAndWithElementInt160,
+ ["GetAndWithElement.Int16.3"] = GetAndWithElementInt163,
+ ["GetAndWithElement.Int16.7"] = GetAndWithElementInt167,
+ ["GetAndWithElement.Int16.15"] = GetAndWithElementInt1615,
+ ["GetAndWithElement.Int32.0"] = GetAndWithElementInt320,
+ ["GetAndWithElement.Int32.1"] = GetAndWithElementInt321,
+ ["GetAndWithElement.Int32.3"] = GetAndWithElementInt323,
+ ["GetAndWithElement.Int32.7"] = GetAndWithElementInt327,
+ ["GetAndWithElement.Int64.0"] = GetAndWithElementInt640,
+ ["GetAndWithElement.Int64.1"] = GetAndWithElementInt641,
+ ["GetAndWithElement.Int64.3"] = GetAndWithElementInt643,
+ ["GetAndWithElement.SByte.0"] = GetAndWithElementSByte0,
+ ["GetAndWithElement.SByte.7"] = GetAndWithElementSByte7,
+ ["GetAndWithElement.SByte.15"] = GetAndWithElementSByte15,
+ ["GetAndWithElement.SByte.31"] = GetAndWithElementSByte31,
+ ["GetAndWithElement.Single.0"] = GetAndWithElementSingle0,
+ ["GetAndWithElement.Single.1"] = GetAndWithElementSingle1,
+ ["GetAndWithElement.Single.3"] = GetAndWithElementSingle3,
+ ["GetAndWithElement.Single.7"] = GetAndWithElementSingle7,
+ ["GetAndWithElement.UInt16.0"] = GetAndWithElementUInt160,
+ ["GetAndWithElement.UInt16.3"] = GetAndWithElementUInt163,
+ ["GetAndWithElement.UInt16.7"] = GetAndWithElementUInt167,
+ ["GetAndWithElement.UInt16.15"] = GetAndWithElementUInt1615,
+ ["GetAndWithElement.UInt32.0"] = GetAndWithElementUInt320,
+ ["GetAndWithElement.UInt32.1"] = GetAndWithElementUInt321,
+ ["GetAndWithElement.UInt32.3"] = GetAndWithElementUInt323,
+ ["GetAndWithElement.UInt32.7"] = GetAndWithElementUInt327,
+ ["GetAndWithElement.UInt64.0"] = GetAndWithElementUInt640,
+ ["GetAndWithElement.UInt64.1"] = GetAndWithElementUInt641,
+ ["GetAndWithElement.UInt64.3"] = GetAndWithElementUInt643,
+ ["GetAndWithLowerAndUpper.Byte"] = GetAndWithLowerAndUpperByte,
+ ["GetAndWithLowerAndUpper.Double"] = GetAndWithLowerAndUpperDouble,
+ ["GetAndWithLowerAndUpper.Int16"] = GetAndWithLowerAndUpperInt16,
+ ["GetAndWithLowerAndUpper.Int32"] = GetAndWithLowerAndUpperInt32,
+ ["GetAndWithLowerAndUpper.Int64"] = GetAndWithLowerAndUpperInt64,
+ ["GetAndWithLowerAndUpper.SByte"] = GetAndWithLowerAndUpperSByte,
+ ["GetAndWithLowerAndUpper.Single"] = GetAndWithLowerAndUpperSingle,
+ ["GetAndWithLowerAndUpper.UInt16"] = GetAndWithLowerAndUpperUInt16,
+ ["GetAndWithLowerAndUpper.UInt32"] = GetAndWithLowerAndUpperUInt32,
+ ["GetAndWithLowerAndUpper.UInt64"] = GetAndWithLowerAndUpperUInt64,
+ ["ToScalar.Byte"] = ToScalarByte,
+ ["ToScalar.Double"] = ToScalarDouble,
+ ["ToScalar.Int16"] = ToScalarInt16,
+ ["ToScalar.Int32"] = ToScalarInt32,
+ ["ToScalar.Int64"] = ToScalarInt64,
+ ["ToScalar.SByte"] = ToScalarSByte,
+ ["ToScalar.Single"] = ToScalarSingle,
+ ["ToScalar.UInt16"] = ToScalarUInt16,
+ ["ToScalar.UInt32"] = ToScalarUInt32,
+ ["ToScalar.UInt64"] = ToScalarUInt64,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Byte.cs
new file mode 100644
index 0000000000..65ec28e972
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Byte.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarByte()
+ {
+ var test = new VectorToScalar__ToScalarByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector256<Byte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ Byte result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector256<Byte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ object result = typeof(Vector256<Byte>)
+ .GetMethod(nameof(Vector256<Byte>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Byte)(result), values);
+ }
+
+ private void ValidateResult(Byte result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Byte>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Double.cs
new file mode 100644
index 0000000000..797df28187
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Double.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarDouble()
+ {
+ var test = new VectorToScalar__ToScalarDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarDouble
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector256<Double> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ Double result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector256<Double> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ object result = typeof(Vector256<Double>)
+ .GetMethod(nameof(Vector256<Double>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Double)(result), values);
+ }
+
+ private void ValidateResult(Double result, Double[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Double>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Int16.cs
new file mode 100644
index 0000000000..54d4ae9e71
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Int16.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarInt16()
+ {
+ var test = new VectorToScalar__ToScalarInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ Int16 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector256<Int16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ object result = typeof(Vector256<Int16>)
+ .GetMethod(nameof(Vector256<Int16>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Int16)(result), values);
+ }
+
+ private void ValidateResult(Int16 result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int16>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Int32.cs
new file mode 100644
index 0000000000..4b1653c22a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Int32.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarInt32()
+ {
+ var test = new VectorToScalar__ToScalarInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector256<Int32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ Int32 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector256<Int32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object result = typeof(Vector256<Int32>)
+ .GetMethod(nameof(Vector256<Int32>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Int32)(result), values);
+ }
+
+ private void ValidateResult(Int32 result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int32>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Int64.cs
new file mode 100644
index 0000000000..cd2c54b409
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Int64.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarInt64()
+ {
+ var test = new VectorToScalar__ToScalarInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector256<Int64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ Int64 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector256<Int64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ object result = typeof(Vector256<Int64>)
+ .GetMethod(nameof(Vector256<Int64>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Int64)(result), values);
+ }
+
+ private void ValidateResult(Int64 result, Int64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Int64>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.SByte.cs
new file mode 100644
index 0000000000..729494e3f1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.SByte.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarSByte()
+ {
+ var test = new VectorToScalar__ToScalarSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarSByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector256<SByte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ SByte result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector256<SByte> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]);
+
+ object result = typeof(Vector256<SByte>)
+ .GetMethod(nameof(Vector256<SByte>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((SByte)(result), values);
+ }
+
+ private void ValidateResult(SByte result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<SByte>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Single.cs
new file mode 100644
index 0000000000..c3409c046e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.Single.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarSingle()
+ {
+ var test = new VectorToScalar__ToScalarSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarSingle
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector256<Single> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ Single result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector256<Single> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object result = typeof(Vector256<Single>)
+ .GetMethod(nameof(Vector256<Single>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Single)(result), values);
+ }
+
+ private void ValidateResult(Single result, Single[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<Single>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.UInt16.cs
new file mode 100644
index 0000000000..9be837d1a5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.UInt16.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarUInt16()
+ {
+ var test = new VectorToScalar__ToScalarUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarUInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector256<UInt16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ UInt16 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector256<UInt16> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]);
+
+ object result = typeof(Vector256<UInt16>)
+ .GetMethod(nameof(Vector256<UInt16>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((UInt16)(result), values);
+ }
+
+ private void ValidateResult(UInt16 result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt16>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.UInt32.cs
new file mode 100644
index 0000000000..c8d752c837
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.UInt32.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarUInt32()
+ {
+ var test = new VectorToScalar__ToScalarUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarUInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector256<UInt32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ UInt32 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector256<UInt32> value = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object result = typeof(Vector256<UInt32>)
+ .GetMethod(nameof(Vector256<UInt32>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((UInt32)(result), values);
+ }
+
+ private void ValidateResult(UInt32 result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt32>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.UInt64.cs
new file mode 100644
index 0000000000..381ee117b6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToScalar.UInt64.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarUInt64()
+ {
+ var test = new VectorToScalar__ToScalarUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarUInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector256<UInt64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ UInt64 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector256<UInt64> value = Vector256.Create(values[0], values[1], values[2], values[3]);
+
+ object result = typeof(Vector256<UInt64>)
+ .GetMethod(nameof(Vector256<UInt64>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((UInt64)(result), values);
+ }
+
+ private void ValidateResult(UInt64 result, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector256<UInt64>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_r.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_r.csproj
new file mode 100644
index 0000000000..b559e4a367
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_r.csproj
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Embedded</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="As.Byte.cs" />
+ <Compile Include="As.Double.cs" />
+ <Compile Include="As.Int16.cs" />
+ <Compile Include="As.Int32.cs" />
+ <Compile Include="As.Int64.cs" />
+ <Compile Include="As.SByte.cs" />
+ <Compile Include="As.Single.cs" />
+ <Compile Include="As.UInt16.cs" />
+ <Compile Include="As.UInt32.cs" />
+ <Compile Include="As.UInt64.cs" />
+ <Compile Include="GetAndWithElement.Byte.0.cs" />
+ <Compile Include="GetAndWithElement.Byte.7.cs" />
+ <Compile Include="GetAndWithElement.Byte.15.cs" />
+ <Compile Include="GetAndWithElement.Byte.31.cs" />
+ <Compile Include="GetAndWithElement.Double.0.cs" />
+ <Compile Include="GetAndWithElement.Double.1.cs" />
+ <Compile Include="GetAndWithElement.Double.3.cs" />
+ <Compile Include="GetAndWithElement.Int16.0.cs" />
+ <Compile Include="GetAndWithElement.Int16.3.cs" />
+ <Compile Include="GetAndWithElement.Int16.7.cs" />
+ <Compile Include="GetAndWithElement.Int16.15.cs" />
+ <Compile Include="GetAndWithElement.Int32.0.cs" />
+ <Compile Include="GetAndWithElement.Int32.1.cs" />
+ <Compile Include="GetAndWithElement.Int32.3.cs" />
+ <Compile Include="GetAndWithElement.Int32.7.cs" />
+ <Compile Include="GetAndWithElement.Int64.0.cs" />
+ <Compile Include="GetAndWithElement.Int64.1.cs" />
+ <Compile Include="GetAndWithElement.Int64.3.cs" />
+ <Compile Include="GetAndWithElement.SByte.0.cs" />
+ <Compile Include="GetAndWithElement.SByte.7.cs" />
+ <Compile Include="GetAndWithElement.SByte.15.cs" />
+ <Compile Include="GetAndWithElement.SByte.31.cs" />
+ <Compile Include="GetAndWithElement.Single.0.cs" />
+ <Compile Include="GetAndWithElement.Single.1.cs" />
+ <Compile Include="GetAndWithElement.Single.3.cs" />
+ <Compile Include="GetAndWithElement.Single.7.cs" />
+ <Compile Include="GetAndWithElement.UInt16.0.cs" />
+ <Compile Include="GetAndWithElement.UInt16.3.cs" />
+ <Compile Include="GetAndWithElement.UInt16.7.cs" />
+ <Compile Include="GetAndWithElement.UInt16.15.cs" />
+ <Compile Include="GetAndWithElement.UInt32.0.cs" />
+ <Compile Include="GetAndWithElement.UInt32.1.cs" />
+ <Compile Include="GetAndWithElement.UInt32.3.cs" />
+ <Compile Include="GetAndWithElement.UInt32.7.cs" />
+ <Compile Include="GetAndWithElement.UInt64.0.cs" />
+ <Compile Include="GetAndWithElement.UInt64.1.cs" />
+ <Compile Include="GetAndWithElement.UInt64.3.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Byte.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Double.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Int16.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Int32.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Int64.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.SByte.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Single.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.UInt16.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.UInt32.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.UInt64.cs" />
+ <Compile Include="ToScalar.Byte.cs" />
+ <Compile Include="ToScalar.Double.cs" />
+ <Compile Include="ToScalar.Int16.cs" />
+ <Compile Include="ToScalar.Int32.cs" />
+ <Compile Include="ToScalar.Int64.cs" />
+ <Compile Include="ToScalar.SByte.cs" />
+ <Compile Include="ToScalar.Single.cs" />
+ <Compile Include="ToScalar.UInt16.cs" />
+ <Compile Include="ToScalar.UInt32.cs" />
+ <Compile Include="ToScalar.UInt64.cs" />
+ <Compile Include="Zero.Byte.cs" />
+ <Compile Include="Zero.Double.cs" />
+ <Compile Include="Zero.Int16.cs" />
+ <Compile Include="Zero.Int32.cs" />
+ <Compile Include="Zero.Int64.cs" />
+ <Compile Include="Zero.SByte.cs" />
+ <Compile Include="Zero.Single.cs" />
+ <Compile Include="Zero.UInt16.cs" />
+ <Compile Include="Zero.UInt32.cs" />
+ <Compile Include="Zero.UInt64.cs" />
+ <Compile Include="Program.Vector256_1.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_ro.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_ro.csproj
new file mode 100644
index 0000000000..da7f86b54f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_ro.csproj
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Embedded</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="As.Byte.cs" />
+ <Compile Include="As.Double.cs" />
+ <Compile Include="As.Int16.cs" />
+ <Compile Include="As.Int32.cs" />
+ <Compile Include="As.Int64.cs" />
+ <Compile Include="As.SByte.cs" />
+ <Compile Include="As.Single.cs" />
+ <Compile Include="As.UInt16.cs" />
+ <Compile Include="As.UInt32.cs" />
+ <Compile Include="As.UInt64.cs" />
+ <Compile Include="GetAndWithElement.Byte.0.cs" />
+ <Compile Include="GetAndWithElement.Byte.7.cs" />
+ <Compile Include="GetAndWithElement.Byte.15.cs" />
+ <Compile Include="GetAndWithElement.Byte.31.cs" />
+ <Compile Include="GetAndWithElement.Double.0.cs" />
+ <Compile Include="GetAndWithElement.Double.1.cs" />
+ <Compile Include="GetAndWithElement.Double.3.cs" />
+ <Compile Include="GetAndWithElement.Int16.0.cs" />
+ <Compile Include="GetAndWithElement.Int16.3.cs" />
+ <Compile Include="GetAndWithElement.Int16.7.cs" />
+ <Compile Include="GetAndWithElement.Int16.15.cs" />
+ <Compile Include="GetAndWithElement.Int32.0.cs" />
+ <Compile Include="GetAndWithElement.Int32.1.cs" />
+ <Compile Include="GetAndWithElement.Int32.3.cs" />
+ <Compile Include="GetAndWithElement.Int32.7.cs" />
+ <Compile Include="GetAndWithElement.Int64.0.cs" />
+ <Compile Include="GetAndWithElement.Int64.1.cs" />
+ <Compile Include="GetAndWithElement.Int64.3.cs" />
+ <Compile Include="GetAndWithElement.SByte.0.cs" />
+ <Compile Include="GetAndWithElement.SByte.7.cs" />
+ <Compile Include="GetAndWithElement.SByte.15.cs" />
+ <Compile Include="GetAndWithElement.SByte.31.cs" />
+ <Compile Include="GetAndWithElement.Single.0.cs" />
+ <Compile Include="GetAndWithElement.Single.1.cs" />
+ <Compile Include="GetAndWithElement.Single.3.cs" />
+ <Compile Include="GetAndWithElement.Single.7.cs" />
+ <Compile Include="GetAndWithElement.UInt16.0.cs" />
+ <Compile Include="GetAndWithElement.UInt16.3.cs" />
+ <Compile Include="GetAndWithElement.UInt16.7.cs" />
+ <Compile Include="GetAndWithElement.UInt16.15.cs" />
+ <Compile Include="GetAndWithElement.UInt32.0.cs" />
+ <Compile Include="GetAndWithElement.UInt32.1.cs" />
+ <Compile Include="GetAndWithElement.UInt32.3.cs" />
+ <Compile Include="GetAndWithElement.UInt32.7.cs" />
+ <Compile Include="GetAndWithElement.UInt64.0.cs" />
+ <Compile Include="GetAndWithElement.UInt64.1.cs" />
+ <Compile Include="GetAndWithElement.UInt64.3.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Byte.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Double.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Int16.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Int32.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Int64.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.SByte.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.Single.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.UInt16.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.UInt32.cs" />
+ <Compile Include="GetAndWithLowerAndUpper.UInt64.cs" />
+ <Compile Include="ToScalar.Byte.cs" />
+ <Compile Include="ToScalar.Double.cs" />
+ <Compile Include="ToScalar.Int16.cs" />
+ <Compile Include="ToScalar.Int32.cs" />
+ <Compile Include="ToScalar.Int64.cs" />
+ <Compile Include="ToScalar.SByte.cs" />
+ <Compile Include="ToScalar.Single.cs" />
+ <Compile Include="ToScalar.UInt16.cs" />
+ <Compile Include="ToScalar.UInt32.cs" />
+ <Compile Include="ToScalar.UInt64.cs" />
+ <Compile Include="Zero.Byte.cs" />
+ <Compile Include="Zero.Double.cs" />
+ <Compile Include="Zero.Int16.cs" />
+ <Compile Include="Zero.Int32.cs" />
+ <Compile Include="Zero.Int64.cs" />
+ <Compile Include="Zero.SByte.cs" />
+ <Compile Include="Zero.Single.cs" />
+ <Compile Include="Zero.UInt16.cs" />
+ <Compile Include="Zero.UInt32.cs" />
+ <Compile Include="Zero.UInt64.cs" />
+ <Compile Include="Program.Vector256_1.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Byte.cs
new file mode 100644
index 0000000000..b0edbfcdbf
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Byte.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroByte()
+ {
+ var test = new VectorZero__ZeroByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector256<Byte> result = Vector256<Byte>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector256<Byte>)
+ .GetProperty(nameof(Vector256<Byte>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector256<Byte>)(result));
+ }
+
+ private void ValidateResult(Vector256<Byte> result, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Zero(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Double.cs
new file mode 100644
index 0000000000..49aec83320
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Double.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroDouble()
+ {
+ var test = new VectorZero__ZeroDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroDouble
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector256<Double> result = Vector256<Double>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector256<Double>)
+ .GetProperty(nameof(Vector256<Double>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector256<Double>)(result));
+ }
+
+ private void ValidateResult(Vector256<Double> result, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Zero(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Int16.cs
new file mode 100644
index 0000000000..18a7ce3ee4
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Int16.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroInt16()
+ {
+ var test = new VectorZero__ZeroInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector256<Int16> result = Vector256<Int16>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector256<Int16>)
+ .GetProperty(nameof(Vector256<Int16>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector256<Int16>)(result));
+ }
+
+ private void ValidateResult(Vector256<Int16> result, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Zero(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Int32.cs
new file mode 100644
index 0000000000..d08c9f15a9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Int32.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroInt32()
+ {
+ var test = new VectorZero__ZeroInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector256<Int32> result = Vector256<Int32>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector256<Int32>)
+ .GetProperty(nameof(Vector256<Int32>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector256<Int32>)(result));
+ }
+
+ private void ValidateResult(Vector256<Int32> result, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Zero(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Int64.cs
new file mode 100644
index 0000000000..9545a41de1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Int64.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroInt64()
+ {
+ var test = new VectorZero__ZeroInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector256<Int64> result = Vector256<Int64>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector256<Int64>)
+ .GetProperty(nameof(Vector256<Int64>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector256<Int64>)(result));
+ }
+
+ private void ValidateResult(Vector256<Int64> result, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Zero(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.SByte.cs
new file mode 100644
index 0000000000..e8f0901cdc
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.SByte.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroSByte()
+ {
+ var test = new VectorZero__ZeroSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroSByte
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector256<SByte> result = Vector256<SByte>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector256<SByte>)
+ .GetProperty(nameof(Vector256<SByte>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector256<SByte>)(result));
+ }
+
+ private void ValidateResult(Vector256<SByte> result, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Zero(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Single.cs
new file mode 100644
index 0000000000..6a84d79185
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.Single.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroSingle()
+ {
+ var test = new VectorZero__ZeroSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroSingle
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector256<Single> result = Vector256<Single>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector256<Single>)
+ .GetProperty(nameof(Vector256<Single>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector256<Single>)(result));
+ }
+
+ private void ValidateResult(Vector256<Single> result, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Zero(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.UInt16.cs
new file mode 100644
index 0000000000..d55888c089
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.UInt16.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroUInt16()
+ {
+ var test = new VectorZero__ZeroUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroUInt16
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector256<UInt16> result = Vector256<UInt16>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector256<UInt16>)
+ .GetProperty(nameof(Vector256<UInt16>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector256<UInt16>)(result));
+ }
+
+ private void ValidateResult(Vector256<UInt16> result, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Zero(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.UInt32.cs
new file mode 100644
index 0000000000..25679e6af3
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.UInt32.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroUInt32()
+ {
+ var test = new VectorZero__ZeroUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroUInt32
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector256<UInt32> result = Vector256<UInt32>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector256<UInt32>)
+ .GetProperty(nameof(Vector256<UInt32>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector256<UInt32>)(result));
+ }
+
+ private void ValidateResult(Vector256<UInt32> result, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Zero(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.UInt64.cs
new file mode 100644
index 0000000000..867a4848b0
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Zero.UInt64.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroUInt64()
+ {
+ var test = new VectorZero__ZeroUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroUInt64
+ {
+ private static readonly int LargestVectorSize = 32;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector256<UInt64> result = Vector256<UInt64>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector256<UInt64>)
+ .GetProperty(nameof(Vector256<UInt64>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector256<UInt64>)(result));
+ }
+
+ private void ValidateResult(Vector256<UInt64> result, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector256.Zero(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Byte.cs
new file mode 100644
index 0000000000..3d94caa180
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Byte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateByte()
+ {
+ var test = new VectorCreate__CreateByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ Vector64<Byte> result = Vector64.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), new Type[] { typeof(Byte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Byte>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Byte> result, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Double.cs
new file mode 100644
index 0000000000..519c1db290
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Double.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateDouble()
+ {
+ var test = new VectorCreate__CreateDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateDouble
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ Vector64<Double> result = Vector64.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double value = TestLibrary.Generator.GetDouble();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), new Type[] { typeof(Double) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Double>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Double> result, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Int16.cs
new file mode 100644
index 0000000000..0f825a991b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Int16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateInt16()
+ {
+ var test = new VectorCreate__CreateInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ Vector64<Int16> result = Vector64.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), new Type[] { typeof(Int16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Int16>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Int16> result, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Int32.cs
new file mode 100644
index 0000000000..7d4feffbd1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Int32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateInt32()
+ {
+ var test = new VectorCreate__CreateInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ Vector64<Int32> result = Vector64.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), new Type[] { typeof(Int32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Int32>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Int32> result, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Int64.cs
new file mode 100644
index 0000000000..734cde87f0
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Int64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateInt64()
+ {
+ var test = new VectorCreate__CreateInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateInt64
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ Vector64<Int64> result = Vector64.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64 value = TestLibrary.Generator.GetInt64();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), new Type[] { typeof(Int64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Int64>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Int64> result, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.SByte.cs
new file mode 100644
index 0000000000..b437df7226
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.SByte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateSByte()
+ {
+ var test = new VectorCreate__CreateSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateSByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ Vector64<SByte> result = Vector64.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), new Type[] { typeof(SByte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<SByte>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<SByte> result, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Single.cs
new file mode 100644
index 0000000000..b8177753cd
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.Single.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateSingle()
+ {
+ var test = new VectorCreate__CreateSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateSingle
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ Vector64<Single> result = Vector64.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), new Type[] { typeof(Single) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Single>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Single> result, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.UInt16.cs
new file mode 100644
index 0000000000..fe64a1c03a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.UInt16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateUInt16()
+ {
+ var test = new VectorCreate__CreateUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateUInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ Vector64<UInt16> result = Vector64.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), new Type[] { typeof(UInt16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<UInt16>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<UInt16> result, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.UInt32.cs
new file mode 100644
index 0000000000..e6876bac00
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.UInt32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateUInt32()
+ {
+ var test = new VectorCreate__CreateUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateUInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ Vector64<UInt32> result = Vector64.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), new Type[] { typeof(UInt32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<UInt32>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<UInt32> result, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.UInt64.cs
new file mode 100644
index 0000000000..936eb3df13
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Create.UInt64.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateUInt64()
+ {
+ var test = new VectorCreate__CreateUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateUInt64
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ Vector64<UInt64> result = Vector64.Create(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64 value = TestLibrary.Generator.GetUInt64();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), new Type[] { typeof(UInt64) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<UInt64>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<UInt64> result, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValue)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Byte.cs
new file mode 100644
index 0000000000..79be2dfc90
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Byte.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementByte()
+ {
+ var test = new VectorCreate__CreateElementByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector64<Byte> result = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Byte);
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7] });
+
+ ValidateResult((Vector64<Byte>)(result), values);
+ }
+
+ private void ValidateResult(Vector64<Byte> result, Byte[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Int16.cs
new file mode 100644
index 0000000000..1081a2001a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Int16.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementInt16()
+ {
+ var test = new VectorCreate__CreateElementInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector64<Int16> result = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Int16);
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3] });
+
+ ValidateResult((Vector64<Int16>)(result), values);
+ }
+
+ private void ValidateResult(Vector64<Int16> result, Int16[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Int32.cs
new file mode 100644
index 0000000000..ee4c0e594c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Int32.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementInt32()
+ {
+ var test = new VectorCreate__CreateElementInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector64<Int32> result = Vector64.Create(values[0], values[1]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Int32);
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1] });
+
+ ValidateResult((Vector64<Int32>)(result), values);
+ }
+
+ private void ValidateResult(Vector64<Int32> result, Int32[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.SByte.cs
new file mode 100644
index 0000000000..fbd75dd742
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.SByte.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementSByte()
+ {
+ var test = new VectorCreate__CreateElementSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementSByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector64<SByte> result = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(SByte);
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7] });
+
+ ValidateResult((Vector64<SByte>)(result), values);
+ }
+
+ private void ValidateResult(Vector64<SByte> result, SByte[] expectedValues, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Single.cs
new file mode 100644
index 0000000000..dd0b74cfa5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.Single.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementSingle()
+ {
+ var test = new VectorCreate__CreateElementSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementSingle
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector64<Single> result = Vector64.Create(values[0], values[1]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(Single);
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1] });
+
+ ValidateResult((Vector64<Single>)(result), values);
+ }
+
+ private void ValidateResult(Vector64<Single> result, Single[] expectedValues, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.UInt16.cs
new file mode 100644
index 0000000000..2f171857e1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.UInt16.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementUInt16()
+ {
+ var test = new VectorCreate__CreateElementUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementUInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector64<UInt16> result = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(UInt16);
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1], values[2], values[3] });
+
+ ValidateResult((Vector64<UInt16>)(result), values);
+ }
+
+ private void ValidateResult(Vector64<UInt16> result, UInt16[] expectedValues, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.UInt32.cs
new file mode 100644
index 0000000000..dae04a3de7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateElement.UInt32.cs
@@ -0,0 +1,109 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateElementUInt32()
+ {
+ var test = new VectorCreate__CreateElementUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateElementUInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector64<UInt32> result = Vector64.Create(values[0], values[1]);
+
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Type[] operandTypes = new Type[ElementCount];
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ operandTypes[i] = typeof(UInt32);
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.Create), operandTypes)
+ .Invoke(null, new object[] { values[0], values[1] });
+
+ ValidateResult((Vector64<UInt32>)(result), values);
+ }
+
+ private void ValidateResult(Vector64<UInt32> result, UInt32[] expectedValues, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValues, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32[] expectedValues, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != expectedValues[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Create(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", expectedValues)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Byte.cs
new file mode 100644
index 0000000000..d57e7e9d1a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Byte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarByte()
+ {
+ var test = new VectorCreate__CreateScalarByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ Vector64<Byte> result = Vector64.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalar), new Type[] { typeof(Byte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Byte>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Byte> result, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalar(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Int16.cs
new file mode 100644
index 0000000000..ff5cc9f5ca
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Int16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarInt16()
+ {
+ var test = new VectorCreate__CreateScalarInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ Vector64<Int16> result = Vector64.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalar), new Type[] { typeof(Int16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Int16>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Int16> result, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalar(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Int32.cs
new file mode 100644
index 0000000000..ee8a0618e9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Int32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarInt32()
+ {
+ var test = new VectorCreate__CreateScalarInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ Vector64<Int32> result = Vector64.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalar), new Type[] { typeof(Int32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Int32>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Int32> result, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalar(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.SByte.cs
new file mode 100644
index 0000000000..691a8486ce
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.SByte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarSByte()
+ {
+ var test = new VectorCreate__CreateScalarSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarSByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ Vector64<SByte> result = Vector64.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalar), new Type[] { typeof(SByte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<SByte>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<SByte> result, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalar(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Single.cs
new file mode 100644
index 0000000000..d0005554b3
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.Single.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarSingle()
+ {
+ var test = new VectorCreate__CreateScalarSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarSingle
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ Vector64<Single> result = Vector64.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalar), new Type[] { typeof(Single) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Single>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Single> result, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalar(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.UInt16.cs
new file mode 100644
index 0000000000..6fc0ea914b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.UInt16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUInt16()
+ {
+ var test = new VectorCreate__CreateScalarUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ Vector64<UInt16> result = Vector64.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalar), new Type[] { typeof(UInt16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<UInt16>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<UInt16> result, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalar(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.UInt32.cs
new file mode 100644
index 0000000000..39078e0e7c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalar.UInt32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUInt32()
+ {
+ var test = new VectorCreate__CreateScalarUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ Vector64<UInt32> result = Vector64.CreateScalar(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalar), new Type[] { typeof(UInt32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<UInt32>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<UInt32> result, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalar(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Byte.cs
new file mode 100644
index 0000000000..d4222d9e80
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Byte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeByte()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ Vector64<Byte> result = Vector64.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte value = TestLibrary.Generator.GetByte();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalarUnsafe), new Type[] { typeof(Byte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Byte>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Byte> result, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalarUnsafe(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Int16.cs
new file mode 100644
index 0000000000..b49c4a99fa
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Int16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeInt16()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ Vector64<Int16> result = Vector64.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16 value = TestLibrary.Generator.GetInt16();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalarUnsafe), new Type[] { typeof(Int16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Int16>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Int16> result, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalarUnsafe(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Int32.cs
new file mode 100644
index 0000000000..0e4f34d6c8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Int32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeInt32()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ Vector64<Int32> result = Vector64.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32 value = TestLibrary.Generator.GetInt32();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalarUnsafe), new Type[] { typeof(Int32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Int32>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Int32> result, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalarUnsafe(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.SByte.cs
new file mode 100644
index 0000000000..052a77d080
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.SByte.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeSByte()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeSByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ Vector64<SByte> result = Vector64.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte value = TestLibrary.Generator.GetSByte();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalarUnsafe), new Type[] { typeof(SByte) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<SByte>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<SByte> result, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalarUnsafe(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Single.cs
new file mode 100644
index 0000000000..236a12c74a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.Single.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeSingle()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeSingle
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ Vector64<Single> result = Vector64.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single value = TestLibrary.Generator.GetSingle();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalarUnsafe), new Type[] { typeof(Single) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<Single>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<Single> result, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalarUnsafe(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.UInt16.cs
new file mode 100644
index 0000000000..31ed850d5a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.UInt16.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeUInt16()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeUInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ Vector64<UInt16> result = Vector64.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16 value = TestLibrary.Generator.GetUInt16();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalarUnsafe), new Type[] { typeof(UInt16) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<UInt16>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<UInt16> result, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalarUnsafe(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.UInt32.cs
new file mode 100644
index 0000000000..151cf897c7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/CreateScalarUnsafe.UInt32.cs
@@ -0,0 +1,102 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void CreateScalarUnsafeUInt32()
+ {
+ var test = new VectorCreate__CreateScalarUnsafeUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorCreate__CreateScalarUnsafeUInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ Vector64<UInt32> result = Vector64.CreateScalarUnsafe(value);
+
+ ValidateResult(result, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32 value = TestLibrary.Generator.GetUInt32();
+ object result = typeof(Vector64)
+ .GetMethod(nameof(Vector64.CreateScalarUnsafe), new Type[] { typeof(UInt32) })
+ .Invoke(null, new object[] { value });
+
+ ValidateResult((Vector64<UInt32>)(result), value);
+ }
+
+ private void ValidateResult(Vector64<UInt32> result, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, expectedValue, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32 expectedValue, [CallerMemberName] string method = "")
+ {
+ if (resultElements[0] != expectedValue)
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < ElementCount; i++)
+ {
+ if (false /* value is uninitialized */)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.CreateScalarUnsafe(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: {expectedValue}");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64/Program.Vector64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Program.Vector64.cs
new file mode 100644
index 0000000000..ae387c64e1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Program.Vector64.cs
@@ -0,0 +1,49 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["Create.Byte"] = CreateByte,
+ ["Create.Double"] = CreateDouble,
+ ["Create.Int16"] = CreateInt16,
+ ["Create.Int32"] = CreateInt32,
+ ["Create.Int64"] = CreateInt64,
+ ["Create.SByte"] = CreateSByte,
+ ["Create.Single"] = CreateSingle,
+ ["Create.UInt16"] = CreateUInt16,
+ ["Create.UInt32"] = CreateUInt32,
+ ["Create.UInt64"] = CreateUInt64,
+ ["CreateScalar.Byte"] = CreateScalarByte,
+ ["CreateScalar.Int16"] = CreateScalarInt16,
+ ["CreateScalar.Int32"] = CreateScalarInt32,
+ ["CreateScalar.SByte"] = CreateScalarSByte,
+ ["CreateScalar.Single"] = CreateScalarSingle,
+ ["CreateScalar.UInt16"] = CreateScalarUInt16,
+ ["CreateScalar.UInt32"] = CreateScalarUInt32,
+ ["CreateScalarUnsafe.Byte"] = CreateScalarUnsafeByte,
+ ["CreateScalarUnsafe.Int16"] = CreateScalarUnsafeInt16,
+ ["CreateScalarUnsafe.Int32"] = CreateScalarUnsafeInt32,
+ ["CreateScalarUnsafe.SByte"] = CreateScalarUnsafeSByte,
+ ["CreateScalarUnsafe.Single"] = CreateScalarUnsafeSingle,
+ ["CreateScalarUnsafe.UInt16"] = CreateScalarUnsafeUInt16,
+ ["CreateScalarUnsafe.UInt32"] = CreateScalarUnsafeUInt32,
+ ["CreateElement.Byte"] = CreateElementByte,
+ ["CreateElement.Int16"] = CreateElementInt16,
+ ["CreateElement.Int32"] = CreateElementInt32,
+ ["CreateElement.SByte"] = CreateElementSByte,
+ ["CreateElement.Single"] = CreateElementSingle,
+ ["CreateElement.UInt16"] = CreateElementUInt16,
+ ["CreateElement.UInt32"] = CreateElementUInt32,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_r.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Vector64_r.csproj
index 4a3b460fea..b611b276aa 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Vector64_r.csproj
@@ -27,7 +27,39 @@
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
- <Compile Include="SetAllVector256.cs" />
+ <Compile Include="Create.Byte.cs" />
+ <Compile Include="Create.Double.cs" />
+ <Compile Include="Create.Int16.cs" />
+ <Compile Include="Create.Int32.cs" />
+ <Compile Include="Create.Int64.cs" />
+ <Compile Include="Create.SByte.cs" />
+ <Compile Include="Create.Single.cs" />
+ <Compile Include="Create.UInt16.cs" />
+ <Compile Include="Create.UInt32.cs" />
+ <Compile Include="Create.UInt64.cs" />
+ <Compile Include="CreateElement.Byte.cs" />
+ <Compile Include="CreateElement.Int16.cs" />
+ <Compile Include="CreateElement.Int32.cs" />
+ <Compile Include="CreateElement.SByte.cs" />
+ <Compile Include="CreateElement.Single.cs" />
+ <Compile Include="CreateElement.UInt16.cs" />
+ <Compile Include="CreateElement.UInt32.cs" />
+ <Compile Include="CreateScalar.Byte.cs" />
+ <Compile Include="CreateScalar.Int16.cs" />
+ <Compile Include="CreateScalar.Int32.cs" />
+ <Compile Include="CreateScalar.SByte.cs" />
+ <Compile Include="CreateScalar.Single.cs" />
+ <Compile Include="CreateScalar.UInt16.cs" />
+ <Compile Include="CreateScalar.UInt32.cs" />
+ <Compile Include="CreateScalarUnsafe.Byte.cs" />
+ <Compile Include="CreateScalarUnsafe.Int16.cs" />
+ <Compile Include="CreateScalarUnsafe.Int32.cs" />
+ <Compile Include="CreateScalarUnsafe.SByte.cs" />
+ <Compile Include="CreateScalarUnsafe.Single.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt16.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt32.cs" />
+ <Compile Include="Program.Vector64.cs" />
+ <Compile Include="..\Shared\Program.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetZeroVector256_ro.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Vector64_ro.csproj
index ccddb7703d..57eb9c9fe4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetZeroVector256_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64/Vector64_ro.csproj
@@ -27,7 +27,39 @@
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
- <Compile Include="SetZeroVector256.cs" />
+ <Compile Include="Create.Byte.cs" />
+ <Compile Include="Create.Double.cs" />
+ <Compile Include="Create.Int16.cs" />
+ <Compile Include="Create.Int32.cs" />
+ <Compile Include="Create.Int64.cs" />
+ <Compile Include="Create.SByte.cs" />
+ <Compile Include="Create.Single.cs" />
+ <Compile Include="Create.UInt16.cs" />
+ <Compile Include="Create.UInt32.cs" />
+ <Compile Include="Create.UInt64.cs" />
+ <Compile Include="CreateElement.Byte.cs" />
+ <Compile Include="CreateElement.Int16.cs" />
+ <Compile Include="CreateElement.Int32.cs" />
+ <Compile Include="CreateElement.SByte.cs" />
+ <Compile Include="CreateElement.Single.cs" />
+ <Compile Include="CreateElement.UInt16.cs" />
+ <Compile Include="CreateElement.UInt32.cs" />
+ <Compile Include="CreateScalar.Byte.cs" />
+ <Compile Include="CreateScalar.Int16.cs" />
+ <Compile Include="CreateScalar.Int32.cs" />
+ <Compile Include="CreateScalar.SByte.cs" />
+ <Compile Include="CreateScalar.Single.cs" />
+ <Compile Include="CreateScalar.UInt16.cs" />
+ <Compile Include="CreateScalar.UInt32.cs" />
+ <Compile Include="CreateScalarUnsafe.Byte.cs" />
+ <Compile Include="CreateScalarUnsafe.Int16.cs" />
+ <Compile Include="CreateScalarUnsafe.Int32.cs" />
+ <Compile Include="CreateScalarUnsafe.SByte.cs" />
+ <Compile Include="CreateScalarUnsafe.Single.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt16.cs" />
+ <Compile Include="CreateScalarUnsafe.UInt32.cs" />
+ <Compile Include="Program.Vector64.cs" />
+ <Compile Include="..\Shared\Program.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Byte.cs
new file mode 100644
index 0000000000..6eac65c18d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Byte.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsByte()
+ {
+ var test = new VectorAs__AsByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector64<Byte> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector64<Byte> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ Vector64<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector64<Byte> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ object byteResult = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<byte>)(byteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ object doubleResult = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<double>)(doubleResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ object shortResult = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<short>)(shortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ object intResult = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<int>)(intResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ object longResult = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<long>)(longResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ object sbyteResult = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<sbyte>)(sbyteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ object floatResult = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<float>)(floatResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ object ushortResult = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ushort>)(ushortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ object uintResult = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<uint>)(uintResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetByte());
+ object ulongResult = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector64<T> result, Vector64<Byte> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+
+ Byte[] valueElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, Byte[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Double.cs
new file mode 100644
index 0000000000..5049d3bf19
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Double.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsDouble()
+ {
+ var test = new VectorAs__AsDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsDouble
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector64<Double> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector64<Double> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ Vector64<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector64<Double> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ object byteResult = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<byte>)(byteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ object doubleResult = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<double>)(doubleResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ object shortResult = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<short>)(shortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ object intResult = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<int>)(intResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ object longResult = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<long>)(longResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ object sbyteResult = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<sbyte>)(sbyteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ object floatResult = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<float>)(floatResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ object ushortResult = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ushort>)(ushortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ object uintResult = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<uint>)(uintResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetDouble());
+ object ulongResult = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector64<T> result, Vector64<Double> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+
+ Double[] valueElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Double[] resultElements, Double[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Double>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Int16.cs
new file mode 100644
index 0000000000..277f19bfb0
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Int16.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsInt16()
+ {
+ var test = new VectorAs__AsInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector64<Int16> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector64<Int16> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ Vector64<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector64<Int16> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ object byteResult = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<byte>)(byteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ object doubleResult = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<double>)(doubleResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ object shortResult = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<short>)(shortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ object intResult = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<int>)(intResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ object longResult = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<long>)(longResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ object sbyteResult = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<sbyte>)(sbyteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ object floatResult = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<float>)(floatResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ object ushortResult = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ushort>)(ushortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ object uintResult = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<uint>)(uintResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt16());
+ object ulongResult = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector64<T> result, Vector64<Int16> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+
+ Int16[] valueElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, Int16[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Int32.cs
new file mode 100644
index 0000000000..2e84dc7288
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Int32.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsInt32()
+ {
+ var test = new VectorAs__AsInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector64<Int32> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector64<Int32> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ Vector64<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector64<Int32> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ object byteResult = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<byte>)(byteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ object doubleResult = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<double>)(doubleResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ object shortResult = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<short>)(shortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ object intResult = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<int>)(intResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ object longResult = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<long>)(longResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ object sbyteResult = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<sbyte>)(sbyteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ object floatResult = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<float>)(floatResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ object ushortResult = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ushort>)(ushortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ object uintResult = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<uint>)(uintResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt32());
+ object ulongResult = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector64<T> result, Vector64<Int32> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+
+ Int32[] valueElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, Int32[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Int64.cs
new file mode 100644
index 0000000000..360383c0e6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Int64.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsInt64()
+ {
+ var test = new VectorAs__AsInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsInt64
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector64<Int64> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector64<Int64> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ Vector64<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector64<Int64> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ object byteResult = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<byte>)(byteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ object doubleResult = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<double>)(doubleResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ object shortResult = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<short>)(shortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ object intResult = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<int>)(intResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ object longResult = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<long>)(longResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ object sbyteResult = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<sbyte>)(sbyteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ object floatResult = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<float>)(floatResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ object ushortResult = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ushort>)(ushortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ object uintResult = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<uint>)(uintResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetInt64());
+ object ulongResult = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector64<T> result, Vector64<Int64> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+
+ Int64[] valueElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, Int64[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int64>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.SByte.cs
new file mode 100644
index 0000000000..07e52573b7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.SByte.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsSByte()
+ {
+ var test = new VectorAs__AsSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsSByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector64<SByte> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector64<SByte> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ Vector64<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector64<SByte> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ object byteResult = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<byte>)(byteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ object doubleResult = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<double>)(doubleResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ object shortResult = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<short>)(shortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ object intResult = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<int>)(intResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ object longResult = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<long>)(longResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ object sbyteResult = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<sbyte>)(sbyteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ object floatResult = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<float>)(floatResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ object ushortResult = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ushort>)(ushortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ object uintResult = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<uint>)(uintResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSByte());
+ object ulongResult = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector64<T> result, Vector64<SByte> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+
+ SByte[] valueElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, SByte[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Single.cs
new file mode 100644
index 0000000000..09e2032183
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.Single.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsSingle()
+ {
+ var test = new VectorAs__AsSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsSingle
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector64<Single> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector64<Single> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ Vector64<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector64<Single> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ object byteResult = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<byte>)(byteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ object doubleResult = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<double>)(doubleResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ object shortResult = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<short>)(shortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ object intResult = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<int>)(intResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ object longResult = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<long>)(longResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ object sbyteResult = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<sbyte>)(sbyteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ object floatResult = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<float>)(floatResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ object ushortResult = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ushort>)(ushortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ object uintResult = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<uint>)(uintResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetSingle());
+ object ulongResult = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector64<T> result, Vector64<Single> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+
+ Single[] valueElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(Single[] resultElements, Single[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.UInt16.cs
new file mode 100644
index 0000000000..98eb0bd306
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.UInt16.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsUInt16()
+ {
+ var test = new VectorAs__AsUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsUInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector64<UInt16> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector64<UInt16> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ Vector64<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector64<UInt16> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ object byteResult = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<byte>)(byteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ object doubleResult = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<double>)(doubleResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ object shortResult = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<short>)(shortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ object intResult = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<int>)(intResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ object longResult = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<long>)(longResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ object sbyteResult = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<sbyte>)(sbyteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ object floatResult = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<float>)(floatResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ object ushortResult = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ushort>)(ushortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ object uintResult = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<uint>)(uintResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt16());
+ object ulongResult = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector64<T> result, Vector64<UInt16> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+
+ UInt16[] valueElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, UInt16[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.UInt32.cs
new file mode 100644
index 0000000000..cc18b72d5f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.UInt32.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsUInt32()
+ {
+ var test = new VectorAs__AsUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsUInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector64<UInt32> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector64<UInt32> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ Vector64<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector64<UInt32> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ object byteResult = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<byte>)(byteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ object doubleResult = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<double>)(doubleResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ object shortResult = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<short>)(shortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ object intResult = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<int>)(intResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ object longResult = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<long>)(longResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ object sbyteResult = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<sbyte>)(sbyteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ object floatResult = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<float>)(floatResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ object ushortResult = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ushort>)(ushortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ object uintResult = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<uint>)(uintResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt32());
+ object ulongResult = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector64<T> result, Vector64<UInt32> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+
+ UInt32[] valueElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, UInt32[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.UInt64.cs
new file mode 100644
index 0000000000..0be567528d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/As.UInt64.cs
@@ -0,0 +1,239 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void AsUInt64()
+ {
+ var test = new VectorAs__AsUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates basic functionality works using the generic form, rather than the type-specific form of the method
+ test.RunGenericScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorAs__AsUInt64
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+ Vector64<UInt64> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<byte> byteResult = value.AsByte();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<double> doubleResult = value.AsDouble();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<short> shortResult = value.AsInt16();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<int> intResult = value.AsInt32();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<long> longResult = value.AsInt64();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<sbyte> sbyteResult = value.AsSByte();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<float> floatResult = value.AsSingle();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<ushort> ushortResult = value.AsUInt16();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<uint> uintResult = value.AsUInt32();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<ulong> ulongResult = value.AsUInt64();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunGenericScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario));
+ Vector64<UInt64> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<byte> byteResult = value.As<byte>();
+ ValidateResult(byteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<double> doubleResult = value.As<double>();
+ ValidateResult(doubleResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<short> shortResult = value.As<short>();
+ ValidateResult(shortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<int> intResult = value.As<int>();
+ ValidateResult(intResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<long> longResult = value.As<long>();
+ ValidateResult(longResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<sbyte> sbyteResult = value.As<sbyte>();
+ ValidateResult(sbyteResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<float> floatResult = value.As<float>();
+ ValidateResult(floatResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<ushort> ushortResult = value.As<ushort>();
+ ValidateResult(ushortResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<uint> uintResult = value.As<uint>();
+ ValidateResult(uintResult, value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ Vector64<ulong> ulongResult = value.As<ulong>();
+ ValidateResult(ulongResult, value);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+ Vector64<UInt64> value;
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ object byteResult = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.AsByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<byte>)(byteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ object doubleResult = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.AsDouble), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<double>)(doubleResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ object shortResult = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.AsInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<short>)(shortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ object intResult = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.AsInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<int>)(intResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ object longResult = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.AsInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<long>)(longResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ object sbyteResult = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.AsSByte), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<sbyte>)(sbyteResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ object floatResult = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.AsSingle), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<float>)(floatResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ object ushortResult = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.AsUInt16), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ushort>)(ushortResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ object uintResult = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.AsUInt32), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<uint>)(uintResult), value);
+
+ value = Vector64.Create(TestLibrary.Generator.GetUInt64());
+ object ulongResult = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.AsUInt64), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector64<ulong>)(ulongResult), value);
+ }
+
+ private void ValidateResult<T>(Vector64<T> result, Vector64<UInt64> value, [CallerMemberName] string method = "")
+ where T : struct
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+
+ UInt64[] valueElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref valueElements[0]), value);
+
+ ValidateResult(resultElements, valueElements, typeof(T), method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, UInt64[] valueElements, Type targetType, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != valueElements[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt64>.As{targetType.Name}: {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Byte.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Byte.0.cs
new file mode 100644
index 0000000000..2295b088e3
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Byte.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementByte0()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementByte0();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementByte0
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector64<Byte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Byte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ Vector64<Byte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector64<Byte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Byte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ object result2 = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.WithElement), new Type[] { typeof(int), typeof(Byte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<Byte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Byte result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<Byte> result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Byte[] result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Byte.7.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Byte.7.cs
new file mode 100644
index 0000000000..7a087a5915
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Byte.7.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementByte7()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementByte7();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementByte7
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector64<Byte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Byte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ Vector64<Byte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector64<Byte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Byte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Byte insertedValue = TestLibrary.Generator.GetByte();
+
+ try
+ {
+ object result2 = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.WithElement), new Type[] { typeof(int), typeof(Byte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<Byte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(7 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(7 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Byte result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[7])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte.GetElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<Byte> result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Byte[] result, Byte[] values, Byte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 7) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[7] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte.WithElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Double.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Double.0.cs
new file mode 100644
index 0000000000..55a0f8021f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Double.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementDouble0()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementDouble0();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementDouble0
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector64<Double> value = Vector64.Create(values[0]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Double result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Double.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Double insertedValue = TestLibrary.Generator.GetDouble();
+
+ try
+ {
+ Vector64<Double> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Double.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector64<Double> value = Vector64.Create(values[0]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Double)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Double.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Double insertedValue = TestLibrary.Generator.GetDouble();
+
+ try
+ {
+ object result2 = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.WithElement), new Type[] { typeof(int), typeof(Double) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<Double>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Double.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Double result, Double[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Double.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<Double> result, Double[] values, Double insertedValue, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Double[] result, Double[] values, Double insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Double.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int16.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int16.0.cs
new file mode 100644
index 0000000000..56f9f260ea
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int16.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt160()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt160();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt160
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector64<Int16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ Vector64<Int16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector64<Int16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ object result2 = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.WithElement), new Type[] { typeof(int), typeof(Int16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<Int16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int16 result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<Int16> result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int16[] result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int16.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int16.3.cs
new file mode 100644
index 0000000000..6bac04dfce
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int16.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt163()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt163();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt163
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector64<Int16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ Vector64<Int16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector64<Int16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int16 insertedValue = TestLibrary.Generator.GetInt16();
+
+ try
+ {
+ object result2 = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.WithElement), new Type[] { typeof(int), typeof(Int16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<Int16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int16 result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<Int16> result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int16[] result, Int16[] values, Int16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int32.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int32.0.cs
new file mode 100644
index 0000000000..79cf3b5739
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int32.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt320()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt320();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt320
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector64<Int32> value = Vector64.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ Vector64<Int32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector64<Int32> value = Vector64.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ object result2 = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.WithElement), new Type[] { typeof(int), typeof(Int32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<Int32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int32 result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<Int32> result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int32[] result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int32.1.cs
new file mode 100644
index 0000000000..2c27d71c1f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int32.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt321()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt321();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt321
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector64<Int32> value = Vector64.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ Vector64<Int32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector64<Int32> value = Vector64.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int32 insertedValue = TestLibrary.Generator.GetInt32();
+
+ try
+ {
+ object result2 = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.WithElement), new Type[] { typeof(int), typeof(Int32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<Int32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int32 result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<Int32> result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int32[] result, Int32[] values, Int32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int64.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int64.0.cs
new file mode 100644
index 0000000000..9da832ff2c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Int64.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementInt640()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementInt640();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementInt640
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector64<Int64> value = Vector64.Create(values[0]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Int64 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int64.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int64 insertedValue = TestLibrary.Generator.GetInt64();
+
+ try
+ {
+ Vector64<Int64> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int64.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector64<Int64> value = Vector64.Create(values[0]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Int64)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int64.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Int64 insertedValue = TestLibrary.Generator.GetInt64();
+
+ try
+ {
+ object result2 = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.WithElement), new Type[] { typeof(int), typeof(Int64) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<Int64>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int64.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Int64 result, Int64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int64.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<Int64> result, Int64[] values, Int64 insertedValue, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Int64[] result, Int64[] values, Int64 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int64.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.SByte.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.SByte.0.cs
new file mode 100644
index 0000000000..f65d122e9d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.SByte.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSByte0()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSByte0();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSByte0
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector64<SByte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ SByte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ Vector64<SByte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector64<SByte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((SByte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ object result2 = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.WithElement), new Type[] { typeof(int), typeof(SByte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<SByte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(SByte result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<SByte> result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(SByte[] result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.SByte.7.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.SByte.7.cs
new file mode 100644
index 0000000000..74d787610b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.SByte.7.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSByte7()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSByte7();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSByte7
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector64<SByte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ SByte result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ Vector64<SByte> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 7, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector64<SByte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((SByte)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ SByte insertedValue = TestLibrary.Generator.GetSByte();
+
+ try
+ {
+ object result2 = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.WithElement), new Type[] { typeof(int), typeof(SByte) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<SByte>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(7 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(7 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(7 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(SByte result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[7])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte.GetElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<SByte> result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(SByte[] result, SByte[] values, SByte insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 7) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[7] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte.WithElement(7): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Single.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Single.0.cs
new file mode 100644
index 0000000000..4c300a1b9a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Single.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSingle0()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSingle0();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSingle0
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector64<Single> value = Vector64.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Single result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ Vector64<Single> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector64<Single> value = Vector64.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Single)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ object result2 = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.WithElement), new Type[] { typeof(int), typeof(Single) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<Single>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Single result, Single[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<Single> result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Single[] result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Single.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Single.1.cs
new file mode 100644
index 0000000000..0bdf865b56
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.Single.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementSingle1()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementSingle1();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementSingle1
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector64<Single> value = Vector64.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ Single result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ Vector64<Single> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector64<Single> value = Vector64.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((Single)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ Single insertedValue = TestLibrary.Generator.GetSingle();
+
+ try
+ {
+ object result2 = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.WithElement), new Type[] { typeof(int), typeof(Single) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<Single>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(Single result, Single[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<Single> result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(Single[] result, Single[] values, Single insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt16.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt16.0.cs
new file mode 100644
index 0000000000..12eaf9b7ee
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt16.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt160()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt160();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt160
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector64<UInt16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ Vector64<UInt16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector64<UInt16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ object result2 = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.WithElement), new Type[] { typeof(int), typeof(UInt16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<UInt16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt16 result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<UInt16> result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt16[] result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt16.3.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt16.3.cs
new file mode 100644
index 0000000000..c6365aaa9b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt16.3.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt163()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt163();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt163
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector64<UInt16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt16 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ Vector64<UInt16> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 3, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector64<UInt16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt16)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt16 insertedValue = TestLibrary.Generator.GetUInt16();
+
+ try
+ {
+ object result2 = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.WithElement), new Type[] { typeof(int), typeof(UInt16) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<UInt16>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(3 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(3 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(3 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt16 result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[3])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16.GetElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<UInt16> result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt16[] result, UInt16[] values, UInt16 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 3) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[3] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16.WithElement(3): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt32.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt32.0.cs
new file mode 100644
index 0000000000..1c608d795e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt32.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt320()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt320();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt320
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector64<UInt32> value = Vector64.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ Vector64<UInt32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector64<UInt32> value = Vector64.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ object result2 = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.WithElement), new Type[] { typeof(int), typeof(UInt32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<UInt32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt32 result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<UInt32> result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt32[] result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt32.1.cs
new file mode 100644
index 0000000000..001fb506fb
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt32.1.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt321()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt321();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt321
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector64<UInt32> value = Vector64.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt32 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ Vector64<UInt32> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 1, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector64<UInt32> value = Vector64.Create(values[0], values[1]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt32)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt32 insertedValue = TestLibrary.Generator.GetUInt32();
+
+ try
+ {
+ object result2 = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.WithElement), new Type[] { typeof(int), typeof(UInt32) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<UInt32>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(1 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(1 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(1 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt32 result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[1])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.GetElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<UInt32> result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt32[] result, UInt32[] values, UInt32 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 1) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[1] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32.WithElement(1): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt64.0.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt64.0.cs
new file mode 100644
index 0000000000..7630dbeb92
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/GetAndWithElement.UInt64.0.cs
@@ -0,0 +1,223 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void GetAndWithElementUInt640()
+ {
+ var test = new VectorGetAndWithElement__GetAndWithElementUInt640();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ // Validates that invalid indices throws ArgumentOutOfRangeException
+ test.RunArgumentOutOfRangeScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorGetAndWithElement__GetAndWithElementUInt640
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector64<UInt64> value = Vector64.Create(values[0]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ UInt64 result = value.GetElement(imm);
+ ValidateGetResult(result, values);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt64.GetElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt64 insertedValue = TestLibrary.Generator.GetUInt64();
+
+ try
+ {
+ Vector64<UInt64> result2 = value.WithElement(imm, insertedValue);
+ ValidateWithResult(result2, values, insertedValue);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ succeeded = expectedOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt64.WithElement({imm}): {nameof(RunBasicScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunReflectionScenario(int imm = 0, bool expectedOutOfRangeException = false)
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector64<UInt64> value = Vector64.Create(values[0]);
+
+ bool succeeded = !expectedOutOfRangeException;
+
+ try
+ {
+ object result = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.GetElement), new Type[] { typeof(int) })
+ .Invoke(value, new object[] { imm });
+ ValidateGetResult((UInt64)(result), values);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt64.GetElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+
+ succeeded = !expectedOutOfRangeException;
+
+ UInt64 insertedValue = TestLibrary.Generator.GetUInt64();
+
+ try
+ {
+ object result2 = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.WithElement), new Type[] { typeof(int), typeof(UInt64) })
+ .Invoke(value, new object[] { imm, insertedValue });
+ ValidateWithResult((Vector64<UInt64>)(result2), values, insertedValue);
+ }
+ catch (TargetInvocationException e)
+ {
+ succeeded = expectedOutOfRangeException
+ && e.InnerException is ArgumentOutOfRangeException;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt64.WithElement({imm}): {nameof(RunReflectionScenario)} failed to throw ArgumentOutOfRangeException.");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ public void RunArgumentOutOfRangeScenario()
+ {
+ RunBasicScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunBasicScenario(0 + ElementCount, expectedOutOfRangeException: true);
+
+ RunReflectionScenario(0 - ElementCount, expectedOutOfRangeException: true);
+ RunReflectionScenario(0 + ElementCount, expectedOutOfRangeException: true);
+ }
+
+ private void ValidateGetResult(UInt64 result, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt64.GetElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({result})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+
+ private void ValidateWithResult(Vector64<UInt64> result, UInt64[] values, UInt64 insertedValue, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateWithResult(resultElements, values, insertedValue, method);
+ }
+
+ private void ValidateWithResult(UInt64[] result, UInt64[] values, UInt64 insertedValue, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if ((i != 0) && (result[i] != values[i]))
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (result[0] != insertedValue)
+ {
+ Succeeded = false;
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt64.WithElement(0): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" insert: insertedValue");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Program.Vector64_1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Program.Vector64_1.cs
new file mode 100644
index 0000000000..fc58fc8308
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Program.Vector64_1.cs
@@ -0,0 +1,75 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["Zero.Byte"] = ZeroByte,
+ ["Zero.Double"] = ZeroDouble,
+ ["Zero.Int16"] = ZeroInt16,
+ ["Zero.Int32"] = ZeroInt32,
+ ["Zero.Int64"] = ZeroInt64,
+ ["Zero.SByte"] = ZeroSByte,
+ ["Zero.Single"] = ZeroSingle,
+ ["Zero.UInt16"] = ZeroUInt16,
+ ["Zero.UInt32"] = ZeroUInt32,
+ ["Zero.UInt64"] = ZeroUInt64,
+ ["As.Byte"] = AsByte,
+ ["As.Double"] = AsDouble,
+ ["As.Int16"] = AsInt16,
+ ["As.Int32"] = AsInt32,
+ ["As.Int64"] = AsInt64,
+ ["As.SByte"] = AsSByte,
+ ["As.Single"] = AsSingle,
+ ["As.UInt16"] = AsUInt16,
+ ["As.UInt32"] = AsUInt32,
+ ["As.UInt64"] = AsUInt64,
+ ["GetAndWithElement.Byte.0"] = GetAndWithElementByte0,
+ ["GetAndWithElement.Byte.7"] = GetAndWithElementByte7,
+ ["GetAndWithElement.Double.0"] = GetAndWithElementDouble0,
+ ["GetAndWithElement.Int16.0"] = GetAndWithElementInt160,
+ ["GetAndWithElement.Int16.3"] = GetAndWithElementInt163,
+ ["GetAndWithElement.Int32.0"] = GetAndWithElementInt320,
+ ["GetAndWithElement.Int32.1"] = GetAndWithElementInt321,
+ ["GetAndWithElement.Int64.0"] = GetAndWithElementInt640,
+ ["GetAndWithElement.SByte.0"] = GetAndWithElementSByte0,
+ ["GetAndWithElement.SByte.7"] = GetAndWithElementSByte7,
+ ["GetAndWithElement.Single.0"] = GetAndWithElementSingle0,
+ ["GetAndWithElement.Single.1"] = GetAndWithElementSingle1,
+ ["GetAndWithElement.UInt16.0"] = GetAndWithElementUInt160,
+ ["GetAndWithElement.UInt16.3"] = GetAndWithElementUInt163,
+ ["GetAndWithElement.UInt32.0"] = GetAndWithElementUInt320,
+ ["GetAndWithElement.UInt32.1"] = GetAndWithElementUInt321,
+ ["GetAndWithElement.UInt64.0"] = GetAndWithElementUInt640,
+ ["ToScalar.Byte"] = ToScalarByte,
+ ["ToScalar.Double"] = ToScalarDouble,
+ ["ToScalar.Int16"] = ToScalarInt16,
+ ["ToScalar.Int32"] = ToScalarInt32,
+ ["ToScalar.Int64"] = ToScalarInt64,
+ ["ToScalar.SByte"] = ToScalarSByte,
+ ["ToScalar.Single"] = ToScalarSingle,
+ ["ToScalar.UInt16"] = ToScalarUInt16,
+ ["ToScalar.UInt32"] = ToScalarUInt32,
+ ["ToScalar.UInt64"] = ToScalarUInt64,
+ ["ToVector128.Byte"] = ToVector128Byte,
+ ["ToVector128.Double"] = ToVector128Double,
+ ["ToVector128.Int16"] = ToVector128Int16,
+ ["ToVector128.Int32"] = ToVector128Int32,
+ ["ToVector128.Int64"] = ToVector128Int64,
+ ["ToVector128.SByte"] = ToVector128SByte,
+ ["ToVector128.Single"] = ToVector128Single,
+ ["ToVector128.UInt16"] = ToVector128UInt16,
+ ["ToVector128.UInt32"] = ToVector128UInt32,
+ ["ToVector128.UInt64"] = ToVector128UInt64,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Byte.cs
new file mode 100644
index 0000000000..8668f0fe59
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Byte.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarByte()
+ {
+ var test = new VectorToScalar__ToScalarByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector64<Byte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ Byte result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector64<Byte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object result = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Byte)(result), values);
+ }
+
+ private void ValidateResult(Byte result, Byte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Double.cs
new file mode 100644
index 0000000000..2a25add5b5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Double.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarDouble()
+ {
+ var test = new VectorToScalar__ToScalarDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarDouble
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector64<Double> value = Vector64.Create(values[0]);
+
+ Double result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector64<Double> value = Vector64.Create(values[0]);
+
+ object result = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Double)(result), values);
+ }
+
+ private void ValidateResult(Double result, Double[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Double>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Int16.cs
new file mode 100644
index 0000000000..a24ddf7da2
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Int16.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarInt16()
+ {
+ var test = new VectorToScalar__ToScalarInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector64<Int16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ Int16 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector64<Int16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ object result = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Int16)(result), values);
+ }
+
+ private void ValidateResult(Int16 result, Int16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Int32.cs
new file mode 100644
index 0000000000..7542ecc095
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Int32.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarInt32()
+ {
+ var test = new VectorToScalar__ToScalarInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector64<Int32> value = Vector64.Create(values[0], values[1]);
+
+ Int32 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector64<Int32> value = Vector64.Create(values[0], values[1]);
+
+ object result = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Int32)(result), values);
+ }
+
+ private void ValidateResult(Int32 result, Int32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Int64.cs
new file mode 100644
index 0000000000..e3913146ee
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Int64.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarInt64()
+ {
+ var test = new VectorToScalar__ToScalarInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarInt64
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector64<Int64> value = Vector64.Create(values[0]);
+
+ Int64 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector64<Int64> value = Vector64.Create(values[0]);
+
+ object result = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Int64)(result), values);
+ }
+
+ private void ValidateResult(Int64 result, Int64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int64>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.SByte.cs
new file mode 100644
index 0000000000..abcf2fbb1f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.SByte.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarSByte()
+ {
+ var test = new VectorToScalar__ToScalarSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarSByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector64<SByte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ SByte result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector64<SByte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object result = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((SByte)(result), values);
+ }
+
+ private void ValidateResult(SByte result, SByte[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Single.cs
new file mode 100644
index 0000000000..56edd62d09
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.Single.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarSingle()
+ {
+ var test = new VectorToScalar__ToScalarSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarSingle
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector64<Single> value = Vector64.Create(values[0], values[1]);
+
+ Single result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector64<Single> value = Vector64.Create(values[0], values[1]);
+
+ object result = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((Single)(result), values);
+ }
+
+ private void ValidateResult(Single result, Single[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.UInt16.cs
new file mode 100644
index 0000000000..3068b5f82c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.UInt16.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarUInt16()
+ {
+ var test = new VectorToScalar__ToScalarUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarUInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector64<UInt16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ UInt16 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector64<UInt16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ object result = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((UInt16)(result), values);
+ }
+
+ private void ValidateResult(UInt16 result, UInt16[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.UInt32.cs
new file mode 100644
index 0000000000..7f61f92e3f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.UInt32.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarUInt32()
+ {
+ var test = new VectorToScalar__ToScalarUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarUInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector64<UInt32> value = Vector64.Create(values[0], values[1]);
+
+ UInt32 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector64<UInt32> value = Vector64.Create(values[0], values[1]);
+
+ object result = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((UInt32)(result), values);
+ }
+
+ private void ValidateResult(UInt32 result, UInt32[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.UInt64.cs
new file mode 100644
index 0000000000..cf63e076ff
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToScalar.UInt64.cs
@@ -0,0 +1,96 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToScalarUInt64()
+ {
+ var test = new VectorToScalar__ToScalarUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorToScalar__ToScalarUInt64
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector64<UInt64> value = Vector64.Create(values[0]);
+
+ UInt64 result = value.ToScalar();
+ ValidateResult(result, values);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector64<UInt64> value = Vector64.Create(values[0]);
+
+ object result = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.ToScalar), new Type[] { })
+ .Invoke(value, new object[] { });
+
+ ValidateResult((UInt64)(result), values);
+ }
+
+ private void ValidateResult(UInt64 result, UInt64[] values, [CallerMemberName] string method = "")
+ {
+ if (result != values[0])
+ {
+ Succeeded = false;
+
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt64>.ToScalar(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" values: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: {result}");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Byte.cs
new file mode 100644
index 0000000000..d9194a19c8
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Byte.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector128Byte()
+ {
+ var test = new VectorExtend__ToVector128Byte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector128Byte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector64<Byte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ Vector128<Byte> result = value.ToVector128();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector128<Byte> unsafeResult = value.ToVector128Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Byte[] values = new Byte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetByte();
+ }
+
+ Vector64<Byte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object result = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<Byte>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector64<Byte>)
+ .GetMethod(nameof(Vector64<Byte>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<Byte>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector128<Byte> result, Byte[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(Byte[] result, Byte[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Byte>.ToVector128{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Double.cs
new file mode 100644
index 0000000000..e8b3dca6cb
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Double.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector128Double()
+ {
+ var test = new VectorExtend__ToVector128Double();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector128Double
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector64<Double> value = Vector64.Create(values[0]);
+
+ Vector128<Double> result = value.ToVector128();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector128<Double> unsafeResult = value.ToVector128Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Double[] values = new Double[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetDouble();
+ }
+
+ Vector64<Double> value = Vector64.Create(values[0]);
+
+ object result = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<Double>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector64<Double>)
+ .GetMethod(nameof(Vector64<Double>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<Double>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector128<Double> result, Double[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(Double[] result, Double[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Double>.ToVector128{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Int16.cs
new file mode 100644
index 0000000000..20aa99854f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Int16.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector128Int16()
+ {
+ var test = new VectorExtend__ToVector128Int16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector128Int16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector64<Int16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ Vector128<Int16> result = value.ToVector128();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector128<Int16> unsafeResult = value.ToVector128Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int16[] values = new Int16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt16();
+ }
+
+ Vector64<Int16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ object result = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<Int16>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector64<Int16>)
+ .GetMethod(nameof(Vector64<Int16>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<Int16>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector128<Int16> result, Int16[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(Int16[] result, Int16[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int16>.ToVector128{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Int32.cs
new file mode 100644
index 0000000000..0e1da7a720
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Int32.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector128Int32()
+ {
+ var test = new VectorExtend__ToVector128Int32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector128Int32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector64<Int32> value = Vector64.Create(values[0], values[1]);
+
+ Vector128<Int32> result = value.ToVector128();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector128<Int32> unsafeResult = value.ToVector128Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int32[] values = new Int32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt32();
+ }
+
+ Vector64<Int32> value = Vector64.Create(values[0], values[1]);
+
+ object result = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<Int32>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector64<Int32>)
+ .GetMethod(nameof(Vector64<Int32>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<Int32>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector128<Int32> result, Int32[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(Int32[] result, Int32[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int32>.ToVector128{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Int64.cs
new file mode 100644
index 0000000000..5a4517d302
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Int64.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector128Int64()
+ {
+ var test = new VectorExtend__ToVector128Int64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector128Int64
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector64<Int64> value = Vector64.Create(values[0]);
+
+ Vector128<Int64> result = value.ToVector128();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector128<Int64> unsafeResult = value.ToVector128Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Int64[] values = new Int64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetInt64();
+ }
+
+ Vector64<Int64> value = Vector64.Create(values[0]);
+
+ object result = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<Int64>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector64<Int64>)
+ .GetMethod(nameof(Vector64<Int64>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<Int64>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector128<Int64> result, Int64[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(Int64[] result, Int64[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Int64>.ToVector128{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.SByte.cs
new file mode 100644
index 0000000000..8818a2cf07
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.SByte.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector128SByte()
+ {
+ var test = new VectorExtend__ToVector128SByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector128SByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector64<SByte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ Vector128<SByte> result = value.ToVector128();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector128<SByte> unsafeResult = value.ToVector128Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ SByte[] values = new SByte[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSByte();
+ }
+
+ Vector64<SByte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
+
+ object result = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<SByte>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector64<SByte>)
+ .GetMethod(nameof(Vector64<SByte>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<SByte>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector128<SByte> result, SByte[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(SByte[] result, SByte[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<SByte>.ToVector128{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Single.cs
new file mode 100644
index 0000000000..e4098c5492
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Single.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector128Single()
+ {
+ var test = new VectorExtend__ToVector128Single();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector128Single
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector64<Single> value = Vector64.Create(values[0], values[1]);
+
+ Vector128<Single> result = value.ToVector128();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector128<Single> unsafeResult = value.ToVector128Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ Single[] values = new Single[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetSingle();
+ }
+
+ Vector64<Single> value = Vector64.Create(values[0], values[1]);
+
+ object result = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<Single>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector64<Single>)
+ .GetMethod(nameof(Vector64<Single>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<Single>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector128<Single> result, Single[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(Single[] result, Single[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<Single>.ToVector128{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.UInt16.cs
new file mode 100644
index 0000000000..9e499cfa2e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.UInt16.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector128UInt16()
+ {
+ var test = new VectorExtend__ToVector128UInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector128UInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector64<UInt16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ Vector128<UInt16> result = value.ToVector128();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector128<UInt16> unsafeResult = value.ToVector128Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt16[] values = new UInt16[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt16();
+ }
+
+ Vector64<UInt16> value = Vector64.Create(values[0], values[1], values[2], values[3]);
+
+ object result = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<UInt16>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector64<UInt16>)
+ .GetMethod(nameof(Vector64<UInt16>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<UInt16>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector128<UInt16> result, UInt16[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(UInt16[] result, UInt16[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt16>.ToVector128{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.UInt32.cs
new file mode 100644
index 0000000000..5c6cd586fd
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.UInt32.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector128UInt32()
+ {
+ var test = new VectorExtend__ToVector128UInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector128UInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector64<UInt32> value = Vector64.Create(values[0], values[1]);
+
+ Vector128<UInt32> result = value.ToVector128();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector128<UInt32> unsafeResult = value.ToVector128Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt32[] values = new UInt32[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt32();
+ }
+
+ Vector64<UInt32> value = Vector64.Create(values[0], values[1]);
+
+ object result = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<UInt32>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector64<UInt32>)
+ .GetMethod(nameof(Vector64<UInt32>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<UInt32>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector128<UInt32> result, UInt32[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(UInt32[] result, UInt32[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt32>.ToVector128{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.UInt64.cs
new file mode 100644
index 0000000000..11856ae996
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.UInt64.cs
@@ -0,0 +1,130 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ToVector128UInt64()
+ {
+ var test = new VectorExtend__ToVector128UInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorExtend__ToVector128UInt64
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector64<UInt64> value = Vector64.Create(values[0]);
+
+ Vector128<UInt64> result = value.ToVector128();
+ ValidateResult(result, values, isUnsafe: false);
+
+ Vector128<UInt64> unsafeResult = value.ToVector128Unsafe();
+ ValidateResult(unsafeResult, values, isUnsafe: true);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ UInt64[] values = new UInt64[ElementCount];
+
+ for (int i = 0; i < ElementCount; i++)
+ {
+ values[i] = TestLibrary.Generator.GetUInt64();
+ }
+
+ Vector64<UInt64> value = Vector64.Create(values[0]);
+
+ object result = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<UInt64>)(result), values, isUnsafe: false);
+
+ object unsafeResult = typeof(Vector64<UInt64>)
+ .GetMethod(nameof(Vector64<UInt64>.ToVector128), new Type[] { })
+ .Invoke(value, new object[] { });
+ ValidateResult((Vector128<UInt64>)(unsafeResult), values, isUnsafe: true);
+ }
+
+ private void ValidateResult(Vector128<UInt64> result, UInt64[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount * 2];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+
+ ValidateResult(resultElements, values, isUnsafe, method);
+ }
+
+ private void ValidateResult(UInt64[] result, UInt64[] values, bool isUnsafe, [CallerMemberName] string method = "")
+ {
+ for (int i = 0; i < ElementCount; i++)
+ {
+ if (result[i] != values[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!isUnsafe)
+ {
+ for (int i = ElementCount; i < ElementCount * 2; i++)
+ {
+ if (result[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64<UInt64>.ToVector128{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_r.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_r.csproj
new file mode 100644
index 0000000000..ead2a80947
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_r.csproj
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Embedded</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="As.Byte.cs" />
+ <Compile Include="As.Double.cs" />
+ <Compile Include="As.Int16.cs" />
+ <Compile Include="As.Int32.cs" />
+ <Compile Include="As.Int64.cs" />
+ <Compile Include="As.SByte.cs" />
+ <Compile Include="As.Single.cs" />
+ <Compile Include="As.UInt16.cs" />
+ <Compile Include="As.UInt32.cs" />
+ <Compile Include="As.UInt64.cs" />
+ <Compile Include="GetAndWithElement.Byte.0.cs" />
+ <Compile Include="GetAndWithElement.Byte.7.cs" />
+ <Compile Include="GetAndWithElement.Double.0.cs" />
+ <Compile Include="GetAndWithElement.Int16.0.cs" />
+ <Compile Include="GetAndWithElement.Int16.3.cs" />
+ <Compile Include="GetAndWithElement.Int32.0.cs" />
+ <Compile Include="GetAndWithElement.Int32.1.cs" />
+ <Compile Include="GetAndWithElement.Int64.0.cs" />
+ <Compile Include="GetAndWithElement.SByte.0.cs" />
+ <Compile Include="GetAndWithElement.SByte.7.cs" />
+ <Compile Include="GetAndWithElement.Single.0.cs" />
+ <Compile Include="GetAndWithElement.Single.1.cs" />
+ <Compile Include="GetAndWithElement.UInt16.0.cs" />
+ <Compile Include="GetAndWithElement.UInt16.3.cs" />
+ <Compile Include="GetAndWithElement.UInt32.0.cs" />
+ <Compile Include="GetAndWithElement.UInt32.1.cs" />
+ <Compile Include="GetAndWithElement.UInt64.0.cs" />
+ <Compile Include="ToScalar.Byte.cs" />
+ <Compile Include="ToScalar.Double.cs" />
+ <Compile Include="ToScalar.Int16.cs" />
+ <Compile Include="ToScalar.Int32.cs" />
+ <Compile Include="ToScalar.Int64.cs" />
+ <Compile Include="ToScalar.SByte.cs" />
+ <Compile Include="ToScalar.Single.cs" />
+ <Compile Include="ToScalar.UInt16.cs" />
+ <Compile Include="ToScalar.UInt32.cs" />
+ <Compile Include="ToScalar.UInt64.cs" />
+ <Compile Include="ToVector128.Byte.cs" />
+ <Compile Include="ToVector128.Double.cs" />
+ <Compile Include="ToVector128.Int16.cs" />
+ <Compile Include="ToVector128.Int32.cs" />
+ <Compile Include="ToVector128.Int64.cs" />
+ <Compile Include="ToVector128.SByte.cs" />
+ <Compile Include="ToVector128.Single.cs" />
+ <Compile Include="ToVector128.UInt16.cs" />
+ <Compile Include="ToVector128.UInt32.cs" />
+ <Compile Include="ToVector128.UInt64.cs" />
+ <Compile Include="Zero.Byte.cs" />
+ <Compile Include="Zero.Double.cs" />
+ <Compile Include="Zero.Int16.cs" />
+ <Compile Include="Zero.Int32.cs" />
+ <Compile Include="Zero.Int64.cs" />
+ <Compile Include="Zero.SByte.cs" />
+ <Compile Include="Zero.Single.cs" />
+ <Compile Include="Zero.UInt16.cs" />
+ <Compile Include="Zero.UInt32.cs" />
+ <Compile Include="Zero.UInt64.cs" />
+ <Compile Include="Program.Vector64_1.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_ro.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_ro.csproj
new file mode 100644
index 0000000000..2c1555ac3c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_ro.csproj
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>Embedded</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="As.Byte.cs" />
+ <Compile Include="As.Double.cs" />
+ <Compile Include="As.Int16.cs" />
+ <Compile Include="As.Int32.cs" />
+ <Compile Include="As.Int64.cs" />
+ <Compile Include="As.SByte.cs" />
+ <Compile Include="As.Single.cs" />
+ <Compile Include="As.UInt16.cs" />
+ <Compile Include="As.UInt32.cs" />
+ <Compile Include="As.UInt64.cs" />
+ <Compile Include="GetAndWithElement.Byte.0.cs" />
+ <Compile Include="GetAndWithElement.Byte.7.cs" />
+ <Compile Include="GetAndWithElement.Double.0.cs" />
+ <Compile Include="GetAndWithElement.Int16.0.cs" />
+ <Compile Include="GetAndWithElement.Int16.3.cs" />
+ <Compile Include="GetAndWithElement.Int32.0.cs" />
+ <Compile Include="GetAndWithElement.Int32.1.cs" />
+ <Compile Include="GetAndWithElement.Int64.0.cs" />
+ <Compile Include="GetAndWithElement.SByte.0.cs" />
+ <Compile Include="GetAndWithElement.SByte.7.cs" />
+ <Compile Include="GetAndWithElement.Single.0.cs" />
+ <Compile Include="GetAndWithElement.Single.1.cs" />
+ <Compile Include="GetAndWithElement.UInt16.0.cs" />
+ <Compile Include="GetAndWithElement.UInt16.3.cs" />
+ <Compile Include="GetAndWithElement.UInt32.0.cs" />
+ <Compile Include="GetAndWithElement.UInt32.1.cs" />
+ <Compile Include="GetAndWithElement.UInt64.0.cs" />
+ <Compile Include="ToScalar.Byte.cs" />
+ <Compile Include="ToScalar.Double.cs" />
+ <Compile Include="ToScalar.Int16.cs" />
+ <Compile Include="ToScalar.Int32.cs" />
+ <Compile Include="ToScalar.Int64.cs" />
+ <Compile Include="ToScalar.SByte.cs" />
+ <Compile Include="ToScalar.Single.cs" />
+ <Compile Include="ToScalar.UInt16.cs" />
+ <Compile Include="ToScalar.UInt32.cs" />
+ <Compile Include="ToScalar.UInt64.cs" />
+ <Compile Include="ToVector128.Byte.cs" />
+ <Compile Include="ToVector128.Double.cs" />
+ <Compile Include="ToVector128.Int16.cs" />
+ <Compile Include="ToVector128.Int32.cs" />
+ <Compile Include="ToVector128.Int64.cs" />
+ <Compile Include="ToVector128.SByte.cs" />
+ <Compile Include="ToVector128.Single.cs" />
+ <Compile Include="ToVector128.UInt16.cs" />
+ <Compile Include="ToVector128.UInt32.cs" />
+ <Compile Include="ToVector128.UInt64.cs" />
+ <Compile Include="Zero.Byte.cs" />
+ <Compile Include="Zero.Double.cs" />
+ <Compile Include="Zero.Int16.cs" />
+ <Compile Include="Zero.Int32.cs" />
+ <Compile Include="Zero.Int64.cs" />
+ <Compile Include="Zero.SByte.cs" />
+ <Compile Include="Zero.Single.cs" />
+ <Compile Include="Zero.UInt16.cs" />
+ <Compile Include="Zero.UInt32.cs" />
+ <Compile Include="Zero.UInt64.cs" />
+ <Compile Include="Program.Vector64_1.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Byte.cs
new file mode 100644
index 0000000000..4cb741a695
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Byte.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroByte()
+ {
+ var test = new VectorZero__ZeroByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector64<Byte> result = Vector64<Byte>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector64<Byte>)
+ .GetProperty(nameof(Vector64<Byte>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector64<Byte>)(result));
+ }
+
+ private void ValidateResult(Vector64<Byte> result, [CallerMemberName] string method = "")
+ {
+ Byte[] resultElements = new Byte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Byte[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Zero(Byte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Double.cs
new file mode 100644
index 0000000000..7d69f5e4fb
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Double.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroDouble()
+ {
+ var test = new VectorZero__ZeroDouble();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroDouble
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Double>>() / sizeof(Double);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector64<Double> result = Vector64<Double>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector64<Double>)
+ .GetProperty(nameof(Vector64<Double>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector64<Double>)(result));
+ }
+
+ private void ValidateResult(Vector64<Double> result, [CallerMemberName] string method = "")
+ {
+ Double[] resultElements = new Double[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Double[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Zero(Double): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Int16.cs
new file mode 100644
index 0000000000..8fd96dba4c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Int16.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroInt16()
+ {
+ var test = new VectorZero__ZeroInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector64<Int16> result = Vector64<Int16>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector64<Int16>)
+ .GetProperty(nameof(Vector64<Int16>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector64<Int16>)(result));
+ }
+
+ private void ValidateResult(Vector64<Int16> result, [CallerMemberName] string method = "")
+ {
+ Int16[] resultElements = new Int16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Int16[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Zero(Int16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Int32.cs
new file mode 100644
index 0000000000..2039681a3e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Int32.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroInt32()
+ {
+ var test = new VectorZero__ZeroInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector64<Int32> result = Vector64<Int32>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector64<Int32>)
+ .GetProperty(nameof(Vector64<Int32>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector64<Int32>)(result));
+ }
+
+ private void ValidateResult(Vector64<Int32> result, [CallerMemberName] string method = "")
+ {
+ Int32[] resultElements = new Int32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Int32[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Zero(Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Int64.cs
new file mode 100644
index 0000000000..8e428079b9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Int64.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroInt64()
+ {
+ var test = new VectorZero__ZeroInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroInt64
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Int64>>() / sizeof(Int64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector64<Int64> result = Vector64<Int64>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector64<Int64>)
+ .GetProperty(nameof(Vector64<Int64>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector64<Int64>)(result));
+ }
+
+ private void ValidateResult(Vector64<Int64> result, [CallerMemberName] string method = "")
+ {
+ Int64[] resultElements = new Int64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Int64[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Zero(Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.SByte.cs
new file mode 100644
index 0000000000..e029d33f3b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.SByte.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroSByte()
+ {
+ var test = new VectorZero__ZeroSByte();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroSByte
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector64<SByte> result = Vector64<SByte>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector64<SByte>)
+ .GetProperty(nameof(Vector64<SByte>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector64<SByte>)(result));
+ }
+
+ private void ValidateResult(Vector64<SByte> result, [CallerMemberName] string method = "")
+ {
+ SByte[] resultElements = new SByte[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(SByte[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Zero(SByte): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Single.cs
new file mode 100644
index 0000000000..9e3d1c961d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.Single.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroSingle()
+ {
+ var test = new VectorZero__ZeroSingle();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroSingle
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector64<Single> result = Vector64<Single>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector64<Single>)
+ .GetProperty(nameof(Vector64<Single>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector64<Single>)(result));
+ }
+
+ private void ValidateResult(Vector64<Single> result, [CallerMemberName] string method = "")
+ {
+ Single[] resultElements = new Single[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(Single[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Zero(Single): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.UInt16.cs
new file mode 100644
index 0000000000..9bf1231d2f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.UInt16.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroUInt16()
+ {
+ var test = new VectorZero__ZeroUInt16();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroUInt16
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt16>>() / sizeof(UInt16);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector64<UInt16> result = Vector64<UInt16>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector64<UInt16>)
+ .GetProperty(nameof(Vector64<UInt16>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector64<UInt16>)(result));
+ }
+
+ private void ValidateResult(Vector64<UInt16> result, [CallerMemberName] string method = "")
+ {
+ UInt16[] resultElements = new UInt16[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(UInt16[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Zero(UInt16): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.UInt32.cs
new file mode 100644
index 0000000000..971d9e14cb
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.UInt32.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroUInt32()
+ {
+ var test = new VectorZero__ZeroUInt32();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroUInt32
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector64<UInt32> result = Vector64<UInt32>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector64<UInt32>)
+ .GetProperty(nameof(Vector64<UInt32>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector64<UInt32>)(result));
+ }
+
+ private void ValidateResult(Vector64<UInt32> result, [CallerMemberName] string method = "")
+ {
+ UInt32[] resultElements = new UInt32[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(UInt32[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Zero(UInt32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.UInt64.cs
new file mode 100644
index 0000000000..efb6b62fda
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Zero.UInt64.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx *
+ * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file. *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+
+namespace JIT.HardwareIntrinsics.General
+{
+ public static partial class Program
+ {
+ private static void ZeroUInt64()
+ {
+ var test = new VectorZero__ZeroUInt64();
+
+ // Validates basic functionality works
+ test.RunBasicScenario();
+
+ // Validates calling via reflection works
+ test.RunReflectionScenario();
+
+ if (!test.Succeeded)
+ {
+ throw new Exception("One or more scenarios did not complete as expected.");
+ }
+ }
+ }
+
+ public sealed unsafe class VectorZero__ZeroUInt64
+ {
+ private static readonly int LargestVectorSize = 8;
+
+ private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt64>>() / sizeof(UInt64);
+
+ public bool Succeeded { get; set; } = true;
+
+ public void RunBasicScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
+
+ Vector64<UInt64> result = Vector64<UInt64>.Zero;
+
+ ValidateResult(result);
+ }
+
+ public void RunReflectionScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
+
+ object result = typeof(Vector64<UInt64>)
+ .GetProperty(nameof(Vector64<UInt64>.Zero), new Type[] { })
+ .GetGetMethod()
+ .Invoke(null, new object[] { });
+
+ ValidateResult((Vector64<UInt64>)(result));
+ }
+
+ private void ValidateResult(Vector64<UInt64> result, [CallerMemberName] string method = "")
+ {
+ UInt64[] resultElements = new UInt64[ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
+ ValidateResult(resultElements, method);
+ }
+
+ private void ValidateResult(UInt64[] resultElements, [CallerMemberName] string method = "")
+ {
+ for (var i = 0; i < ElementCount; i++)
+ {
+ if (resultElements[i] != 0)
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"Vector64.Zero(UInt64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/General/dir.props b/tests/src/JIT/HardwareIntrinsics/General/dir.props
new file mode 100644
index 0000000000..696ab10ba4
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/General/dir.props
@@ -0,0 +1,7 @@
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Condition="Exists('..\dir.props')" Project="..\dir.props"/>
+
+ <ItemGroup>
+ <ProjectReference Include="$(SourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_r.csproj
index 8f7f7767e2..37b883b2fa 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_r.csproj
@@ -49,24 +49,6 @@
<Compile Include="DuplicateEvenIndexed.Double.cs" />
<Compile Include="DuplicateEvenIndexed.Single.cs" />
<Compile Include="DuplicateOddIndexed.Single.cs" />
- <Compile Include="Extract.Byte.1.cs" />
- <Compile Include="Extract.Byte.20.cs" />
- <Compile Include="Extract.UInt16.1.cs" />
- <Compile Include="Extract.UInt16.11.cs" />
- <Compile Include="Extract.Int32.1.cs" />
- <Compile Include="Extract.UInt32.1.cs" />
- <Compile Include="Extract.Int32.6.cs" />
- <Compile Include="Extract.UInt32.6.cs" />
- <Compile Include="Extract.Int64.1.cs" />
- <Compile Include="Extract.UInt64.1.cs" />
- <Compile Include="Extract.Int64.3.cs" />
- <Compile Include="Extract.UInt64.3.cs" />
- <Compile Include="Extract.Byte.52.cs" />
- <Compile Include="Extract.UInt16.27.cs" />
- <Compile Include="Extract.Int32.22.cs" />
- <Compile Include="Extract.UInt32.22.cs" />
- <Compile Include="Extract.Int64.19.cs" />
- <Compile Include="Extract.UInt64.19.cs" />
<Compile Include="ExtractVector128.Byte.1.cs" />
<Compile Include="ExtractVector128.SByte.1.cs" />
<Compile Include="ExtractVector128.Int16.1.cs" />
@@ -87,30 +69,6 @@
<Compile Include="ExtractVector128.UInt64.1.Store.cs" />
<Compile Include="ExtractVector128.Single.1.Store.cs" />
<Compile Include="ExtractVector128.Double.1.Store.cs" />
- <Compile Include="Insert.Byte.1.cs" />
- <Compile Include="Insert.SByte.1.cs" />
- <Compile Include="Insert.Byte.20.cs" />
- <Compile Include="Insert.SByte.20.cs" />
- <Compile Include="Insert.Int16.1.cs" />
- <Compile Include="Insert.UInt16.1.cs" />
- <Compile Include="Insert.Int16.11.cs" />
- <Compile Include="Insert.UInt16.11.cs" />
- <Compile Include="Insert.Int32.1.cs" />
- <Compile Include="Insert.UInt32.1.cs" />
- <Compile Include="Insert.Int32.6.cs" />
- <Compile Include="Insert.UInt32.6.cs" />
- <Compile Include="Insert.Int64.1.cs" />
- <Compile Include="Insert.UInt64.1.cs" />
- <Compile Include="Insert.Int64.3.cs" />
- <Compile Include="Insert.UInt64.3.cs" />
- <Compile Include="Insert.Byte.52.cs" />
- <Compile Include="Insert.SByte.52.cs" />
- <Compile Include="Insert.Int16.27.cs" />
- <Compile Include="Insert.UInt16.27.cs" />
- <Compile Include="Insert.Int32.22.cs" />
- <Compile Include="Insert.UInt32.22.cs" />
- <Compile Include="Insert.Int64.19.cs" />
- <Compile Include="Insert.UInt64.19.cs" />
<Compile Include="InsertVector128.Byte.1.cs" />
<Compile Include="InsertVector128.SByte.1.cs" />
<Compile Include="InsertVector128.Int16.1.cs" />
@@ -133,16 +91,6 @@
<Compile Include="InsertVector128.Double.1.Load.cs" />
<Compile Include="Floor.Double.cs" />
<Compile Include="Floor.Single.cs" />
- <Compile Include="GetLowerHalf.Byte.cs" />
- <Compile Include="GetLowerHalf.Double.cs" />
- <Compile Include="GetLowerHalf.Int16.cs" />
- <Compile Include="GetLowerHalf.Int32.cs" />
- <Compile Include="GetLowerHalf.Int64.cs" />
- <Compile Include="GetLowerHalf.SByte.cs" />
- <Compile Include="GetLowerHalf.Single.cs" />
- <Compile Include="GetLowerHalf.UInt16.cs" />
- <Compile Include="GetLowerHalf.UInt32.cs" />
- <Compile Include="GetLowerHalf.UInt64.cs" />
<Compile Include="LoadVector256.Byte.cs" />
<Compile Include="LoadVector256.SByte.cs" />
<Compile Include="LoadVector256.Int16.cs" />
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_ro.csproj
index 1fd83c5839..4e0f665924 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Avx_ro.csproj
@@ -49,24 +49,6 @@
<Compile Include="DuplicateEvenIndexed.Double.cs" />
<Compile Include="DuplicateEvenIndexed.Single.cs" />
<Compile Include="DuplicateOddIndexed.Single.cs" />
- <Compile Include="Extract.Byte.1.cs" />
- <Compile Include="Extract.Byte.20.cs" />
- <Compile Include="Extract.UInt16.1.cs" />
- <Compile Include="Extract.UInt16.11.cs" />
- <Compile Include="Extract.Int32.1.cs" />
- <Compile Include="Extract.UInt32.1.cs" />
- <Compile Include="Extract.Int32.6.cs" />
- <Compile Include="Extract.UInt32.6.cs" />
- <Compile Include="Extract.Int64.1.cs" />
- <Compile Include="Extract.UInt64.1.cs" />
- <Compile Include="Extract.Int64.3.cs" />
- <Compile Include="Extract.UInt64.3.cs" />
- <Compile Include="Extract.Byte.52.cs" />
- <Compile Include="Extract.UInt16.27.cs" />
- <Compile Include="Extract.Int32.22.cs" />
- <Compile Include="Extract.UInt32.22.cs" />
- <Compile Include="Extract.Int64.19.cs" />
- <Compile Include="Extract.UInt64.19.cs" />
<Compile Include="ExtractVector128.Byte.1.cs" />
<Compile Include="ExtractVector128.SByte.1.cs" />
<Compile Include="ExtractVector128.Int16.1.cs" />
@@ -87,30 +69,6 @@
<Compile Include="ExtractVector128.UInt64.1.Store.cs" />
<Compile Include="ExtractVector128.Single.1.Store.cs" />
<Compile Include="ExtractVector128.Double.1.Store.cs" />
- <Compile Include="Insert.Byte.1.cs" />
- <Compile Include="Insert.SByte.1.cs" />
- <Compile Include="Insert.Byte.20.cs" />
- <Compile Include="Insert.SByte.20.cs" />
- <Compile Include="Insert.Int16.1.cs" />
- <Compile Include="Insert.UInt16.1.cs" />
- <Compile Include="Insert.Int16.11.cs" />
- <Compile Include="Insert.UInt16.11.cs" />
- <Compile Include="Insert.Int32.1.cs" />
- <Compile Include="Insert.UInt32.1.cs" />
- <Compile Include="Insert.Int32.6.cs" />
- <Compile Include="Insert.UInt32.6.cs" />
- <Compile Include="Insert.Int64.1.cs" />
- <Compile Include="Insert.UInt64.1.cs" />
- <Compile Include="Insert.Int64.3.cs" />
- <Compile Include="Insert.UInt64.3.cs" />
- <Compile Include="Insert.Byte.52.cs" />
- <Compile Include="Insert.SByte.52.cs" />
- <Compile Include="Insert.Int16.27.cs" />
- <Compile Include="Insert.UInt16.27.cs" />
- <Compile Include="Insert.Int32.22.cs" />
- <Compile Include="Insert.UInt32.22.cs" />
- <Compile Include="Insert.Int64.19.cs" />
- <Compile Include="Insert.UInt64.19.cs" />
<Compile Include="InsertVector128.Byte.1.cs" />
<Compile Include="InsertVector128.SByte.1.cs" />
<Compile Include="InsertVector128.Int16.1.cs" />
@@ -133,16 +91,6 @@
<Compile Include="InsertVector128.Double.1.Load.cs" />
<Compile Include="Floor.Double.cs" />
<Compile Include="Floor.Single.cs" />
- <Compile Include="GetLowerHalf.Byte.cs" />
- <Compile Include="GetLowerHalf.Double.cs" />
- <Compile Include="GetLowerHalf.Int16.cs" />
- <Compile Include="GetLowerHalf.Int32.cs" />
- <Compile Include="GetLowerHalf.Int64.cs" />
- <Compile Include="GetLowerHalf.SByte.cs" />
- <Compile Include="GetLowerHalf.Single.cs" />
- <Compile Include="GetLowerHalf.UInt16.cs" />
- <Compile Include="GetLowerHalf.UInt32.cs" />
- <Compile Include="GetLowerHalf.UInt64.cs" />
<Compile Include="LoadVector256.Byte.cs" />
<Compile Include="LoadVector256.SByte.cs" />
<Compile Include="LoadVector256.Int16.cs" />
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToSingle.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToSingle.cs
deleted file mode 100644
index ef0f322663..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToSingle.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main()
- {
- int testResult = Pass;
-
- if (Avx.IsSupported)
- {
- fixed (float* ptr = new float[8] { 1, -5, 100, 0, 2, 30, -6, 42 })
- {
- var v = Unsafe.Read<Vector256<float>>(ptr);
- var f = Avx.ConvertToSingle(v);
-
- if (f != ptr[0])
- {
- Console.WriteLine("AVX ConvertToSingle failed on float:");
- Console.WriteLine(f);
- testResult = Fail;
- }
- }
- }
-
- return testResult;
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToSingle_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToSingle_r.csproj
deleted file mode 100644
index be8d700037..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToSingle_r.csproj
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <OutputType>Exe</OutputType>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <DebugType>Embedded</DebugType>
- <Optimize></Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="ConvertToSingle.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToSingle_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToSingle_ro.csproj
deleted file mode 100644
index 5dd9cd5de1..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/ConvertToSingle_ro.csproj
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <OutputType>Exe</OutputType>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <DebugType>Embedded</DebugType>
- <Optimize>True</Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="ConvertToSingle.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.1.cs
deleted file mode 100644
index 37f50eb022..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.1.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractByte1()
- {
- var test = new ExtractScalarTest__ExtractByte1();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractByte1
- {
- private struct TestStruct
- {
- public Vector256<Byte> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref testStruct._fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractByte1 testClass)
- {
- var result = Avx.Extract(_fld, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
-
- private static Byte[] _data = new Byte[Op1ElementCount];
-
- private static Vector256<Byte> _clsVar;
-
- private Vector256<Byte> _fld;
-
- private SimpleUnaryOpTest__DataTable<Byte, Byte> _dataTable;
-
- static ExtractScalarTest__ExtractByte1()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- }
-
- public ExtractScalarTest__ExtractByte1()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Byte) != typeof(long)) && (typeof(Byte) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Byte>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Byte)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Byte>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Byte)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Byte>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Byte)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractByte1();
- var result = Avx.Extract(test._fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Byte> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Byte[] firstOp, Byte[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[1]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<Byte>(Vector256<Byte><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.20.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.20.cs
deleted file mode 100644
index c9a957e391..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.20.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractByte20()
- {
- var test = new ExtractScalarTest__ExtractByte20();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractByte20
- {
- private struct TestStruct
- {
- public Vector256<Byte> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref testStruct._fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractByte20 testClass)
- {
- var result = Avx.Extract(_fld, 20);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
-
- private static Byte[] _data = new Byte[Op1ElementCount];
-
- private static Vector256<Byte> _clsVar;
-
- private Vector256<Byte> _fld;
-
- private SimpleUnaryOpTest__DataTable<Byte, Byte> _dataTable;
-
- static ExtractScalarTest__ExtractByte20()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- }
-
- public ExtractScalarTest__ExtractByte20()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Byte) != typeof(long)) && (typeof(Byte) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
- 20
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
- 20
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
- 20
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Byte>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
- (byte)20
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Byte)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Byte>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)20
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Byte)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Byte>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)20
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Byte)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 20
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractByte20();
- var result = Avx.Extract(test._fld, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Byte> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Byte[] firstOp, Byte[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[20]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<Byte>(Vector256<Byte><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.52.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.52.cs
deleted file mode 100644
index 14d09dc283..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Byte.52.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractByte52()
- {
- var test = new ExtractScalarTest__ExtractByte52();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractByte52
- {
- private struct TestStruct
- {
- public Vector256<Byte> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref testStruct._fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractByte52 testClass)
- {
- var result = Avx.Extract(_fld, 52);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
-
- private static Byte[] _data = new Byte[Op1ElementCount];
-
- private static Vector256<Byte> _clsVar;
-
- private Vector256<Byte> _fld;
-
- private SimpleUnaryOpTest__DataTable<Byte, Byte> _dataTable;
-
- static ExtractScalarTest__ExtractByte52()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- }
-
- public ExtractScalarTest__ExtractByte52()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Byte) != typeof(long)) && (typeof(Byte) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
- 52
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
- 52
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
- 52
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Byte>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
- (byte)52
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Byte)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Byte>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)52
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Byte)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Byte>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)52
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Byte)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 52
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractByte52();
- var result = Avx.Extract(test._fld, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Byte> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Byte[] firstOp, Byte[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[20]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<Byte>(Vector256<Byte><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.1.cs
deleted file mode 100644
index 5559b8cb54..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.1.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractInt321()
- {
- var test = new ExtractScalarTest__ExtractInt321();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractInt321
- {
- private struct TestStruct
- {
- public Vector256<Int32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref testStruct._fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractInt321 testClass)
- {
- var result = Avx.Extract(_fld, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
-
- private static Int32[] _data = new Int32[Op1ElementCount];
-
- private static Vector256<Int32> _clsVar;
-
- private Vector256<Int32> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int32, Int32> _dataTable;
-
- static ExtractScalarTest__ExtractInt321()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- }
-
- public ExtractScalarTest__ExtractInt321()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int32>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int32>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int32>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractInt321();
- var result = Avx.Extract(test._fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[1]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<Int32>(Vector256<Int32><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.22.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.22.cs
deleted file mode 100644
index 6d917ea304..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.22.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractInt3222()
- {
- var test = new ExtractScalarTest__ExtractInt3222();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractInt3222
- {
- private struct TestStruct
- {
- public Vector256<Int32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref testStruct._fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractInt3222 testClass)
- {
- var result = Avx.Extract(_fld, 22);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
-
- private static Int32[] _data = new Int32[Op1ElementCount];
-
- private static Vector256<Int32> _clsVar;
-
- private Vector256<Int32> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int32, Int32> _dataTable;
-
- static ExtractScalarTest__ExtractInt3222()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- }
-
- public ExtractScalarTest__ExtractInt3222()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int32>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
- (byte)22
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int32>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
- (byte)22
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int32>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
- (byte)22
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractInt3222();
- var result = Avx.Extract(test._fld, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[6]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<Int32>(Vector256<Int32><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.6.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.6.cs
deleted file mode 100644
index f51c3598bc..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int32.6.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractInt326()
- {
- var test = new ExtractScalarTest__ExtractInt326();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractInt326
- {
- private struct TestStruct
- {
- public Vector256<Int32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref testStruct._fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractInt326 testClass)
- {
- var result = Avx.Extract(_fld, 6);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
-
- private static Int32[] _data = new Int32[Op1ElementCount];
-
- private static Vector256<Int32> _clsVar;
-
- private Vector256<Int32> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int32, Int32> _dataTable;
-
- static ExtractScalarTest__ExtractInt326()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- }
-
- public ExtractScalarTest__ExtractInt326()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int32>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
- (byte)6
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int32>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
- (byte)6
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int32>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
- (byte)6
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractInt326();
- var result = Avx.Extract(test._fld, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[6]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<Int32>(Vector256<Int32><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.1.cs
deleted file mode 100644
index 1d0a09810a..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.1.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractInt641()
- {
- var test = new ExtractScalarTest__ExtractInt641();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractInt641
- {
- private struct TestStruct
- {
- public Vector256<Int64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref testStruct._fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractInt641 testClass)
- {
- var result = Avx.Extract(_fld, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
-
- private static Int64[] _data = new Int64[Op1ElementCount];
-
- private static Vector256<Int64> _clsVar;
-
- private Vector256<Int64> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int64, Int64> _dataTable;
-
- static ExtractScalarTest__ExtractInt641()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- }
-
- public ExtractScalarTest__ExtractInt641()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int64>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int64>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int64>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractInt641();
- var result = Avx.Extract(test._fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int64[] firstOp, Int64[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[1]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<Int64>(Vector256<Int64><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.19.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.19.cs
deleted file mode 100644
index 8152bc7ea8..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.19.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractInt6419()
- {
- var test = new ExtractScalarTest__ExtractInt6419();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractInt6419
- {
- private struct TestStruct
- {
- public Vector256<Int64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref testStruct._fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractInt6419 testClass)
- {
- var result = Avx.Extract(_fld, 19);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
-
- private static Int64[] _data = new Int64[Op1ElementCount];
-
- private static Vector256<Int64> _clsVar;
-
- private Vector256<Int64> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int64, Int64> _dataTable;
-
- static ExtractScalarTest__ExtractInt6419()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- }
-
- public ExtractScalarTest__ExtractInt6419()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int64>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
- (byte)19
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int64>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
- (byte)19
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int64>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
- (byte)19
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractInt6419();
- var result = Avx.Extract(test._fld, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int64[] firstOp, Int64[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[3]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<Int64>(Vector256<Int64><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.3.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.3.cs
deleted file mode 100644
index d3492f9afd..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.Int64.3.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractInt643()
- {
- var test = new ExtractScalarTest__ExtractInt643();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractInt643
- {
- private struct TestStruct
- {
- public Vector256<Int64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref testStruct._fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractInt643 testClass)
- {
- var result = Avx.Extract(_fld, 3);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
-
- private static Int64[] _data = new Int64[Op1ElementCount];
-
- private static Vector256<Int64> _clsVar;
-
- private Vector256<Int64> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int64, Int64> _dataTable;
-
- static ExtractScalarTest__ExtractInt643()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- }
-
- public ExtractScalarTest__ExtractInt643()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int64>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
- (byte)3
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int64>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
- (byte)3
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<Int64>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
- (byte)3
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Int64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractInt643();
- var result = Avx.Extract(test._fld, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int64[] firstOp, Int64[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[3]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<Int64>(Vector256<Int64><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.1.cs
deleted file mode 100644
index 8d5332ec15..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.1.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractUInt161()
- {
- var test = new ExtractScalarTest__ExtractUInt161();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractUInt161
- {
- private struct TestStruct
- {
- public Vector256<UInt16> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref testStruct._fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractUInt161 testClass)
- {
- var result = Avx.Extract(_fld, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
-
- private static UInt16[] _data = new UInt16[Op1ElementCount];
-
- private static Vector256<UInt16> _clsVar;
-
- private Vector256<UInt16> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt16, UInt16> _dataTable;
-
- static ExtractScalarTest__ExtractUInt161()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- }
-
- public ExtractScalarTest__ExtractUInt161()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt16) != typeof(long)) && (typeof(UInt16) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt16>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt16)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt16>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt16)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt16>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt16)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractUInt161();
- var result = Avx.Extract(test._fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt16> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt16[] firstOp, UInt16[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[1]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<UInt16>(Vector256<UInt16><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.11.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.11.cs
deleted file mode 100644
index 272480f0ed..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.11.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractUInt1611()
- {
- var test = new ExtractScalarTest__ExtractUInt1611();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractUInt1611
- {
- private struct TestStruct
- {
- public Vector256<UInt16> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref testStruct._fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractUInt1611 testClass)
- {
- var result = Avx.Extract(_fld, 11);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
-
- private static UInt16[] _data = new UInt16[Op1ElementCount];
-
- private static Vector256<UInt16> _clsVar;
-
- private Vector256<UInt16> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt16, UInt16> _dataTable;
-
- static ExtractScalarTest__ExtractUInt1611()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- }
-
- public ExtractScalarTest__ExtractUInt1611()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt16) != typeof(long)) && (typeof(UInt16) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
- 11
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
- 11
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
- 11
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt16>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
- (byte)11
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt16)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt16>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
- (byte)11
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt16)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt16>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
- (byte)11
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt16)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 11
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractUInt1611();
- var result = Avx.Extract(test._fld, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt16> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt16[] firstOp, UInt16[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[11]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<UInt16>(Vector256<UInt16><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.27.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.27.cs
deleted file mode 100644
index 028739e066..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt16.27.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractUInt1627()
- {
- var test = new ExtractScalarTest__ExtractUInt1627();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractUInt1627
- {
- private struct TestStruct
- {
- public Vector256<UInt16> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref testStruct._fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractUInt1627 testClass)
- {
- var result = Avx.Extract(_fld, 27);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
-
- private static UInt16[] _data = new UInt16[Op1ElementCount];
-
- private static Vector256<UInt16> _clsVar;
-
- private Vector256<UInt16> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt16, UInt16> _dataTable;
-
- static ExtractScalarTest__ExtractUInt1627()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- }
-
- public ExtractScalarTest__ExtractUInt1627()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt16) != typeof(long)) && (typeof(UInt16) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
- 27
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
- 27
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
- 27
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt16>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
- (byte)27
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt16)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt16>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
- (byte)27
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt16)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt16>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
- (byte)27
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt16)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 27
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractUInt1627();
- var result = Avx.Extract(test._fld, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt16> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt16[] firstOp, UInt16[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[11]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<UInt16>(Vector256<UInt16><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.1.cs
deleted file mode 100644
index 0d32239595..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.1.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractUInt321()
- {
- var test = new ExtractScalarTest__ExtractUInt321();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractUInt321
- {
- private struct TestStruct
- {
- public Vector256<UInt32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref testStruct._fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractUInt321 testClass)
- {
- var result = Avx.Extract(_fld, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
-
- private static UInt32[] _data = new UInt32[Op1ElementCount];
-
- private static Vector256<UInt32> _clsVar;
-
- private Vector256<UInt32> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt32, UInt32> _dataTable;
-
- static ExtractScalarTest__ExtractUInt321()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- }
-
- public ExtractScalarTest__ExtractUInt321()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt32) != typeof(long)) && (typeof(UInt32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt32>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt32>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt32>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractUInt321();
- var result = Avx.Extract(test._fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[1]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<UInt32>(Vector256<UInt32><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.22.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.22.cs
deleted file mode 100644
index 39a63c6be3..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.22.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractUInt3222()
- {
- var test = new ExtractScalarTest__ExtractUInt3222();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractUInt3222
- {
- private struct TestStruct
- {
- public Vector256<UInt32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref testStruct._fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractUInt3222 testClass)
- {
- var result = Avx.Extract(_fld, 22);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
-
- private static UInt32[] _data = new UInt32[Op1ElementCount];
-
- private static Vector256<UInt32> _clsVar;
-
- private Vector256<UInt32> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt32, UInt32> _dataTable;
-
- static ExtractScalarTest__ExtractUInt3222()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- }
-
- public ExtractScalarTest__ExtractUInt3222()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt32) != typeof(long)) && (typeof(UInt32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt32>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
- (byte)22
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt32>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
- (byte)22
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt32>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
- (byte)22
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractUInt3222();
- var result = Avx.Extract(test._fld, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[6]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<UInt32>(Vector256<UInt32><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.6.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.6.cs
deleted file mode 100644
index c35fa11ff0..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt32.6.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractUInt326()
- {
- var test = new ExtractScalarTest__ExtractUInt326();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractUInt326
- {
- private struct TestStruct
- {
- public Vector256<UInt32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref testStruct._fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractUInt326 testClass)
- {
- var result = Avx.Extract(_fld, 6);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
-
- private static UInt32[] _data = new UInt32[Op1ElementCount];
-
- private static Vector256<UInt32> _clsVar;
-
- private Vector256<UInt32> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt32, UInt32> _dataTable;
-
- static ExtractScalarTest__ExtractUInt326()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- }
-
- public ExtractScalarTest__ExtractUInt326()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt32) != typeof(long)) && (typeof(UInt32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt32>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
- (byte)6
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt32>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
- (byte)6
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt32>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
- (byte)6
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt32)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractUInt326();
- var result = Avx.Extract(test._fld, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[6]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<UInt32>(Vector256<UInt32><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.1.cs
deleted file mode 100644
index 4fb3405ecb..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.1.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractUInt641()
- {
- var test = new ExtractScalarTest__ExtractUInt641();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractUInt641
- {
- private struct TestStruct
- {
- public Vector256<UInt64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref testStruct._fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractUInt641 testClass)
- {
- var result = Avx.Extract(_fld, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
-
- private static UInt64[] _data = new UInt64[Op1ElementCount];
-
- private static Vector256<UInt64> _clsVar;
-
- private Vector256<UInt64> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt64, UInt64> _dataTable;
-
- static ExtractScalarTest__ExtractUInt641()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- }
-
- public ExtractScalarTest__ExtractUInt641()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt64>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt64>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt64>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractUInt641();
- var result = Avx.Extract(test._fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt64[] firstOp, UInt64[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[1]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<UInt64>(Vector256<UInt64><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.19.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.19.cs
deleted file mode 100644
index 53653ca28b..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.19.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractUInt6419()
- {
- var test = new ExtractScalarTest__ExtractUInt6419();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractUInt6419
- {
- private struct TestStruct
- {
- public Vector256<UInt64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref testStruct._fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractUInt6419 testClass)
- {
- var result = Avx.Extract(_fld, 19);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
-
- private static UInt64[] _data = new UInt64[Op1ElementCount];
-
- private static Vector256<UInt64> _clsVar;
-
- private Vector256<UInt64> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt64, UInt64> _dataTable;
-
- static ExtractScalarTest__ExtractUInt6419()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- }
-
- public ExtractScalarTest__ExtractUInt6419()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt64>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
- (byte)19
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt64>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
- (byte)19
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt64>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
- (byte)19
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractUInt6419();
- var result = Avx.Extract(test._fld, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt64[] firstOp, UInt64[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[3]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<UInt64>(Vector256<UInt64><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.3.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.3.cs
deleted file mode 100644
index 44dfc71255..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Extract.UInt64.3.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ExtractUInt643()
- {
- var test = new ExtractScalarTest__ExtractUInt643();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ExtractScalarTest__ExtractUInt643
- {
- private struct TestStruct
- {
- public Vector256<UInt64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref testStruct._fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(ExtractScalarTest__ExtractUInt643 testClass)
- {
- var result = Avx.Extract(_fld, 3);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
-
- private static UInt64[] _data = new UInt64[Op1ElementCount];
-
- private static Vector256<UInt64> _clsVar;
-
- private Vector256<UInt64> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt64, UInt64> _dataTable;
-
- static ExtractScalarTest__ExtractUInt643()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- }
-
- public ExtractScalarTest__ExtractUInt643()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Extract(
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Extract(
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Extract(
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt64>), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
- (byte)3
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt64>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
- (byte)3
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Extract), new Type[] { typeof(Vector256<UInt64>), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
- (byte)3
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (UInt64)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Extract(
- _clsVar,
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr);
- var result = Avx.Extract(firstOp, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.Extract(firstOp, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ExtractScalarTest__ExtractUInt643();
- var result = Avx.Extract(test._fld, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Extract(_fld, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Extract(test._fld, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt64[] firstOp, UInt64[] result, [CallerMemberName] string method = "")
- {
- if ((result[0] != firstOp[3]))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Extract)}<UInt64>(Vector256<UInt64><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Byte.cs
deleted file mode 100644
index c0f5a4092a..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Byte.cs
+++ /dev/null
@@ -1,379 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void GetLowerHalfByte()
- {
- var test = new GenericUnaryOpTest__GetLowerHalfByte();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class GenericUnaryOpTest__GetLowerHalfByte
- {
- private struct TestStruct
- {
- public Vector256<Byte> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref testStruct._fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(GenericUnaryOpTest__GetLowerHalfByte testClass)
- {
- var result = Avx.GetLowerHalf<Byte>(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
-
- private static Byte[] _data = new Byte[Op1ElementCount];
-
- private static Vector256<Byte> _clsVar;
-
- private Vector256<Byte> _fld;
-
- private SimpleUnaryOpTest__DataTable<Byte, Byte> _dataTable;
-
- static GenericUnaryOpTest__GetLowerHalfByte()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- }
-
- public GenericUnaryOpTest__GetLowerHalfByte()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetByte(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported;
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.GetLowerHalf<Byte>(
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr)
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.GetLowerHalf<Byte>(
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.GetLowerHalf<Byte>(
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr)
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Byte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Byte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Byte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.GetLowerHalf<Byte>(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr);
- var result = Avx.GetLowerHalf<Byte>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<Byte>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<Byte>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new GenericUnaryOpTest__GetLowerHalfByte();
- var result = Avx.GetLowerHalf<Byte>(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.GetLowerHalf<Byte>(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.GetLowerHalf(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Byte> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Byte[] firstOp, Byte[] result, [CallerMemberName] string method = "")
- {
- if (firstOp[0] != result[0])
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0))
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.GetLowerHalf)}<Byte>(Vector256<Byte>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Double.cs
deleted file mode 100644
index de39986bcd..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Double.cs
+++ /dev/null
@@ -1,379 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void GetLowerHalfDouble()
- {
- var test = new GenericUnaryOpTest__GetLowerHalfDouble();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class GenericUnaryOpTest__GetLowerHalfDouble
- {
- private struct TestStruct
- {
- public Vector256<Double> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref testStruct._fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(GenericUnaryOpTest__GetLowerHalfDouble testClass)
- {
- var result = Avx.GetLowerHalf<Double>(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
-
- private static Double[] _data = new Double[Op1ElementCount];
-
- private static Vector256<Double> _clsVar;
-
- private Vector256<Double> _fld;
-
- private SimpleUnaryOpTest__DataTable<Double, Double> _dataTable;
-
- static GenericUnaryOpTest__GetLowerHalfDouble()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
- }
-
- public GenericUnaryOpTest__GetLowerHalfDouble()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Double, Double>(_data, new Double[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported;
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.GetLowerHalf<Double>(
- Unsafe.Read<Vector256<Double>>(_dataTable.inArrayPtr)
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.GetLowerHalf<Double>(
- Avx.LoadVector256((Double*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.GetLowerHalf<Double>(
- Avx.LoadAlignedVector256((Double*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Double) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Double>>(_dataTable.inArrayPtr)
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Double) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Double*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Double) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Double*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.GetLowerHalf<Double>(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Double>>(_dataTable.inArrayPtr);
- var result = Avx.GetLowerHalf<Double>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Double*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<Double>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Double*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<Double>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new GenericUnaryOpTest__GetLowerHalfDouble();
- var result = Avx.GetLowerHalf<Double>(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.GetLowerHalf<Double>(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.GetLowerHalf(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Double> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Double[] inArray = new Double[Op1ElementCount];
- Double[] outArray = new Double[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Double[] inArray = new Double[Op1ElementCount];
- Double[] outArray = new Double[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Double[] firstOp, Double[] result, [CallerMemberName] string method = "")
- {
- if (firstOp[0] != result[0])
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0))
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.GetLowerHalf)}<Double>(Vector256<Double>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int16.cs
deleted file mode 100644
index d876afcfab..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int16.cs
+++ /dev/null
@@ -1,379 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void GetLowerHalfInt16()
- {
- var test = new GenericUnaryOpTest__GetLowerHalfInt16();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class GenericUnaryOpTest__GetLowerHalfInt16
- {
- private struct TestStruct
- {
- public Vector256<Int16> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref testStruct._fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(GenericUnaryOpTest__GetLowerHalfInt16 testClass)
- {
- var result = Avx.GetLowerHalf<Int16>(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
-
- private static Int16[] _data = new Int16[Op1ElementCount];
-
- private static Vector256<Int16> _clsVar;
-
- private Vector256<Int16> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int16, Int16> _dataTable;
-
- static GenericUnaryOpTest__GetLowerHalfInt16()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
- }
-
- public GenericUnaryOpTest__GetLowerHalfInt16()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt16(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported;
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.GetLowerHalf<Int16>(
- Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr)
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.GetLowerHalf<Int16>(
- Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.GetLowerHalf<Int16>(
- Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Int16) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr)
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Int16) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Int16) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.GetLowerHalf<Int16>(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr);
- var result = Avx.GetLowerHalf<Int16>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<Int16>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<Int16>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new GenericUnaryOpTest__GetLowerHalfInt16();
- var result = Avx.GetLowerHalf<Int16>(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.GetLowerHalf<Int16>(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.GetLowerHalf(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int16> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int16[] inArray = new Int16[Op1ElementCount];
- Int16[] outArray = new Int16[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int16[] inArray = new Int16[Op1ElementCount];
- Int16[] outArray = new Int16[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int16[] firstOp, Int16[] result, [CallerMemberName] string method = "")
- {
- if (firstOp[0] != result[0])
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0))
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.GetLowerHalf)}<Int16>(Vector256<Int16>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int32.cs
deleted file mode 100644
index f8a24fc9be..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int32.cs
+++ /dev/null
@@ -1,379 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void GetLowerHalfInt32()
- {
- var test = new GenericUnaryOpTest__GetLowerHalfInt32();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class GenericUnaryOpTest__GetLowerHalfInt32
- {
- private struct TestStruct
- {
- public Vector256<Int32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref testStruct._fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(GenericUnaryOpTest__GetLowerHalfInt32 testClass)
- {
- var result = Avx.GetLowerHalf<Int32>(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
-
- private static Int32[] _data = new Int32[Op1ElementCount];
-
- private static Vector256<Int32> _clsVar;
-
- private Vector256<Int32> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int32, Int32> _dataTable;
-
- static GenericUnaryOpTest__GetLowerHalfInt32()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- }
-
- public GenericUnaryOpTest__GetLowerHalfInt32()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported;
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.GetLowerHalf<Int32>(
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr)
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.GetLowerHalf<Int32>(
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.GetLowerHalf<Int32>(
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Int32) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr)
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Int32) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Int32) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.GetLowerHalf<Int32>(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr);
- var result = Avx.GetLowerHalf<Int32>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<Int32>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<Int32>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new GenericUnaryOpTest__GetLowerHalfInt32();
- var result = Avx.GetLowerHalf<Int32>(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.GetLowerHalf<Int32>(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.GetLowerHalf(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "")
- {
- if (firstOp[0] != result[0])
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0))
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.GetLowerHalf)}<Int32>(Vector256<Int32>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int64.cs
deleted file mode 100644
index e0d621c94e..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Int64.cs
+++ /dev/null
@@ -1,379 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void GetLowerHalfInt64()
- {
- var test = new GenericUnaryOpTest__GetLowerHalfInt64();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class GenericUnaryOpTest__GetLowerHalfInt64
- {
- private struct TestStruct
- {
- public Vector256<Int64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref testStruct._fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(GenericUnaryOpTest__GetLowerHalfInt64 testClass)
- {
- var result = Avx.GetLowerHalf<Int64>(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
-
- private static Int64[] _data = new Int64[Op1ElementCount];
-
- private static Vector256<Int64> _clsVar;
-
- private Vector256<Int64> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int64, Int64> _dataTable;
-
- static GenericUnaryOpTest__GetLowerHalfInt64()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- }
-
- public GenericUnaryOpTest__GetLowerHalfInt64()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt64(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported;
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.GetLowerHalf<Int64>(
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr)
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.GetLowerHalf<Int64>(
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.GetLowerHalf<Int64>(
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Int64) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr)
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Int64) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Int64) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.GetLowerHalf<Int64>(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr);
- var result = Avx.GetLowerHalf<Int64>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<Int64>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<Int64>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new GenericUnaryOpTest__GetLowerHalfInt64();
- var result = Avx.GetLowerHalf<Int64>(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.GetLowerHalf<Int64>(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.GetLowerHalf(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int64[] firstOp, Int64[] result, [CallerMemberName] string method = "")
- {
- if (firstOp[0] != result[0])
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0))
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.GetLowerHalf)}<Int64>(Vector256<Int64>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.SByte.cs
deleted file mode 100644
index 44c474f13e..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.SByte.cs
+++ /dev/null
@@ -1,379 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void GetLowerHalfSByte()
- {
- var test = new GenericUnaryOpTest__GetLowerHalfSByte();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class GenericUnaryOpTest__GetLowerHalfSByte
- {
- private struct TestStruct
- {
- public Vector256<SByte> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref testStruct._fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(GenericUnaryOpTest__GetLowerHalfSByte testClass)
- {
- var result = Avx.GetLowerHalf<SByte>(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
-
- private static SByte[] _data = new SByte[Op1ElementCount];
-
- private static Vector256<SByte> _clsVar;
-
- private Vector256<SByte> _fld;
-
- private SimpleUnaryOpTest__DataTable<SByte, SByte> _dataTable;
-
- static GenericUnaryOpTest__GetLowerHalfSByte()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
- }
-
- public GenericUnaryOpTest__GetLowerHalfSByte()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSByte(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSByte(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported;
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.GetLowerHalf<SByte>(
- Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr)
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.GetLowerHalf<SByte>(
- Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.GetLowerHalf<SByte>(
- Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(SByte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr)
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(SByte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(SByte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.GetLowerHalf<SByte>(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr);
- var result = Avx.GetLowerHalf<SByte>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<SByte>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<SByte>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new GenericUnaryOpTest__GetLowerHalfSByte();
- var result = Avx.GetLowerHalf<SByte>(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.GetLowerHalf<SByte>(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.GetLowerHalf(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<SByte> firstOp, void* result, [CallerMemberName] string method = "")
- {
- SByte[] inArray = new SByte[Op1ElementCount];
- SByte[] outArray = new SByte[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- SByte[] inArray = new SByte[Op1ElementCount];
- SByte[] outArray = new SByte[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(SByte[] firstOp, SByte[] result, [CallerMemberName] string method = "")
- {
- if (firstOp[0] != result[0])
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0))
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.GetLowerHalf)}<SByte>(Vector256<SByte>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Single.cs
deleted file mode 100644
index 1aea5cab09..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.Single.cs
+++ /dev/null
@@ -1,379 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void GetLowerHalfSingle()
- {
- var test = new GenericUnaryOpTest__GetLowerHalfSingle();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class GenericUnaryOpTest__GetLowerHalfSingle
- {
- private struct TestStruct
- {
- public Vector256<Single> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSingle(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref testStruct._fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(GenericUnaryOpTest__GetLowerHalfSingle testClass)
- {
- var result = Avx.GetLowerHalf<Single>(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Single>>() / sizeof(Single);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
-
- private static Single[] _data = new Single[Op1ElementCount];
-
- private static Vector256<Single> _clsVar;
-
- private Vector256<Single> _fld;
-
- private SimpleUnaryOpTest__DataTable<Single, Single> _dataTable;
-
- static GenericUnaryOpTest__GetLowerHalfSingle()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSingle(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
- }
-
- public GenericUnaryOpTest__GetLowerHalfSingle()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSingle(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Single>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSingle(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<Single, Single>(_data, new Single[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported;
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.GetLowerHalf<Single>(
- Unsafe.Read<Vector256<Single>>(_dataTable.inArrayPtr)
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.GetLowerHalf<Single>(
- Avx.LoadVector256((Single*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.GetLowerHalf<Single>(
- Avx.LoadAlignedVector256((Single*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Single) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Single>>(_dataTable.inArrayPtr)
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Single>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Single) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Single*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Single>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(Single) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Single*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Single>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.GetLowerHalf<Single>(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Single>>(_dataTable.inArrayPtr);
- var result = Avx.GetLowerHalf<Single>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Single*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<Single>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Single*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<Single>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new GenericUnaryOpTest__GetLowerHalfSingle();
- var result = Avx.GetLowerHalf<Single>(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.GetLowerHalf<Single>(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.GetLowerHalf(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Single> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Single[] inArray = new Single[Op1ElementCount];
- Single[] outArray = new Single[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Single[] inArray = new Single[Op1ElementCount];
- Single[] outArray = new Single[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Single>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Single[] firstOp, Single[] result, [CallerMemberName] string method = "")
- {
- if (firstOp[0] != result[0])
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0))
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.GetLowerHalf)}<Single>(Vector256<Single>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt16.cs
deleted file mode 100644
index ebffd58f3b..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt16.cs
+++ /dev/null
@@ -1,379 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void GetLowerHalfUInt16()
- {
- var test = new GenericUnaryOpTest__GetLowerHalfUInt16();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class GenericUnaryOpTest__GetLowerHalfUInt16
- {
- private struct TestStruct
- {
- public Vector256<UInt16> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref testStruct._fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(GenericUnaryOpTest__GetLowerHalfUInt16 testClass)
- {
- var result = Avx.GetLowerHalf<UInt16>(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
-
- private static UInt16[] _data = new UInt16[Op1ElementCount];
-
- private static Vector256<UInt16> _clsVar;
-
- private Vector256<UInt16> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt16, UInt16> _dataTable;
-
- static GenericUnaryOpTest__GetLowerHalfUInt16()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- }
-
- public GenericUnaryOpTest__GetLowerHalfUInt16()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported;
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.GetLowerHalf<UInt16>(
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr)
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.GetLowerHalf<UInt16>(
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.GetLowerHalf<UInt16>(
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(UInt16) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr)
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(UInt16) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(UInt16) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.GetLowerHalf<UInt16>(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr);
- var result = Avx.GetLowerHalf<UInt16>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<UInt16>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<UInt16>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new GenericUnaryOpTest__GetLowerHalfUInt16();
- var result = Avx.GetLowerHalf<UInt16>(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.GetLowerHalf<UInt16>(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.GetLowerHalf(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt16> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt16[] firstOp, UInt16[] result, [CallerMemberName] string method = "")
- {
- if (firstOp[0] != result[0])
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0))
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.GetLowerHalf)}<UInt16>(Vector256<UInt16>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt32.cs
deleted file mode 100644
index 4c1ab2b51b..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt32.cs
+++ /dev/null
@@ -1,379 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void GetLowerHalfUInt32()
- {
- var test = new GenericUnaryOpTest__GetLowerHalfUInt32();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class GenericUnaryOpTest__GetLowerHalfUInt32
- {
- private struct TestStruct
- {
- public Vector256<UInt32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref testStruct._fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(GenericUnaryOpTest__GetLowerHalfUInt32 testClass)
- {
- var result = Avx.GetLowerHalf<UInt32>(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
-
- private static UInt32[] _data = new UInt32[Op1ElementCount];
-
- private static Vector256<UInt32> _clsVar;
-
- private Vector256<UInt32> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt32, UInt32> _dataTable;
-
- static GenericUnaryOpTest__GetLowerHalfUInt32()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- }
-
- public GenericUnaryOpTest__GetLowerHalfUInt32()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported;
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.GetLowerHalf<UInt32>(
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr)
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.GetLowerHalf<UInt32>(
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.GetLowerHalf<UInt32>(
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(UInt32) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr)
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(UInt32) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(UInt32) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.GetLowerHalf<UInt32>(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr);
- var result = Avx.GetLowerHalf<UInt32>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<UInt32>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<UInt32>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new GenericUnaryOpTest__GetLowerHalfUInt32();
- var result = Avx.GetLowerHalf<UInt32>(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.GetLowerHalf<UInt32>(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.GetLowerHalf(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
- {
- if (firstOp[0] != result[0])
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0))
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.GetLowerHalf)}<UInt32>(Vector256<UInt32>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt64.cs
deleted file mode 100644
index 1a87f3317d..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/GetLowerHalf.UInt64.cs
+++ /dev/null
@@ -1,379 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void GetLowerHalfUInt64()
- {
- var test = new GenericUnaryOpTest__GetLowerHalfUInt64();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class GenericUnaryOpTest__GetLowerHalfUInt64
- {
- private struct TestStruct
- {
- public Vector256<UInt64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref testStruct._fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(GenericUnaryOpTest__GetLowerHalfUInt64 testClass)
- {
- var result = Avx.GetLowerHalf<UInt64>(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
-
- private static UInt64[] _data = new UInt64[Op1ElementCount];
-
- private static Vector256<UInt64> _clsVar;
-
- private Vector256<UInt64> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt64, UInt64> _dataTable;
-
- static GenericUnaryOpTest__GetLowerHalfUInt64()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- }
-
- public GenericUnaryOpTest__GetLowerHalfUInt64()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported;
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.GetLowerHalf<UInt64>(
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr)
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.GetLowerHalf<UInt64>(
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.GetLowerHalf<UInt64>(
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(UInt64) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr)
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(UInt64) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.GetLowerHalf))
- .MakeGenericMethod( new Type[] { typeof(UInt64) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.GetLowerHalf<UInt64>(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr);
- var result = Avx.GetLowerHalf<UInt64>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<UInt64>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.GetLowerHalf<UInt64>(firstOp);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new GenericUnaryOpTest__GetLowerHalfUInt64();
- var result = Avx.GetLowerHalf<UInt64>(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.GetLowerHalf<UInt64>(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.GetLowerHalf(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt64[] firstOp, UInt64[] result, [CallerMemberName] string method = "")
- {
- if (firstOp[0] != result[0])
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0))
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.GetLowerHalf)}<UInt64>(Vector256<UInt64>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.1.cs
deleted file mode 100644
index e5d096ef4d..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.1.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertByte1()
- {
- var test = new InsertScalarTest__InsertByte1();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertByte1
- {
- private struct TestStruct
- {
- public Vector256<Byte> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref testStruct._fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertByte1 testClass)
- {
- var result = Avx.Insert(_fld, (byte)2, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
-
- private static Byte[] _data = new Byte[Op1ElementCount];
-
- private static Vector256<Byte> _clsVar;
-
- private Vector256<Byte> _fld;
-
- private SimpleUnaryOpTest__DataTable<Byte, Byte> _dataTable;
-
- static InsertScalarTest__InsertByte1()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- }
-
- public InsertScalarTest__InsertByte1()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Byte) != typeof(long)) && (typeof(Byte) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
- (byte)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Byte>), typeof(Byte), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
- (byte)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Byte>), typeof(Byte), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Byte>), typeof(Byte), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (byte)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (byte)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (byte)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (byte)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertByte1();
- var result = Avx.Insert(test._fld, (byte)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (byte)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (byte)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Byte> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Byte[] firstOp, Byte[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 1 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<Byte>(Vector256<Byte><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.20.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.20.cs
deleted file mode 100644
index 5afd44c8b0..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.20.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertByte20()
- {
- var test = new InsertScalarTest__InsertByte20();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertByte20
- {
- private struct TestStruct
- {
- public Vector256<Byte> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref testStruct._fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertByte20 testClass)
- {
- var result = Avx.Insert(_fld, (byte)2, 20);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
-
- private static Byte[] _data = new Byte[Op1ElementCount];
-
- private static Vector256<Byte> _clsVar;
-
- private Vector256<Byte> _fld;
-
- private SimpleUnaryOpTest__DataTable<Byte, Byte> _dataTable;
-
- static InsertScalarTest__InsertByte20()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- }
-
- public InsertScalarTest__InsertByte20()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Byte) != typeof(long)) && (typeof(Byte) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
- (byte)2,
- 20
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)2,
- 20
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)2,
- 20
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Byte>), typeof(Byte), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
- (byte)2,
- (byte)20
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Byte>), typeof(Byte), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)2,
- (byte)20
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Byte>), typeof(Byte), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)2,
- (byte)20
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (byte)2,
- 20
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (byte)2, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (byte)2, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (byte)2, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertByte20();
- var result = Avx.Insert(test._fld, (byte)2, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (byte)2, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (byte)2, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Byte> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Byte[] firstOp, Byte[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 20 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<Byte>(Vector256<Byte><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.52.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.52.cs
deleted file mode 100644
index 0effba91b5..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Byte.52.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertByte52()
- {
- var test = new InsertScalarTest__InsertByte52();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertByte52
- {
- private struct TestStruct
- {
- public Vector256<Byte> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref testStruct._fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertByte52 testClass)
- {
- var result = Avx.Insert(_fld, (byte)2, 52);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte);
-
- private static Byte[] _data = new Byte[Op1ElementCount];
-
- private static Vector256<Byte> _clsVar;
-
- private Vector256<Byte> _fld;
-
- private SimpleUnaryOpTest__DataTable<Byte, Byte> _dataTable;
-
- static InsertScalarTest__InsertByte52()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- }
-
- public InsertScalarTest__InsertByte52()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld), ref Unsafe.As<Byte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (byte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Byte, Byte>(_data, new Byte[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Byte) != typeof(long)) && (typeof(Byte) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
- (byte)2,
- 52
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)2,
- 52
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)2,
- 52
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Byte>), typeof(Byte), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr),
- (byte)2,
- (byte)52
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Byte>), typeof(Byte), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)2,
- (byte)52
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Byte>), typeof(Byte), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr)),
- (byte)2,
- (byte)52
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (byte)2,
- 52
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Byte>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (byte)2, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (byte)2, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (byte)2, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertByte52();
- var result = Avx.Insert(test._fld, (byte)2, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (byte)2, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (byte)2, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Byte> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] inArray = new Byte[Op1ElementCount];
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Byte>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Byte[] firstOp, Byte[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 20 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<Byte>(Vector256<Byte><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.1.cs
deleted file mode 100644
index 9b09b57388..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.1.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertInt161()
- {
- var test = new InsertScalarTest__InsertInt161();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertInt161
- {
- private struct TestStruct
- {
- public Vector256<Int16> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref testStruct._fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertInt161 testClass)
- {
- var result = Avx.Insert(_fld, (short)2, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
-
- private static Int16[] _data = new Int16[Op1ElementCount];
-
- private static Vector256<Int16> _clsVar;
-
- private Vector256<Int16> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int16, Int16> _dataTable;
-
- static InsertScalarTest__InsertInt161()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
- }
-
- public InsertScalarTest__InsertInt161()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int16) != typeof(long)) && (typeof(Int16) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr),
- (short)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr)),
- (short)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr)),
- (short)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int16>), typeof(Int16), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr),
- (short)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int16>), typeof(Int16), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr)),
- (short)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int16>), typeof(Int16), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr)),
- (short)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (short)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (short)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (short)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (short)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertInt161();
- var result = Avx.Insert(test._fld, (short)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (short)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (short)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int16> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int16[] inArray = new Int16[Op1ElementCount];
- Int16[] outArray = new Int16[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int16[] inArray = new Int16[Op1ElementCount];
- Int16[] outArray = new Int16[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int16[] firstOp, Int16[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 1 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<Int16>(Vector256<Int16><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.11.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.11.cs
deleted file mode 100644
index fb0c813d1d..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.11.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertInt1611()
- {
- var test = new InsertScalarTest__InsertInt1611();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertInt1611
- {
- private struct TestStruct
- {
- public Vector256<Int16> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref testStruct._fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertInt1611 testClass)
- {
- var result = Avx.Insert(_fld, (short)2, 11);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
-
- private static Int16[] _data = new Int16[Op1ElementCount];
-
- private static Vector256<Int16> _clsVar;
-
- private Vector256<Int16> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int16, Int16> _dataTable;
-
- static InsertScalarTest__InsertInt1611()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
- }
-
- public InsertScalarTest__InsertInt1611()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int16) != typeof(long)) && (typeof(Int16) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr),
- (short)2,
- 11
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr)),
- (short)2,
- 11
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr)),
- (short)2,
- 11
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int16>), typeof(Int16), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr),
- (short)2,
- (byte)11
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int16>), typeof(Int16), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr)),
- (short)2,
- (byte)11
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int16>), typeof(Int16), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr)),
- (short)2,
- (byte)11
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (short)2,
- 11
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (short)2, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (short)2, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (short)2, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertInt1611();
- var result = Avx.Insert(test._fld, (short)2, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (short)2, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (short)2, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int16> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int16[] inArray = new Int16[Op1ElementCount];
- Int16[] outArray = new Int16[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int16[] inArray = new Int16[Op1ElementCount];
- Int16[] outArray = new Int16[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int16[] firstOp, Int16[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 11 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<Int16>(Vector256<Int16><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.27.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.27.cs
deleted file mode 100644
index 6d57bc0f56..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int16.27.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertInt1627()
- {
- var test = new InsertScalarTest__InsertInt1627();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertInt1627
- {
- private struct TestStruct
- {
- public Vector256<Int16> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref testStruct._fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertInt1627 testClass)
- {
- var result = Avx.Insert(_fld, (short)2, 27);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int16>>() / sizeof(Int16);
-
- private static Int16[] _data = new Int16[Op1ElementCount];
-
- private static Vector256<Int16> _clsVar;
-
- private Vector256<Int16> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int16, Int16> _dataTable;
-
- static InsertScalarTest__InsertInt1627()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _clsVar), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
- }
-
- public InsertScalarTest__InsertInt1627()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int16>, byte>(ref _fld), ref Unsafe.As<Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (short)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int16) != typeof(long)) && (typeof(Int16) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr),
- (short)2,
- 27
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr)),
- (short)2,
- 27
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr)),
- (short)2,
- 27
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int16>), typeof(Int16), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr),
- (short)2,
- (byte)27
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int16>), typeof(Int16), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr)),
- (short)2,
- (byte)27
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int16>), typeof(Int16), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr)),
- (short)2,
- (byte)27
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (short)2,
- 27
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int16>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (short)2, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int16*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (short)2, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int16*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (short)2, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertInt1627();
- var result = Avx.Insert(test._fld, (short)2, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (short)2, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (short)2, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int16> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int16[] inArray = new Int16[Op1ElementCount];
- Int16[] outArray = new Int16[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int16[] inArray = new Int16[Op1ElementCount];
- Int16[] outArray = new Int16[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int16>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int16[] firstOp, Int16[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 11 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<Int16>(Vector256<Int16><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.1.cs
deleted file mode 100644
index 102419b266..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.1.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertInt321()
- {
- var test = new InsertScalarTest__InsertInt321();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertInt321
- {
- private struct TestStruct
- {
- public Vector256<Int32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref testStruct._fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertInt321 testClass)
- {
- var result = Avx.Insert(_fld, (int)2, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
-
- private static Int32[] _data = new Int32[Op1ElementCount];
-
- private static Vector256<Int32> _clsVar;
-
- private Vector256<Int32> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int32, Int32> _dataTable;
-
- static InsertScalarTest__InsertInt321()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- }
-
- public InsertScalarTest__InsertInt321()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
- (int)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
- (int)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
- (int)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int32>), typeof(Int32), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
- (int)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int32>), typeof(Int32), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
- (int)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int32>), typeof(Int32), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
- (int)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (int)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (int)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (int)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (int)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertInt321();
- var result = Avx.Insert(test._fld, (int)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (int)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (int)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 1 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<Int32>(Vector256<Int32><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.22.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.22.cs
deleted file mode 100644
index 187d723006..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.22.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertInt3222()
- {
- var test = new InsertScalarTest__InsertInt3222();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertInt3222
- {
- private struct TestStruct
- {
- public Vector256<Int32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref testStruct._fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertInt3222 testClass)
- {
- var result = Avx.Insert(_fld, (int)2, 22);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
-
- private static Int32[] _data = new Int32[Op1ElementCount];
-
- private static Vector256<Int32> _clsVar;
-
- private Vector256<Int32> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int32, Int32> _dataTable;
-
- static InsertScalarTest__InsertInt3222()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- }
-
- public InsertScalarTest__InsertInt3222()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
- (int)2,
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
- (int)2,
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
- (int)2,
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int32>), typeof(Int32), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
- (int)2,
- (byte)22
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int32>), typeof(Int32), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
- (int)2,
- (byte)22
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int32>), typeof(Int32), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
- (int)2,
- (byte)22
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (int)2,
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (int)2, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (int)2, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (int)2, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertInt3222();
- var result = Avx.Insert(test._fld, (int)2, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (int)2, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (int)2, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 6 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<Int32>(Vector256<Int32><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.6.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.6.cs
deleted file mode 100644
index 81e8ec3dc3..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int32.6.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertInt326()
- {
- var test = new InsertScalarTest__InsertInt326();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertInt326
- {
- private struct TestStruct
- {
- public Vector256<Int32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref testStruct._fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertInt326 testClass)
- {
- var result = Avx.Insert(_fld, (int)2, 6);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int32>>() / sizeof(Int32);
-
- private static Int32[] _data = new Int32[Op1ElementCount];
-
- private static Vector256<Int32> _clsVar;
-
- private Vector256<Int32> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int32, Int32> _dataTable;
-
- static InsertScalarTest__InsertInt326()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- }
-
- public InsertScalarTest__InsertInt326()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (int)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
- (int)2,
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
- (int)2,
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
- (int)2,
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int32>), typeof(Int32), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr),
- (int)2,
- (byte)6
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int32>), typeof(Int32), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr)),
- (int)2,
- (byte)6
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int32>), typeof(Int32), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr)),
- (int)2,
- (byte)6
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (int)2,
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int32>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (int)2, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (int)2, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int32*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (int)2, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertInt326();
- var result = Avx.Insert(test._fld, (int)2, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (int)2, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (int)2, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] inArray = new Int32[Op1ElementCount];
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 6 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<Int32>(Vector256<Int32><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.1.cs
deleted file mode 100644
index 328c3678ee..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.1.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertInt641()
- {
- var test = new InsertScalarTest__InsertInt641();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertInt641
- {
- private struct TestStruct
- {
- public Vector256<Int64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref testStruct._fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertInt641 testClass)
- {
- var result = Avx.Insert(_fld, (long)2, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
-
- private static Int64[] _data = new Int64[Op1ElementCount];
-
- private static Vector256<Int64> _clsVar;
-
- private Vector256<Int64> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int64, Int64> _dataTable;
-
- static InsertScalarTest__InsertInt641()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- }
-
- public InsertScalarTest__InsertInt641()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
- (long)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
- (long)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
- (long)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int64>), typeof(Int64), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
- (long)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int64>), typeof(Int64), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
- (long)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int64>), typeof(Int64), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
- (long)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (long)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (long)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (long)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (long)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertInt641();
- var result = Avx.Insert(test._fld, (long)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (long)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (long)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int64[] firstOp, Int64[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 1 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<Int64>(Vector256<Int64><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.19.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.19.cs
deleted file mode 100644
index 5c1adcd80a..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.19.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertInt6419()
- {
- var test = new InsertScalarTest__InsertInt6419();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertInt6419
- {
- private struct TestStruct
- {
- public Vector256<Int64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref testStruct._fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertInt6419 testClass)
- {
- var result = Avx.Insert(_fld, (long)2, 19);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
-
- private static Int64[] _data = new Int64[Op1ElementCount];
-
- private static Vector256<Int64> _clsVar;
-
- private Vector256<Int64> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int64, Int64> _dataTable;
-
- static InsertScalarTest__InsertInt6419()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- }
-
- public InsertScalarTest__InsertInt6419()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
- (long)2,
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
- (long)2,
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
- (long)2,
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int64>), typeof(Int64), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
- (long)2,
- (byte)19
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int64>), typeof(Int64), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
- (long)2,
- (byte)19
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int64>), typeof(Int64), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
- (long)2,
- (byte)19
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (long)2,
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (long)2, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (long)2, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (long)2, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertInt6419();
- var result = Avx.Insert(test._fld, (long)2, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (long)2, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (long)2, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int64[] firstOp, Int64[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 3 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<Int64>(Vector256<Int64><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.3.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.3.cs
deleted file mode 100644
index 91a37fb68b..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.Int64.3.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertInt643()
- {
- var test = new InsertScalarTest__InsertInt643();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertInt643
- {
- private struct TestStruct
- {
- public Vector256<Int64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref testStruct._fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertInt643 testClass)
- {
- var result = Avx.Insert(_fld, (long)2, 3);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64);
-
- private static Int64[] _data = new Int64[Op1ElementCount];
-
- private static Vector256<Int64> _clsVar;
-
- private Vector256<Int64> _fld;
-
- private SimpleUnaryOpTest__DataTable<Int64, Int64> _dataTable;
-
- static InsertScalarTest__InsertInt643()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- }
-
- public InsertScalarTest__InsertInt643()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld), ref Unsafe.As<Int64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (long)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
- (long)2,
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
- (long)2,
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
- (long)2,
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int64>), typeof(Int64), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr),
- (long)2,
- (byte)3
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int64>), typeof(Int64), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr)),
- (long)2,
- (byte)3
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<Int64>), typeof(Int64), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr)),
- (long)2,
- (byte)3
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (long)2,
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Int64>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (long)2, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (long)2, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (long)2, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertInt643();
- var result = Avx.Insert(test._fld, (long)2, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (long)2, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (long)2, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Int64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] inArray = new Int64[Op1ElementCount];
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Int64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(Int64[] firstOp, Int64[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 3 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<Int64>(Vector256<Int64><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.1.cs
deleted file mode 100644
index f65259daa7..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.1.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertSByte1()
- {
- var test = new InsertScalarTest__InsertSByte1();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertSByte1
- {
- private struct TestStruct
- {
- public Vector256<SByte> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref testStruct._fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertSByte1 testClass)
- {
- var result = Avx.Insert(_fld, (sbyte)2, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
-
- private static SByte[] _data = new SByte[Op1ElementCount];
-
- private static Vector256<SByte> _clsVar;
-
- private Vector256<SByte> _fld;
-
- private SimpleUnaryOpTest__DataTable<SByte, SByte> _dataTable;
-
- static InsertScalarTest__InsertSByte1()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
- }
-
- public InsertScalarTest__InsertSByte1()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(SByte) != typeof(long)) && (typeof(SByte) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr),
- (sbyte)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr)),
- (sbyte)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr)),
- (sbyte)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<SByte>), typeof(SByte), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr),
- (sbyte)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<SByte>), typeof(SByte), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr)),
- (sbyte)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<SByte>), typeof(SByte), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr)),
- (sbyte)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (sbyte)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (sbyte)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (sbyte)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (sbyte)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertSByte1();
- var result = Avx.Insert(test._fld, (sbyte)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (sbyte)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (sbyte)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<SByte> firstOp, void* result, [CallerMemberName] string method = "")
- {
- SByte[] inArray = new SByte[Op1ElementCount];
- SByte[] outArray = new SByte[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- SByte[] inArray = new SByte[Op1ElementCount];
- SByte[] outArray = new SByte[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(SByte[] firstOp, SByte[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 1 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<SByte>(Vector256<SByte><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.20.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.20.cs
deleted file mode 100644
index d9cb013623..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.20.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertSByte20()
- {
- var test = new InsertScalarTest__InsertSByte20();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertSByte20
- {
- private struct TestStruct
- {
- public Vector256<SByte> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref testStruct._fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertSByte20 testClass)
- {
- var result = Avx.Insert(_fld, (sbyte)2, 20);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
-
- private static SByte[] _data = new SByte[Op1ElementCount];
-
- private static Vector256<SByte> _clsVar;
-
- private Vector256<SByte> _fld;
-
- private SimpleUnaryOpTest__DataTable<SByte, SByte> _dataTable;
-
- static InsertScalarTest__InsertSByte20()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
- }
-
- public InsertScalarTest__InsertSByte20()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(SByte) != typeof(long)) && (typeof(SByte) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr),
- (sbyte)2,
- 20
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr)),
- (sbyte)2,
- 20
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr)),
- (sbyte)2,
- 20
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<SByte>), typeof(SByte), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr),
- (sbyte)2,
- (byte)20
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<SByte>), typeof(SByte), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr)),
- (sbyte)2,
- (byte)20
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<SByte>), typeof(SByte), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr)),
- (sbyte)2,
- (byte)20
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (sbyte)2,
- 20
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (sbyte)2, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (sbyte)2, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (sbyte)2, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertSByte20();
- var result = Avx.Insert(test._fld, (sbyte)2, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (sbyte)2, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (sbyte)2, 20);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<SByte> firstOp, void* result, [CallerMemberName] string method = "")
- {
- SByte[] inArray = new SByte[Op1ElementCount];
- SByte[] outArray = new SByte[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- SByte[] inArray = new SByte[Op1ElementCount];
- SByte[] outArray = new SByte[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(SByte[] firstOp, SByte[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 20 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<SByte>(Vector256<SByte><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.52.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.52.cs
deleted file mode 100644
index 8f60eb664e..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.SByte.52.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertSByte52()
- {
- var test = new InsertScalarTest__InsertSByte52();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertSByte52
- {
- private struct TestStruct
- {
- public Vector256<SByte> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref testStruct._fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertSByte52 testClass)
- {
- var result = Avx.Insert(_fld, (sbyte)2, 52);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte);
-
- private static SByte[] _data = new SByte[Op1ElementCount];
-
- private static Vector256<SByte> _clsVar;
-
- private Vector256<SByte> _fld;
-
- private SimpleUnaryOpTest__DataTable<SByte, SByte> _dataTable;
-
- static InsertScalarTest__InsertSByte52()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
- }
-
- public InsertScalarTest__InsertSByte52()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld), ref Unsafe.As<SByte, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (sbyte)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<SByte, SByte>(_data, new SByte[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(SByte) != typeof(long)) && (typeof(SByte) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr),
- (sbyte)2,
- 52
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr)),
- (sbyte)2,
- 52
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr)),
- (sbyte)2,
- 52
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<SByte>), typeof(SByte), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr),
- (sbyte)2,
- (byte)52
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<SByte>), typeof(SByte), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr)),
- (sbyte)2,
- (byte)52
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<SByte>), typeof(SByte), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr)),
- (sbyte)2,
- (byte)52
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (sbyte)2,
- 52
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<SByte>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (sbyte)2, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((SByte*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (sbyte)2, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (sbyte)2, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertSByte52();
- var result = Avx.Insert(test._fld, (sbyte)2, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (sbyte)2, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (sbyte)2, 52);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<SByte> firstOp, void* result, [CallerMemberName] string method = "")
- {
- SByte[] inArray = new SByte[Op1ElementCount];
- SByte[] outArray = new SByte[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- SByte[] inArray = new SByte[Op1ElementCount];
- SByte[] outArray = new SByte[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<SByte>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(SByte[] firstOp, SByte[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 20 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<SByte>(Vector256<SByte><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.1.cs
deleted file mode 100644
index e838a244c1..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.1.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertUInt161()
- {
- var test = new InsertScalarTest__InsertUInt161();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertUInt161
- {
- private struct TestStruct
- {
- public Vector256<UInt16> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref testStruct._fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertUInt161 testClass)
- {
- var result = Avx.Insert(_fld, (ushort)2, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
-
- private static UInt16[] _data = new UInt16[Op1ElementCount];
-
- private static Vector256<UInt16> _clsVar;
-
- private Vector256<UInt16> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt16, UInt16> _dataTable;
-
- static InsertScalarTest__InsertUInt161()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- }
-
- public InsertScalarTest__InsertUInt161()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt16) != typeof(long)) && (typeof(UInt16) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
- (ushort)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
- (ushort)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
- (ushort)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt16>), typeof(UInt16), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
- (ushort)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt16>), typeof(UInt16), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
- (ushort)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt16>), typeof(UInt16), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
- (ushort)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (ushort)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (ushort)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (ushort)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (ushort)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertUInt161();
- var result = Avx.Insert(test._fld, (ushort)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (ushort)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (ushort)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt16> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt16[] firstOp, UInt16[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 1 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<UInt16>(Vector256<UInt16><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.11.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.11.cs
deleted file mode 100644
index be465e3861..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.11.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertUInt1611()
- {
- var test = new InsertScalarTest__InsertUInt1611();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertUInt1611
- {
- private struct TestStruct
- {
- public Vector256<UInt16> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref testStruct._fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertUInt1611 testClass)
- {
- var result = Avx.Insert(_fld, (ushort)2, 11);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
-
- private static UInt16[] _data = new UInt16[Op1ElementCount];
-
- private static Vector256<UInt16> _clsVar;
-
- private Vector256<UInt16> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt16, UInt16> _dataTable;
-
- static InsertScalarTest__InsertUInt1611()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- }
-
- public InsertScalarTest__InsertUInt1611()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt16) != typeof(long)) && (typeof(UInt16) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
- (ushort)2,
- 11
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
- (ushort)2,
- 11
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
- (ushort)2,
- 11
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt16>), typeof(UInt16), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
- (ushort)2,
- (byte)11
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt16>), typeof(UInt16), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
- (ushort)2,
- (byte)11
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt16>), typeof(UInt16), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
- (ushort)2,
- (byte)11
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (ushort)2,
- 11
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (ushort)2, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (ushort)2, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (ushort)2, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertUInt1611();
- var result = Avx.Insert(test._fld, (ushort)2, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (ushort)2, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (ushort)2, 11);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt16> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt16[] firstOp, UInt16[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 11 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<UInt16>(Vector256<UInt16><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.27.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.27.cs
deleted file mode 100644
index f62b1d0d6c..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt16.27.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertUInt1627()
- {
- var test = new InsertScalarTest__InsertUInt1627();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertUInt1627
- {
- private struct TestStruct
- {
- public Vector256<UInt16> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref testStruct._fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertUInt1627 testClass)
- {
- var result = Avx.Insert(_fld, (ushort)2, 27);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt16>>() / sizeof(UInt16);
-
- private static UInt16[] _data = new UInt16[Op1ElementCount];
-
- private static Vector256<UInt16> _clsVar;
-
- private Vector256<UInt16> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt16, UInt16> _dataTable;
-
- static InsertScalarTest__InsertUInt1627()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- }
-
- public InsertScalarTest__InsertUInt1627()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ushort)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt16, UInt16>(_data, new UInt16[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt16) != typeof(long)) && (typeof(UInt16) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
- (ushort)2,
- 27
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
- (ushort)2,
- 27
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
- (ushort)2,
- 27
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt16>), typeof(UInt16), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr),
- (ushort)2,
- (byte)27
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt16>), typeof(UInt16), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr)),
- (ushort)2,
- (byte)27
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt16>), typeof(UInt16), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr)),
- (ushort)2,
- (byte)27
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt16>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (ushort)2,
- 27
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt16>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (ushort)2, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (ushort)2, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt16*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (ushort)2, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertUInt1627();
- var result = Avx.Insert(test._fld, (ushort)2, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (ushort)2, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (ushort)2, 27);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt16> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] inArray = new UInt16[Op1ElementCount];
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt16>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt16[] firstOp, UInt16[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 11 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<UInt16>(Vector256<UInt16><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.1.cs
deleted file mode 100644
index e96390ab5b..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.1.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertUInt321()
- {
- var test = new InsertScalarTest__InsertUInt321();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertUInt321
- {
- private struct TestStruct
- {
- public Vector256<UInt32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref testStruct._fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertUInt321 testClass)
- {
- var result = Avx.Insert(_fld, (uint)2, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
-
- private static UInt32[] _data = new UInt32[Op1ElementCount];
-
- private static Vector256<UInt32> _clsVar;
-
- private Vector256<UInt32> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt32, UInt32> _dataTable;
-
- static InsertScalarTest__InsertUInt321()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- }
-
- public InsertScalarTest__InsertUInt321()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt32) != typeof(long)) && (typeof(UInt32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
- (uint)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
- (uint)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
- (uint)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt32>), typeof(UInt32), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
- (uint)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt32>), typeof(UInt32), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
- (uint)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt32>), typeof(UInt32), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
- (uint)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (uint)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (uint)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (uint)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (uint)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertUInt321();
- var result = Avx.Insert(test._fld, (uint)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (uint)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (uint)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 1 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<UInt32>(Vector256<UInt32><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.22.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.22.cs
deleted file mode 100644
index 0249357c4a..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.22.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertUInt3222()
- {
- var test = new InsertScalarTest__InsertUInt3222();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertUInt3222
- {
- private struct TestStruct
- {
- public Vector256<UInt32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref testStruct._fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertUInt3222 testClass)
- {
- var result = Avx.Insert(_fld, (uint)2, 22);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
-
- private static UInt32[] _data = new UInt32[Op1ElementCount];
-
- private static Vector256<UInt32> _clsVar;
-
- private Vector256<UInt32> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt32, UInt32> _dataTable;
-
- static InsertScalarTest__InsertUInt3222()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- }
-
- public InsertScalarTest__InsertUInt3222()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt32) != typeof(long)) && (typeof(UInt32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
- (uint)2,
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
- (uint)2,
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
- (uint)2,
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt32>), typeof(UInt32), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
- (uint)2,
- (byte)22
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt32>), typeof(UInt32), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
- (uint)2,
- (byte)22
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt32>), typeof(UInt32), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
- (uint)2,
- (byte)22
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (uint)2,
- 22
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (uint)2, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (uint)2, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (uint)2, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertUInt3222();
- var result = Avx.Insert(test._fld, (uint)2, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (uint)2, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (uint)2, 22);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 6 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<UInt32>(Vector256<UInt32><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.6.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.6.cs
deleted file mode 100644
index 3309912a14..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt32.6.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertUInt326()
- {
- var test = new InsertScalarTest__InsertUInt326();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertUInt326
- {
- private struct TestStruct
- {
- public Vector256<UInt32> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref testStruct._fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertUInt326 testClass)
- {
- var result = Avx.Insert(_fld, (uint)2, 6);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt32>>() / sizeof(UInt32);
-
- private static UInt32[] _data = new UInt32[Op1ElementCount];
-
- private static Vector256<UInt32> _clsVar;
-
- private Vector256<UInt32> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt32, UInt32> _dataTable;
-
- static InsertScalarTest__InsertUInt326()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- }
-
- public InsertScalarTest__InsertUInt326()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (uint)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt32, UInt32>(_data, new UInt32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt32) != typeof(long)) && (typeof(UInt32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
- (uint)2,
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
- (uint)2,
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
- (uint)2,
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt32>), typeof(UInt32), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr),
- (uint)2,
- (byte)6
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt32>), typeof(UInt32), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr)),
- (uint)2,
- (byte)6
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt32>), typeof(UInt32), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr)),
- (uint)2,
- (byte)6
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt32>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (uint)2,
- 6
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt32>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (uint)2, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (uint)2, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt32*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (uint)2, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertUInt326();
- var result = Avx.Insert(test._fld, (uint)2, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (uint)2, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (uint)2, 6);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt32> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] inArray = new UInt32[Op1ElementCount];
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt32>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 6 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<UInt32>(Vector256<UInt32><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.1.cs
deleted file mode 100644
index 80a24dcfff..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.1.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertUInt641()
- {
- var test = new InsertScalarTest__InsertUInt641();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertUInt641
- {
- private struct TestStruct
- {
- public Vector256<UInt64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref testStruct._fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertUInt641 testClass)
- {
- var result = Avx.Insert(_fld, (ulong)2, 1);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
-
- private static UInt64[] _data = new UInt64[Op1ElementCount];
-
- private static Vector256<UInt64> _clsVar;
-
- private Vector256<UInt64> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt64, UInt64> _dataTable;
-
- static InsertScalarTest__InsertUInt641()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- }
-
- public InsertScalarTest__InsertUInt641()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
- (ulong)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
- (ulong)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
- (ulong)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt64>), typeof(UInt64), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
- (ulong)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt64>), typeof(UInt64), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
- (ulong)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt64>), typeof(UInt64), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
- (ulong)2,
- (byte)1
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (ulong)2,
- 1
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (ulong)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (ulong)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (ulong)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertUInt641();
- var result = Avx.Insert(test._fld, (ulong)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (ulong)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (ulong)2, 1);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt64[] firstOp, UInt64[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 1 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<UInt64>(Vector256<UInt64><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.19.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.19.cs
deleted file mode 100644
index 897799e34c..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.19.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertUInt6419()
- {
- var test = new InsertScalarTest__InsertUInt6419();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertUInt6419
- {
- private struct TestStruct
- {
- public Vector256<UInt64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref testStruct._fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertUInt6419 testClass)
- {
- var result = Avx.Insert(_fld, (ulong)2, 19);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
-
- private static UInt64[] _data = new UInt64[Op1ElementCount];
-
- private static Vector256<UInt64> _clsVar;
-
- private Vector256<UInt64> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt64, UInt64> _dataTable;
-
- static InsertScalarTest__InsertUInt6419()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- }
-
- public InsertScalarTest__InsertUInt6419()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
- (ulong)2,
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
- (ulong)2,
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
- (ulong)2,
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt64>), typeof(UInt64), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
- (ulong)2,
- (byte)19
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt64>), typeof(UInt64), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
- (ulong)2,
- (byte)19
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt64>), typeof(UInt64), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
- (ulong)2,
- (byte)19
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (ulong)2,
- 19
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (ulong)2, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (ulong)2, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (ulong)2, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertUInt6419();
- var result = Avx.Insert(test._fld, (ulong)2, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (ulong)2, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (ulong)2, 19);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt64[] firstOp, UInt64[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 3 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<UInt64>(Vector256<UInt64><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.3.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.3.cs
deleted file mode 100644
index 01ebedf07f..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Insert.UInt64.3.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void InsertUInt643()
- {
- var test = new InsertScalarTest__InsertUInt643();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class InsertScalarTest__InsertUInt643
- {
- private struct TestStruct
- {
- public Vector256<UInt64> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref testStruct._fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(InsertScalarTest__InsertUInt643 testClass)
- {
- var result = Avx.Insert(_fld, (ulong)2, 3);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<UInt64>>() / sizeof(UInt64);
-
- private static UInt64[] _data = new UInt64[Op1ElementCount];
-
- private static Vector256<UInt64> _clsVar;
-
- private Vector256<UInt64> _fld;
-
- private SimpleUnaryOpTest__DataTable<UInt64, UInt64> _dataTable;
-
- static InsertScalarTest__InsertUInt643()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- }
-
- public InsertScalarTest__InsertUInt643()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = (ulong)0; }
- _dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Avx.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx.Insert(
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
- (ulong)2,
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx.Insert(
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
- (ulong)2,
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx.Insert(
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
- (ulong)2,
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt64>), typeof(UInt64), typeof(byte) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr),
- (ulong)2,
- (byte)3
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt64>), typeof(UInt64), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr)),
- (ulong)2,
- (byte)3
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx).GetMethod(nameof(Avx.Insert), new Type[] { typeof(Vector256<UInt64>), typeof(UInt64), typeof(byte) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr)),
- (ulong)2,
- (byte)3
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector256<UInt64>)(result));
- ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx.Insert(
- _clsVar,
- (ulong)2,
- 3
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<UInt64>>(_dataTable.inArrayPtr);
- var result = Avx.Insert(firstOp, (ulong)2, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (ulong)2, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((UInt64*)(_dataTable.inArrayPtr));
- var result = Avx.Insert(firstOp, (ulong)2, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(firstOp, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new InsertScalarTest__InsertUInt643();
- var result = Avx.Insert(test._fld, (ulong)2, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx.Insert(_fld, (ulong)2, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx.Insert(test._fld, (ulong)2, 3);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<UInt64> firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] inArray = new UInt64[Op1ElementCount];
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<UInt64>>());
-
- ValidateResult(inArray, outArray, method);
- }
-
- private void ValidateResult(UInt64[] firstOp, UInt64[] result, [CallerMemberName] string method = "")
- {
-
- for (var i = 0; i < RetElementCount; i++)
- {
- if ((i == 3 ? result[i] != 2 : result[i] != 0))
- {
- Succeeded = false;
- break;
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx)}.{nameof(Avx.Insert)}<UInt64>(Vector256<UInt64><9>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Program.Avx.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Program.Avx.cs
index 597d18495e..65fb994dcb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/Program.Avx.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx/Program.Avx.cs
@@ -34,24 +34,6 @@ namespace JIT.HardwareIntrinsics.X86
["DuplicateEvenIndexed.Double"] = DuplicateEvenIndexedDouble,
["DuplicateEvenIndexed.Single"] = DuplicateEvenIndexedSingle,
["DuplicateOddIndexed.Single"] = DuplicateOddIndexedSingle,
- ["Extract.Byte.1"] = ExtractByte1,
- ["Extract.Byte.20"] = ExtractByte20,
- ["Extract.Byte.52"] = ExtractByte52,
- ["Extract.UInt16.1"] = ExtractUInt161,
- ["Extract.UInt16.11"] = ExtractUInt1611,
- ["Extract.UInt16.27"] = ExtractUInt1627,
- ["Extract.Int32.1"] = ExtractInt321,
- ["Extract.UInt32.1"] = ExtractUInt321,
- ["Extract.Int32.6"] = ExtractInt326,
- ["Extract.UInt32.6"] = ExtractUInt326,
- ["Extract.Int32.22"] = ExtractInt3222,
- ["Extract.UInt32.22"] = ExtractUInt3222,
- ["Extract.Int64.1"] = ExtractInt641,
- ["Extract.UInt64.1"] = ExtractUInt641,
- ["Extract.Int64.3"] = ExtractInt643,
- ["Extract.UInt64.3"] = ExtractUInt643,
- ["Extract.Int64.19"] = ExtractInt6419,
- ["Extract.UInt64.19"] = ExtractUInt6419,
["ExtractVector128.Single.1"] = ExtractVector128Single1,
["ExtractVector128.Double.1"] = ExtractVector128Double1,
["ExtractVector128.Byte.1"] = ExtractVector128Byte1,
@@ -72,30 +54,6 @@ namespace JIT.HardwareIntrinsics.X86
["ExtractVector128.UInt64.1.Store"] = ExtractVector128UInt641Store,
["ExtractVector128.Single.1.Store"] = ExtractVector128Single1Store,
["ExtractVector128.Double.1.Store"] = ExtractVector128Double1Store,
- ["Insert.Byte.1"] = InsertByte1,
- ["Insert.Byte.20"] = InsertByte20,
- ["Insert.SByte.1"] = InsertSByte1,
- ["Insert.SByte.20"] = InsertSByte20,
- ["Insert.Byte.52"] = InsertByte52,
- ["Insert.SByte.52"] = InsertSByte52,
- ["Insert.Int16.1"] = InsertInt161,
- ["Insert.Int16.11"] = InsertInt1611,
- ["Insert.UInt16.1"] = InsertUInt161,
- ["Insert.UInt16.11"] = InsertUInt1611,
- ["Insert.Int16.27"] = InsertInt1627,
- ["Insert.UInt16.27"] = InsertUInt1627,
- ["Insert.Int32.1"] = InsertInt321,
- ["Insert.Int32.6"] = InsertInt326,
- ["Insert.UInt32.1"] = InsertUInt321,
- ["Insert.UInt32.6"] = InsertUInt326,
- ["Insert.Int32.22"] = InsertInt3222,
- ["Insert.UInt32.22"] = InsertUInt3222,
- ["Insert.Int64.1"] = InsertInt641,
- ["Insert.Int64.3"] = InsertInt643,
- ["Insert.UInt64.1"] = InsertUInt641,
- ["Insert.UInt64.3"] = InsertUInt643,
- ["Insert.Int64.19"] = InsertInt6419,
- ["Insert.UInt64.19"] = InsertUInt6419,
["InsertVector128.Byte.1"] = InsertVector128Byte1,
["InsertVector128.SByte.1"] = InsertVector128SByte1,
["InsertVector128.Int16.1"] = InsertVector128Int161,
@@ -118,16 +76,6 @@ namespace JIT.HardwareIntrinsics.X86
["InsertVector128.Double.1.Load"] = InsertVector128Double1Load,
["Floor.Double"] = FloorDouble,
["Floor.Single"] = FloorSingle,
- ["GetLowerHalf.Byte"] = GetLowerHalfByte,
- ["GetLowerHalf.Double"] = GetLowerHalfDouble,
- ["GetLowerHalf.Int16"] = GetLowerHalfInt16,
- ["GetLowerHalf.Int32"] = GetLowerHalfInt32,
- ["GetLowerHalf.Int64"] = GetLowerHalfInt64,
- ["GetLowerHalf.SByte"] = GetLowerHalfSByte,
- ["GetLowerHalf.Single"] = GetLowerHalfSingle,
- ["GetLowerHalf.UInt16"] = GetLowerHalfUInt16,
- ["GetLowerHalf.UInt32"] = GetLowerHalfUInt32,
- ["GetLowerHalf.UInt64"] = GetLowerHalfUInt64,
["LoadVector256.Single"] = LoadVector256Single,
["LoadVector256.Double"] = LoadVector256Double,
["LoadVector256.Byte"] = LoadVector256Byte,
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256.cs
deleted file mode 100644
index cfe3b841d5..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256.cs
+++ /dev/null
@@ -1,241 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Avx.IsSupported)
- {
- using (TestTable<float> floatTable = new TestTable<float>(new float[8] { float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN }))
- {
- var vf1 = Avx.SetAllVector256<float>(-5);
- Unsafe.Write(floatTable.outArrayPtr, vf1);
-
- if (!floatTable.CheckResult((x) => (x == -5)))
- {
- Console.WriteLine("AVX SetAllVector256 failed on float:");
- foreach (var item in floatTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<double> doubleTable = new TestTable<double>(new double[4] { double.NaN, double.NaN, double.NaN, double.NaN }))
- {
- var vf1 = Avx.SetAllVector256<double>(3);
- Unsafe.Write(doubleTable.outArrayPtr, vf1);
-
- if (!doubleTable.CheckResult((x) => (x == 3)))
- {
- Console.WriteLine("AVX SetAllVector256 failed on double:");
- foreach (var item in doubleTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<sbyte> sbyteTable = new TestTable<sbyte>(new sbyte[32] { sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue,
- sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue,
- sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue,
- sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue }))
- {
- var vf1 = Avx.SetAllVector256<sbyte>(100);
- Unsafe.Write(sbyteTable.outArrayPtr, vf1);
-
- if (!sbyteTable.CheckResult((x) => (x == 100)))
- {
- Console.WriteLine("AVX SetAllVector256 failed on sbyte:");
- foreach (var item in sbyteTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<byte> byteTable = new TestTable<byte>(new byte[32] { byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue,
- byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue,
- byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue,
- byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue }))
- {
- Vector256<byte> vf1 = Avx.SetAllVector256<byte>(4);
- Unsafe.Write(byteTable.outArrayPtr, vf1);
-
- if (!byteTable.CheckResult((x) => (x == 4)))
- {
- Console.WriteLine("AVX SetAllVector256 failed on byte:");
- foreach (var item in byteTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<short> shortTable = new TestTable<short>(new short[16] { short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue,
- short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue }))
- {
- var vf1 = Avx.SetAllVector256<short>(-5);
- Unsafe.Write(shortTable.outArrayPtr, vf1);
-
- if (!shortTable.CheckResult((x) => (x == -5)))
- {
- Console.WriteLine("AVX SetAllVector256 failed on short:");
- foreach (var item in shortTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<ushort> ushortTable = new TestTable<ushort>(new ushort[16] { ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue,
- ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue }))
- {
- Vector256<ushort> vf1 = Avx.SetAllVector256<ushort>(2);
- Unsafe.Write(ushortTable.outArrayPtr, vf1);
-
- if (!ushortTable.CheckResult((x) => (x == 2)))
- {
- Console.WriteLine("AVX SetAllVector256 failed on ushort:");
- foreach (var item in ushortTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<int> intTable = new TestTable<int>(new int[8] { int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue }))
- {
- var vf1 = Avx.SetAllVector256<int>(-5);
- Unsafe.Write(intTable.outArrayPtr, vf1);
-
- if (!intTable.CheckResult((x) => (x == -5)))
- {
- Console.WriteLine("AVX SetAllVector256 failed on int:");
- foreach (var item in intTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<uint> uintTable = new TestTable<uint>(new uint[8] { uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue }))
- {
- Vector256<uint> vf1 = Avx.SetAllVector256<uint>(3);
- Unsafe.Write(uintTable.outArrayPtr, vf1);
-
- if (!uintTable.CheckResult((x) => (x == 3)))
- {
- Console.WriteLine("AVX SetAllVector256 failed on uint:");
- foreach (var item in uintTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- if (Environment.Is64BitProcess)
- {
- using (TestTable<long> longTable = new TestTable<long>(new long[4] { long.MaxValue, long.MaxValue, long.MaxValue, long.MaxValue }))
- {
- var vf1 = Avx.SetAllVector256<long>(-199);
- Unsafe.Write(longTable.outArrayPtr, vf1);
-
- if (!longTable.CheckResult((x) => (x == -199)))
- {
- Console.WriteLine("AVX SetAllVector256 failed on long:");
- foreach (var item in longTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<ulong> ulongTable = new TestTable<ulong>(new ulong[4] { ulong.MaxValue, ulong.MaxValue, ulong.MaxValue, ulong.MaxValue }))
- {
- Vector256<ulong> vf1 = Avx.SetAllVector256<ulong>(34);
- Unsafe.Write(ulongTable.outArrayPtr, vf1);
-
- if (!ulongTable.CheckResult((x) => (x == 34)))
- {
- Console.WriteLine("AVX SetAllVector256 failed on ulong:");
- foreach (var item in ulongTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
- }
- }
-
- return testResult;
- }
-
- public unsafe struct TestTable<T> : IDisposable where T : struct
- {
- public T[] outArray;
-
- public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
-
- GCHandle outHandle;
- public TestTable(T[] a)
- {
- this.outArray = a;
-
- outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
- }
- public bool CheckResult(Func<T, bool> check)
- {
- foreach (var item in outArray)
- {
- if (!check(item))
- {
- return false;
- }
- }
- return true;
- }
-
- public void Dispose()
- {
- outHandle.Free();
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_ro.csproj
deleted file mode 100644
index 907bd0067a..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetAllVector256_ro.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize>True</Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetAllVector256.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256.cs
deleted file mode 100644
index 90e89c6f67..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Avx.IsSupported)
- {
- using (TestTable<float> floatTable = new TestTable<float>(new float[8] { float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN }))
- {
- var vf1 = Avx.SetVector256((float)1, -5, 100, 0, 1, 2, 3, 4);
- Unsafe.Write(floatTable.outArrayPtr, vf1);
-
- if (!floatTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
- (x[4] == 0) && (x[5] == 100) && (x[6] == -5) && (x[7] == 1)))
- {
- Console.WriteLine("AVX SetVector256 failed on float:");
- foreach (var item in floatTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<double> doubleTable = new TestTable<double>(new double[4] { double.NaN, double.NaN, double.NaN, double.NaN }))
- {
- var vf1 = Avx.SetVector256((double)1, 2, 3, 4);
- Unsafe.Write(doubleTable.outArrayPtr, vf1);
-
- if (!doubleTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1)))
- {
- Console.WriteLine("AVX SetVector256 failed on double:");
- foreach (var item in doubleTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<sbyte> sbyteTable = new TestTable<sbyte>(new sbyte[32] { sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue,
- sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue,
- sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue,
- sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue }))
- {
- var vf1 = Avx.SetVector256(1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4);
- Unsafe.Write(sbyteTable.outArrayPtr, vf1);
-
- if (!sbyteTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
- (x[4] == 0) && (x[5] == 100) && (x[6] == -5) && (x[7] == 1) &&
- (x[8] == 4) && (x[9] == 3) && (x[10] == 2) && (x[11] == 1) &&
- (x[12] == 0) && (x[13] == 100) && (x[14] == -5) && (x[15] == 1) &&
- (x[16] == 4) && (x[17] == 3) && (x[18] == 2) && (x[19] == 1) &&
- (x[20] == 0) && (x[21] == 100) && (x[22] == -5) && (x[23] == 1) &&
- (x[24] == 4) && (x[25] == 3) && (x[26] == 2) && (x[27] == 1) &&
- (x[28] == 0) && (x[29] == 100) && (x[30] == -5) && (x[31] == 1)))
- {
- Console.WriteLine("AVX SetVector256 failed on sbyte:");
- foreach (var item in sbyteTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<byte> byteTable = new TestTable<byte>(new byte[32] { byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue,
- byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue,
- byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue,
- byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue }))
- {
- Vector256<byte> vf1 = Avx.SetVector256((byte)1, 5, 100, 0, 1, 2, 3, 4, 1, 5, 100, 0, 1, 2, 3, 4, 1, 5, 100, 0, 1, 2, 3, 4, 1, 5, 100, 0, 1, 2, 3, 4);
- Unsafe.Write(byteTable.outArrayPtr, vf1);
-
- if (!byteTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
- (x[4] == 0) && (x[5] == 100) && (x[6] == 5) && (x[7] == 1) &&
- (x[8] == 4) && (x[9] == 3) && (x[10] == 2) && (x[11] == 1) &&
- (x[12] == 0) && (x[13] == 100) && (x[14] == 5) && (x[15] == 1) &&
- (x[16] == 4) && (x[17] == 3) && (x[18] == 2) && (x[19] == 1) &&
- (x[20] == 0) && (x[21] == 100) && (x[22] == 5) && (x[23] == 1) &&
- (x[24] == 4) && (x[25] == 3) && (x[26] == 2) && (x[27] == 1) &&
- (x[28] == 0) && (x[29] == 100) && (x[30] == 5) && (x[31] == 1)))
- {
- Console.WriteLine("AVX SetVector256 failed on byte:");
- foreach (var item in byteTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<short> shortTable = new TestTable<short>(new short[16] { short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue,
- short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue }))
- {
- var vf1 = Avx.SetVector256(1, -5, 100, 0, 1, 2, 3, 4, 1, -5, 100, 0, 1, 2, 3, 4);
- Unsafe.Write(shortTable.outArrayPtr, vf1);
-
- if (!shortTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
- (x[4] == 0) && (x[5] == 100) && (x[6] == -5) && (x[7] == 1) &&
- (x[8] == 4) && (x[9] == 3) && (x[10] == 2) && (x[11] == 1) &&
- (x[12] == 0) && (x[13] == 100) && (x[14] == -5) && (x[15] == 1)))
- {
- Console.WriteLine("AVX SetVector256 failed on short:");
- foreach (var item in shortTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<ushort> ushortTable = new TestTable<ushort>(new ushort[16] { ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue,
- ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue }))
- {
- Vector256<ushort> vf1 = Avx.SetVector256((ushort)1, 5, 100, 0, 1, 2, 3, 4, 1, 5, 100, 0, 1, 2, 3, 4);
- Unsafe.Write(ushortTable.outArrayPtr, vf1);
-
- if (!ushortTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
- (x[4] == 0) && (x[5] == 100) && (x[6] == 5) && (x[7] == 1) &&
- (x[8] == 4) && (x[9] == 3) && (x[10] == 2) && (x[11] == 1) &&
- (x[12] == 0) && (x[13] == 100) && (x[14] == 5) && (x[15] == 1)))
- {
- Console.WriteLine("AVX SetVector256 failed on ushort:");
- foreach (var item in ushortTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<int> intTable = new TestTable<int>(new int[8] { int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue }))
- {
- var vf1 = Avx.SetVector256(1, -5, 100, 0, 1, 2, 3, 4);
- Unsafe.Write(intTable.outArrayPtr, vf1);
-
- if (!intTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
- (x[4] == 0) && (x[5] == 100) && (x[6] == -5) && (x[7] == 1)))
- {
- Console.WriteLine("AVX SetVector256 failed on int:");
- foreach (var item in intTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<uint> uintTable = new TestTable<uint>(new uint[8] { uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue }))
- {
- Vector256<uint> vf1 = Avx.SetVector256((uint)1, 5, 100, 0, 1, 2, 3, 4);
- Unsafe.Write(uintTable.outArrayPtr, vf1);
-
- if (!uintTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1) &&
- (x[4] == 0) && (x[5] == 100) && (x[6] == 5) && (x[7] == 1)))
- {
- Console.WriteLine("AVX SetVector256 failed on uint:");
- foreach (var item in uintTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- if (Environment.Is64BitProcess)
- {
- using (TestTable<long> longTable = new TestTable<long>(new long[4] { long.MaxValue, long.MaxValue, long.MaxValue, long.MaxValue }))
- {
- var vf1 = Avx.SetVector256(1, 2, 3, 4);
- Unsafe.Write(longTable.outArrayPtr, vf1);
-
- if (!longTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1)))
- {
- Console.WriteLine("AVX SetVector256 failed on long:");
- foreach (var item in longTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<ulong> ulongTable = new TestTable<ulong>(new ulong[4] { ulong.MaxValue, ulong.MaxValue, ulong.MaxValue, ulong.MaxValue }))
- {
- Vector256<ulong> vf1 = Avx.SetVector256((ulong)1, 2, 3, 4);
- Unsafe.Write(ulongTable.outArrayPtr, vf1);
-
- if (!ulongTable.CheckResult((x) => (x[0] == 4) && (x[1] == 3) && (x[2] == 2) && (x[3] == 1)))
- {
- Console.WriteLine("AVX SetVector256 failed on ulong:");
- foreach (var item in ulongTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
- }
- }
-
- return testResult;
- }
-
- public unsafe struct TestTable<T> : IDisposable where T : struct
- {
- public T[] outArray;
-
- public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
-
- GCHandle outHandle;
- public TestTable(T[] a)
- {
- this.outArray = a;
-
- outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
- }
- public bool CheckResult(Func<T[], bool> check)
- {
- return check(outArray);
- }
-
- public void Dispose()
- {
- outHandle.Free();
- }
- }
-
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_r.csproj
deleted file mode 100644
index 8c48b326f8..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_r.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize></Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetVector256.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_ro.csproj
deleted file mode 100644
index 9bd3d1656e..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetVector256_ro.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize>True</Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetVector256.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetZeroVector256.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetZeroVector256.cs
deleted file mode 100644
index a865b8eee3..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetZeroVector256.cs
+++ /dev/null
@@ -1,231 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Avx.IsSupported)
- {
- using (TestTable<float> floatTable = new TestTable<float>(new float[8] { float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN }))
- {
- var vf1 = Avx.SetZeroVector256<float>();
- Unsafe.Write(floatTable.outArrayPtr, vf1);
-
- if (!floatTable.CheckResult((x) => BitConverter.SingleToInt32Bits(x) == 0))
- {
- Console.WriteLine("AVX SetZeroVector256 failed on float:");
- foreach (var item in floatTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<double> doubleTable = new TestTable<double>(new double[4] { double.NaN, double.NaN, double.NaN, double.NaN }))
- {
- var vf1 = Avx.SetZeroVector256<double>();
- Unsafe.Write(doubleTable.outArrayPtr, vf1);
-
- if (!doubleTable.CheckResult((x) => BitConverter.DoubleToInt64Bits(x) == 0))
- {
- Console.WriteLine("AVX SetZeroVector256 failed on double:");
- foreach (var item in doubleTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<long> longTable = new TestTable<long>(new long[4] { long.MaxValue, long.MaxValue, long.MaxValue, long.MaxValue }))
- {
- var vf1 = Avx.SetZeroVector256<long>();
- Unsafe.Write(longTable.outArrayPtr, vf1);
-
- if (!longTable.CheckResult((x) => x == 0))
- {
- Console.WriteLine("AVX SetZeroVector256 failed on long:");
- foreach (var item in longTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<ulong> ulongTable = new TestTable<ulong>(new ulong[4] { ulong.MaxValue, ulong.MaxValue, ulong.MaxValue, ulong.MaxValue }))
- {
- var vf1 = Avx.SetZeroVector256<ulong>();
- Unsafe.Write(ulongTable.outArrayPtr, vf1);
-
- if (!ulongTable.CheckResult((x) => x == 0))
- {
- Console.WriteLine("AVX SetZeroVector256 failed on ulong:");
- foreach (var item in ulongTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<int> intTable = new TestTable<int>(new int[8] { int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue }))
- {
- var vf1 = Avx.SetZeroVector256<int>();
- Unsafe.Write(intTable.outArrayPtr, vf1);
-
- if (!intTable.CheckResult((x) => x == 0))
- {
- Console.WriteLine("AVX SetZeroVector256 failed on int:");
- foreach (var item in intTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<uint> uintTable = new TestTable<uint>(new uint[8] { uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue, uint.MaxValue }))
- {
- var vf1 = Avx.SetZeroVector256<uint>();
- Unsafe.Write(uintTable.outArrayPtr, vf1);
-
- if (!uintTable.CheckResult((x) => x == 0))
- {
- Console.WriteLine("AVX SetZeroVector256 failed on uint:");
- foreach (var item in uintTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<short> shortTable = new TestTable<short>(new short[16] { short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue, short.MaxValue }))
- {
- var vf1 = Avx.SetZeroVector256<short>();
- Unsafe.Write(shortTable.outArrayPtr, vf1);
-
- if (!shortTable.CheckResult((x) => x == 0))
- {
- Console.WriteLine("AVX SetZeroVector256 failed on short:");
- foreach (var item in shortTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<ushort> ushortTable = new TestTable<ushort>(new ushort[16] { ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue }))
- {
- var vf1 = Avx.SetZeroVector256<ushort>();
- Unsafe.Write(ushortTable.outArrayPtr, vf1);
-
- if (!ushortTable.CheckResult((x) => x == 0))
- {
- Console.WriteLine("AVX SetZeroVector256 failed on ushort:");
- foreach (var item in ushortTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<sbyte> sbyteTable = new TestTable<sbyte>(new sbyte[32] { sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue, sbyte.MaxValue }))
- {
- var vf1 = Avx.SetZeroVector256<sbyte>();
- Unsafe.Write(sbyteTable.outArrayPtr, vf1);
-
- if (!sbyteTable.CheckResult((x) => x == 0))
- {
- Console.WriteLine("AVX SetZeroVector256 failed on sbyte:");
- foreach (var item in sbyteTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<byte> byteTable = new TestTable<byte>(new byte[32] { byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue }))
- {
- var vf1 = Avx.SetZeroVector256<byte>();
- Unsafe.Write(byteTable.outArrayPtr, vf1);
-
- if (!byteTable.CheckResult((x) => x == 0))
- {
- Console.WriteLine("AVX SetZeroVector256 failed on byte:");
- foreach (var item in byteTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
- }
-
- return testResult;
- }
-
- public unsafe struct TestTable<T> : IDisposable where T : struct
- {
- public T[] outArray;
-
- public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
-
- GCHandle outHandle;
- public TestTable(T[] a)
- {
- this.outArray = a;
-
- outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
- }
- public bool CheckResult(Func<T, bool> check)
- {
- for (int i = 0; i < outArray.Length; i++)
- {
- if (!check(outArray[i]))
- {
- return false;
- }
- }
- return true;
- }
-
- public void Dispose()
- {
- outHandle.Free();
- }
- }
-
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetZeroVector256_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetZeroVector256_r.csproj
deleted file mode 100644
index 04c0698e12..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/SetZeroVector256_r.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize></Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetZeroVector256.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/StaticCast.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx/StaticCast.cs
deleted file mode 100644
index df076a82de..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/StaticCast.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- // that it is intentionally designed to be a struct type that meets
- // the generic constraint but is not supported by any intrinsics
- struct Num
- {
- public int a;
- }
-
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Avx.IsSupported)
- {
- using (TestTable<float, int> floatTable = new TestTable<float, int>(new float[8] { 1, float.NaN, float.PositiveInfinity, float.NegativeInfinity, float.NegativeInfinity, float.PositiveInfinity, float.NaN, 1 }, new int[8]))
- {
- var vf1 = Unsafe.Read<Vector256<float>>(floatTable.inArrayPtr);
- var vf2 = Avx.StaticCast<float, int>(vf1);
- Unsafe.Write(floatTable.outArrayPtr, vf2);
-
- if (!floatTable.CheckResult((x, y) => BitConverter.SingleToInt32Bits(x) == y))
- {
- Console.WriteLine("Avx StaticCast failed on float:");
- foreach (var item in floatTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
-
- // the successful path is the one that catches the exception, so that does nothing,
- // it is the fall-through path that's the error path
- try
- {
- var v = Avx.StaticCast<float, Num>(vf1);
- Unsafe.Write(floatTable.outArrayPtr, v);
- Console.WriteLine("Avx StaticCast failed on target type test:");
- testResult = Fail;
- }
- catch (System.NotSupportedException)
- {
- }
-
- // the successful path is the one that catches the exception, so that does nothing,
- // it is the fall-through path that's the error path
- try
- {
- var v = TestSrcType();
- Unsafe.Write(floatTable.outArrayPtr, v);
- Console.WriteLine("Avx StaticCast failed on source type test:");
- testResult = Fail;
- }
- catch (System.NotSupportedException)
- {
- }
- }
- }
-
- return testResult;
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
- static Vector256<int> TestSrcType()
- {
- Vector256<Num> v1 = new Vector256<Num>();
- Vector256<Num> v2 = new Vector256<Num>();
- return Avx2.Add(Avx.StaticCast<Num, int>(v1), Avx.StaticCast<Num, int>(v2));
- }
-
- public unsafe struct TestTable<T, U> : IDisposable where T : struct where U : struct
- {
- public T[] inArray;
- public U[] outArray;
-
- public void* inArrayPtr => inHandle.AddrOfPinnedObject().ToPointer();
- public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
-
- GCHandle inHandle;
- GCHandle outHandle;
-
- public TestTable(T[] a, U[] b)
- {
- this.inArray = a;
- this.outArray = b;
-
- inHandle = GCHandle.Alloc(inArray, GCHandleType.Pinned);
- outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
- }
-
- public bool CheckResult(Func<T, U, bool> check)
- {
- for (int i = 0; i < inArray.Length; i++)
- {
- if (!check(inArray[i], outArray[i]))
- {
- return false;
- }
- }
- return true;
- }
-
- public void Dispose()
- {
- inHandle.Free();
- outHandle.Free();
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/StaticCast_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/StaticCast_r.csproj
deleted file mode 100644
index 6e4d20a77b..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/StaticCast_r.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize></Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="StaticCast.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx/StaticCast_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx/StaticCast_ro.csproj
deleted file mode 100644
index b3956c20eb..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx/StaticCast_ro.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize>True</Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="StaticCast.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_r.csproj
index 19a7281662..aba9c568d2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_r.csproj
@@ -129,7 +129,6 @@
<Compile Include="CompareGreaterThan.Int32.cs" />
<Compile Include="CompareGreaterThan.Int64.cs" />
<Compile Include="CompareGreaterThan.SByte.cs" />
- <Compile Include="ConvertToDouble.Double.cs" />
<Compile Include="ConvertToInt32.Int32.cs" />
<Compile Include="ConvertToUInt32.UInt32.cs" />
<Compile Include="ExtractVector128.Byte.1.cs" />
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_ro.csproj
index f0b7fcf6d0..272749aaa9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Avx2_ro.csproj
@@ -129,7 +129,6 @@
<Compile Include="CompareGreaterThan.Int32.cs" />
<Compile Include="CompareGreaterThan.Int64.cs" />
<Compile Include="CompareGreaterThan.SByte.cs" />
- <Compile Include="ConvertToDouble.Double.cs" />
<Compile Include="ConvertToInt32.Int32.cs" />
<Compile Include="ConvertToUInt32.UInt32.cs" />
<Compile Include="ExtractVector128.Byte.1.cs" />
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToDouble.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToDouble.Double.cs
deleted file mode 100644
index 8f000e3775..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/ConvertToDouble.Double.cs
+++ /dev/null
@@ -1,341 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ConvertToDoubleDouble()
- {
- var test = new SimdScalarUnaryOpTest__ConvertToDoubleDouble();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Avx.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class SimdScalarUnaryOpTest__ConvertToDoubleDouble
- {
- private struct TestStruct
- {
- public Vector256<Double> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref testStruct._fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(SimdScalarUnaryOpTest__ConvertToDoubleDouble testClass)
- {
- var result = Avx2.ConvertToDouble(_fld);
- testClass.ValidateResult(_fld, result);
- }
- }
-
- private static readonly int LargestVectorSize = 32;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
-
- private static Double[] _data = new Double[Op1ElementCount];
-
- private static Vector256<Double> _clsVar;
-
- private Vector256<Double> _fld;
-
- private SimdScalarUnaryOpTest__DataTable<Double> _dataTable;
-
- static SimdScalarUnaryOpTest__ConvertToDoubleDouble()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
- }
-
- public SimdScalarUnaryOpTest__ConvertToDoubleDouble()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
- _dataTable = new SimdScalarUnaryOpTest__DataTable<Double>(_data, LargestVectorSize);
- }
-
- public bool IsSupported => Avx2.IsSupported;
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Avx2.ConvertToDouble(
- Unsafe.Read<Vector256<Double>>(_dataTable.inArrayPtr)
- );
-
- ValidateResult(_dataTable.inArrayPtr, result);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Avx2.ConvertToDouble(
- Avx.LoadVector256((Double*)(_dataTable.inArrayPtr))
- );
-
- ValidateResult(_dataTable.inArrayPtr, result);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Avx2.ConvertToDouble(
- Avx.LoadAlignedVector256((Double*)(_dataTable.inArrayPtr))
- );
-
- ValidateResult(_dataTable.inArrayPtr, result);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToDouble), new Type[] { typeof(Vector256<Double>) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector256<Double>>(_dataTable.inArrayPtr)
- });
-
- ValidateResult(_dataTable.inArrayPtr, (Double)(result));
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToDouble), new Type[] { typeof(Vector256<Double>) })
- .Invoke(null, new object[] {
- Avx.LoadVector256((Double*)(_dataTable.inArrayPtr))
- });
-
- ValidateResult(_dataTable.inArrayPtr, (Double)(result));
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Avx2).GetMethod(nameof(Avx2.ConvertToDouble), new Type[] { typeof(Vector256<Double>) })
- .Invoke(null, new object[] {
- Avx.LoadAlignedVector256((Double*)(_dataTable.inArrayPtr))
- });
-
- ValidateResult(_dataTable.inArrayPtr, (Double)(result));
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Avx2.ConvertToDouble(
- _clsVar
- );
-
- ValidateResult(_clsVar, result);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector256<Double>>(_dataTable.inArrayPtr);
- var result = Avx2.ConvertToDouble(firstOp);
-
- ValidateResult(firstOp, result);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Avx.LoadVector256((Double*)(_dataTable.inArrayPtr));
- var result = Avx2.ConvertToDouble(firstOp);
-
- ValidateResult(firstOp, result);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Avx.LoadAlignedVector256((Double*)(_dataTable.inArrayPtr));
- var result = Avx2.ConvertToDouble(firstOp);
-
- ValidateResult(firstOp, result);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new SimdScalarUnaryOpTest__ConvertToDoubleDouble();
- var result = Avx2.ConvertToDouble(test._fld);
-
- ValidateResult(test._fld, result);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Avx2.ConvertToDouble(_fld);
-
- ValidateResult(_fld, result);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Avx2.ConvertToDouble(test._fld);
-
- ValidateResult(test._fld, result);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector256<Double> firstOp, Double result, [CallerMemberName] string method = "")
- {
- Double[] inArray = new Double[Op1ElementCount];
- Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
- ValidateResult(inArray, result, method);
- }
-
- private void ValidateResult(void* firstOp, Double result, [CallerMemberName] string method = "")
- {
- Double[] inArray = new Double[Op1ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector256<Double>>());
- ValidateResult(inArray, result, method);
- }
-
- private void ValidateResult(Double[] firstOp, Double result, [CallerMemberName] string method = "")
- {
- if (BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Avx2)}.{nameof(Avx2.ConvertToDouble)}<Double>(Vector256<Double>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: result");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/GatherMaskVector128.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/GatherMaskVector128.cs
index b1a8023dee..c4686df665 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/GatherMaskVector128.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/GatherMaskVector128.cs
@@ -80,18 +80,18 @@ namespace IntelHardwareIntrinsicTest
maski = Sse2.LoadVector128(iptr);
maskl = Sse2.LoadVector128(lptr);
- maskui = Sse.StaticCast<int, uint>(maski);
- maskul = Sse.StaticCast<long, ulong>(maskl);
- maskf = Sse.StaticCast<int, float>(maski);
- maskd = Sse.StaticCast<long, double>(maskl);
+ maskui = maski.AsUInt32();
+ maskul = maskl.AsUInt64();
+ maskf = maski.AsSingle();
+ maskd = maskl.AsDouble();
}
- Vector128<int> sourcei = Sse2.SetZeroVector128<int>();
- Vector128<uint> sourceui = Sse2.SetZeroVector128<uint>();
- Vector128<long> sourcel = Sse2.SetZeroVector128<long>();
- Vector128<ulong> sourceul = Sse2.SetZeroVector128<ulong>();
- Vector128<float> sourcef = Sse.SetZeroVector128();
- Vector128<double> sourced = Sse2.SetZeroVector128<double>();
+ Vector128<int> sourcei = Vector128<int>.Zero;
+ Vector128<uint> sourceui = Vector128<uint>.Zero;
+ Vector128<long> sourcel = Vector128<long>.Zero;
+ Vector128<ulong> sourceul = Vector128<ulong>.Zero;
+ Vector128<float> sourcef = Vector128<float>.Zero;
+ Vector128<double> sourced = Vector128<double>.Zero;
// public static unsafe Vector128<float> GatherMaskVector128(Vector128<float> source, float* baseAddress, Vector128<int> index, Vector128<float> mask, byte scale)
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/GatherMaskVector256.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/GatherMaskVector256.cs
index 551860cf63..b7dc173a42 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/GatherMaskVector256.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/GatherMaskVector256.cs
@@ -80,18 +80,18 @@ namespace IntelHardwareIntrinsicTest
maski = Avx.LoadVector256(iptr);
maskl = Avx.LoadVector256(lptr);
- maskui = Avx.StaticCast<int, uint>(maski);
- maskul = Avx.StaticCast<long, ulong>(maskl);
- maskf = Avx.StaticCast<int, float>(maski);
- maskd = Avx.StaticCast<long, double>(maskl);
+ maskui = maski.AsUInt32();
+ maskul = maskl.AsUInt64();
+ maskf = maski.AsSingle();
+ maskd = maskl.AsDouble();
}
- Vector256<int> sourcei = Avx.SetZeroVector256<int>();
- Vector256<uint> sourceui = Avx.SetZeroVector256<uint>();
- Vector256<long> sourcel = Avx.SetZeroVector256<long>();
- Vector256<ulong> sourceul = Avx.SetZeroVector256<ulong>();
- Vector256<float> sourcef = Avx.SetZeroVector256<float>();
- Vector256<double> sourced = Avx.SetZeroVector256<double>();
+ Vector256<int> sourcei = Vector256<int>.Zero;
+ Vector256<uint> sourceui = Vector256<uint>.Zero;
+ Vector256<long> sourcel = Vector256<long>.Zero;
+ Vector256<ulong> sourceul = Vector256<ulong>.Zero;
+ Vector256<float> sourcef = Vector256<float>.Zero;
+ Vector256<double> sourced = Vector256<double>.Zero;
// public static unsafe Vector256<float> GatherMaskVector256(Vector256<float> source, float* baseAddress, Vector256<int> index, Vector256<float> mask, byte scale)
using (TestTable<float, int> floatTable = new TestTable<float, int>(floatSourceTable, new float[8]))
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.Avx2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.Avx2.cs
index 85ffe56d3a..b52e89f063 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.Avx2.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Avx2/Program.Avx2.cs
@@ -114,7 +114,6 @@ namespace JIT.HardwareIntrinsics.X86
["CompareGreaterThan.Int32"] = CompareGreaterThanInt32,
["CompareGreaterThan.Int64"] = CompareGreaterThanInt64,
["CompareGreaterThan.SByte"] = CompareGreaterThanSByte,
- ["ConvertToDouble.Double"] = ConvertToDoubleDouble,
["ConvertToInt32.Int32"] = ConvertToInt32Int32,
["ConvertToUInt32.UInt32"] = ConvertToUInt32UInt32,
["ExtractVector128.Byte.1"] = ExtractVector128Byte1,
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/General/VectorArgs.cs b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorArgs.cs
index 84832cfad3..a720cb8b76 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/General/VectorArgs.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorArgs.cs
@@ -37,7 +37,7 @@ internal partial class IntelHardwareIntrinsicTest
public VectorArg128 Change(float f)
{
- Vector128<float> t = Sse.SetAllVector128(f);
+ Vector128<float> t = Vector128.Create(f);
return new VectorArg128(Sse.Add(t, _rgb));
}
@@ -66,7 +66,7 @@ internal partial class IntelHardwareIntrinsicTest
public VectorArg256 Change(float f)
{
- Vector256<float> t = Avx.SetAllVector256(f);
+ Vector256<float> t = Vector256.Create(f);
return new VectorArg256(Avx.Add(t, _rgb));
}
@@ -79,7 +79,7 @@ internal partial class IntelHardwareIntrinsicTest
if (Sse41.IsSupported)
{
- Vector128<float> rgb = Sse.SetVector128(0, 1, 2, 3);
+ Vector128<float> rgb = Vector128.Create(3f, 2f, 1f, 0f);
float x = 2f;
VectorArg128 c1 = new VectorArg128(rgb);
VectorArg128 c2 = c1.Change(x);
@@ -94,7 +94,7 @@ internal partial class IntelHardwareIntrinsicTest
if (Avx.IsSupported)
{
- Vector256<float> rgb = Avx.SetVector256(0f, 1f, 2f, 3f, 4f, 5f, 6f, 7f);
+ Vector256<float> rgb = Vector256.Create(7f, 6f, 5f, 4f, 3f, 2f, 1f, 0f);
float x = 2f;
VectorArg256 c1 = new VectorArg256(rgb);
VectorArg256 c2 = c1.Change(x);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/General/VectorArray.cs b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorArray.cs
index 12bc7c1a11..c88a5fe1b2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/General/VectorArray.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorArray.cs
@@ -35,9 +35,9 @@ internal partial class IntelHardwareIntrinsicTest
int elementCount = vectorSize / elementSize;
for (int i = 0; i < v.Length; ++i)
- v[i] = SetAllVector128<T>(GetValueFromInt<T>(i + 1));
+ v[i] = CreateVector128<T>(GetValueFromInt<T>(i + 1));
- Vector128<T> delta = SetAllVector128<T>(GetValueFromInt<T>(1));
+ Vector128<T> delta = CreateVector128<T>(GetValueFromInt<T>(1));
Move(v, ref delta);
byte* buffer = stackalloc byte[vectorSize * v.Length];
@@ -75,9 +75,9 @@ internal partial class IntelHardwareIntrinsicTest
int elementCount = vectorSize / elementSize;
for (int i = 0; i < v.Length; ++i)
- v[i] = Avx.SetAllVector256<T>((T)Convert.ChangeType(i + 1, typeof(T)));
+ v[i] = CreateVector256<T>((T)Convert.ChangeType(i + 1, typeof(T)));
- Vector256<T> delta = Avx.SetAllVector256((T)Convert.ChangeType(1, typeof(T)));
+ Vector256<T> delta = CreateVector256((T)Convert.ChangeType(1, typeof(T)));
Move(v, ref delta);
byte* buffer = stackalloc byte[vectorSize * v.Length];
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/General/VectorHelpers.cs b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorHelpers.cs
index d06fcf9385..d4e193e715 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/General/VectorHelpers.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorHelpers.cs
@@ -15,43 +15,43 @@ internal partial class IntelHardwareIntrinsicTest
{
if (typeof(T) == typeof(byte))
{
- return Sse.StaticCast<byte, T>(Sse2.Add(Sse.StaticCast<T, byte>(left), Sse.StaticCast<T, byte>(right)));
+ return Sse2.Add(left.AsByte(), right.AsByte()).As<T>();
}
else if (typeof(T) == typeof(sbyte))
{
- return Sse.StaticCast<sbyte, T>(Sse2.Add(Sse.StaticCast<T, sbyte>(left), Sse.StaticCast<T, sbyte>(right)));
+ return Sse2.Add(left.AsSByte(), right.AsSByte()).As<T>();
}
else if (typeof(T) == typeof(short))
{
- return Sse.StaticCast<short, T>(Sse2.Add(Sse.StaticCast<T, short>(left), Sse.StaticCast<T, short>(right)));
+ return Sse2.Add(left.AsInt16(), right.AsInt16()).As<T>();
}
else if (typeof(T) == typeof(ushort))
{
- return Sse.StaticCast<ushort, T>(Sse2.Add(Sse.StaticCast<T, ushort>(left), Sse.StaticCast<T, ushort>(right)));
+ return Sse2.Add(left.AsUInt16(), right.AsUInt16()).As<T>();
}
else if (typeof(T) == typeof(int))
{
- return Sse.StaticCast<int, T>(Sse2.Add(Sse.StaticCast<T, int>(left), Sse.StaticCast<T, int>(right)));
+ return Sse2.Add(left.AsInt32(), right.AsInt32()).As<T>();
}
else if (typeof(T) == typeof(uint))
{
- return Sse.StaticCast<uint, T>(Sse2.Add(Sse.StaticCast<T, uint>(left), Sse.StaticCast<T, uint>(right)));
+ return Sse2.Add(left.AsUInt32(), right.AsUInt32()).As<T>();
}
else if (typeof(T) == typeof(long))
{
- return Sse.StaticCast<long, T>(Sse2.Add(Sse.StaticCast<T, long>(left), Sse.StaticCast<T, long>(right)));
+ return Sse2.Add(left.AsInt64(), right.AsInt64()).As<T>();
}
else if (typeof(T) == typeof(ulong))
{
- return Sse.StaticCast<ulong, T>(Sse2.Add(Sse.StaticCast<T, ulong>(left), Sse.StaticCast<T, ulong>(right)));
+ return Sse2.Add(left.AsUInt64(), right.AsUInt64()).As<T>();
}
else if (typeof(T) == typeof(float))
{
- return Sse.StaticCast<float, T>(Sse.Add(Sse.StaticCast<T, float>(left), Sse.StaticCast<T, float>(right)));
+ return Sse.Add(left.AsSingle(), right.AsSingle()).As<T>();
}
else if (typeof(T) == typeof(double))
{
- return Sse.StaticCast<double, T>(Sse2.Add(Sse.StaticCast<T, double>(left), Sse.StaticCast<T, double>(right)));
+ return Sse2.Add(left.AsDouble(), right.AsDouble()).As<T>();
}
else
{
@@ -63,43 +63,43 @@ internal partial class IntelHardwareIntrinsicTest
{
if (typeof(T) == typeof(byte))
{
- return Avx.StaticCast<byte, T>(Avx2.Add(Avx.StaticCast<T, byte>(left), Avx.StaticCast<T, byte>(right)));
+ return Avx2.Add(left.AsByte(), right.AsByte()).As<T>();
}
else if (typeof(T) == typeof(sbyte))
{
- return Avx.StaticCast<sbyte, T>(Avx2.Add(Avx.StaticCast<T, sbyte>(left), Avx.StaticCast<T, sbyte>(right)));
+ return Avx2.Add(left.AsSByte(), right.AsSByte()).As<T>();
}
else if (typeof(T) == typeof(short))
{
- return Avx.StaticCast<short, T>(Avx2.Add(Avx.StaticCast<T, short>(left), Avx.StaticCast<T, short>(right)));
+ return Avx2.Add(left.AsInt16(), right.AsInt16()).As<T>();
}
else if (typeof(T) == typeof(ushort))
{
- return Avx.StaticCast<ushort, T>(Avx2.Add(Avx.StaticCast<T, ushort>(left), Avx.StaticCast<T, ushort>(right)));
+ return Avx2.Add(left.AsUInt16(), right.AsUInt16()).As<T>();
}
else if (typeof(T) == typeof(int))
{
- return Avx.StaticCast<int, T>(Avx2.Add(Avx.StaticCast<T, int>(left), Avx.StaticCast<T, int>(right)));
+ return Avx2.Add(left.AsInt32(), right.AsInt32()).As<T>();
}
else if (typeof(T) == typeof(uint))
{
- return Avx.StaticCast<uint, T>(Avx2.Add(Avx.StaticCast<T, uint>(left), Avx.StaticCast<T, uint>(right)));
+ return Avx2.Add(left.AsUInt32(), right.AsUInt32()).As<T>();
}
else if (typeof(T) == typeof(long))
{
- return Avx.StaticCast<long, T>(Avx2.Add(Avx.StaticCast<T, long>(left), Avx.StaticCast<T, long>(right)));
+ return Avx2.Add(left.AsInt64(), right.AsInt64()).As<T>();
}
else if (typeof(T) == typeof(ulong))
{
- return Avx.StaticCast<ulong, T>(Avx2.Add(Avx.StaticCast<T, ulong>(left), Avx.StaticCast<T, ulong>(right)));
+ return Avx2.Add(left.AsUInt64(), right.AsUInt64()).As<T>();
}
else if (typeof(T) == typeof(float))
{
- return Avx.StaticCast<float, T>(Avx.Add(Avx.StaticCast<T, float>(left), Avx.StaticCast<T, float>(right)));
+ return Avx.Add(left.AsSingle(), right.AsSingle()).As<T>();
}
else if (typeof(T) == typeof(double))
{
- return Avx.StaticCast<double, T>(Avx.Add(Avx.StaticCast<T, double>(left), Avx.StaticCast<T, double>(right)));
+ return Avx.Add(left.AsDouble(), right.AsDouble()).As<T>();
}
else
{
@@ -107,47 +107,47 @@ internal partial class IntelHardwareIntrinsicTest
}
}
- public static Vector128<T> SetAllVector128<T>(T value) where T : struct
+ public static Vector128<T> CreateVector128<T>(T value) where T : struct
{
if (typeof(T) == typeof(byte))
{
- return Sse.StaticCast<byte, T>(Sse2.SetAllVector128(Convert.ToByte(value)));
+ return Vector128.Create(Convert.ToByte(value)).As<T>();
}
else if (typeof(T) == typeof(sbyte))
{
- return Sse.StaticCast<sbyte, T>(Sse2.SetAllVector128(Convert.ToSByte(value)));
+ return Vector128.Create(Convert.ToSByte(value)).As<T>();
}
else if (typeof(T) == typeof(short))
{
- return Sse.StaticCast<short, T>(Sse2.SetAllVector128(Convert.ToInt16(value)));
+ return Vector128.Create(Convert.ToInt16(value)).As<T>();
}
else if (typeof(T) == typeof(ushort))
{
- return Sse.StaticCast<ushort, T>(Sse2.SetAllVector128(Convert.ToUInt16(value)));
+ return Vector128.Create(Convert.ToUInt16(value)).As<T>();
}
else if (typeof(T) == typeof(int))
{
- return Sse.StaticCast<int, T>(Sse2.SetAllVector128(Convert.ToInt32(value)));
+ return Vector128.Create(Convert.ToInt32(value)).As<T>();
}
else if (typeof(T) == typeof(uint))
{
- return Sse.StaticCast<uint, T>(Sse2.SetAllVector128(Convert.ToUInt32(value)));
+ return Vector128.Create(Convert.ToUInt32(value)).As<T>();
}
else if (typeof(T) == typeof(long))
{
- return Sse.StaticCast<long, T>(Sse2.SetAllVector128(Convert.ToInt64(value)));
+ return Vector128.Create(Convert.ToInt64(value)).As<T>();
}
else if (typeof(T) == typeof(ulong))
{
- return Sse.StaticCast<ulong, T>(Sse2.SetAllVector128(Convert.ToUInt64(value)));
+ return Vector128.Create(Convert.ToUInt64(value)).As<T>();
}
else if (typeof(T) == typeof(float))
{
- return Sse.StaticCast<float, T>(Sse.SetAllVector128(Convert.ToSingle(value)));
+ return Vector128.Create(Convert.ToSingle(value)).As<T>();
}
else if (typeof(T) == typeof(double))
{
- return Sse.StaticCast<double, T>(Sse2.SetAllVector128(Convert.ToDouble(value)));
+ return Vector128.Create(Convert.ToDouble(value)).As<T>();
}
else
{
@@ -155,27 +155,47 @@ internal partial class IntelHardwareIntrinsicTest
}
}
- // These two helper functions are a workaround for the bug of Sse2.SetZeroVector128<float>
- // https://github.com/dotnet/coreclr/pull/17691
- public static Vector128<T> SetZeroVector128<T>() where T : struct
+ public static Vector256<T> CreateVector256<T>(T value) where T : struct
{
- if (typeof(T) == typeof(float))
+ if (typeof(T) == typeof(byte))
{
- return Sse.StaticCast<float, T>(Sse.SetZeroVector128());
+ return Vector256.Create(Convert.ToByte(value)).As<T>();
}
- else
+ else if (typeof(T) == typeof(sbyte))
{
- return Sse2SetZeroVector128<T>();
+ return Vector256.Create(Convert.ToSByte(value)).As<T>();
}
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
- private static Vector128<T> Sse2SetZeroVector128<T>() where T : struct
- {
- if (typeof(T) == typeof(double) || typeof(T) == typeof(byte) || typeof(T) == typeof(sbyte) || typeof(T) == typeof(short) ||
- typeof(T) == typeof(ushort) || typeof(T) == typeof(int) || typeof(T) == typeof(uint) || typeof(T) == typeof(long) || typeof(T) == typeof(ulong))
+ else if (typeof(T) == typeof(short))
+ {
+ return Vector256.Create(Convert.ToInt16(value)).As<T>();
+ }
+ else if (typeof(T) == typeof(ushort))
+ {
+ return Vector256.Create(Convert.ToUInt16(value)).As<T>();
+ }
+ else if (typeof(T) == typeof(int))
+ {
+ return Vector256.Create(Convert.ToInt32(value)).As<T>();
+ }
+ else if (typeof(T) == typeof(uint))
+ {
+ return Vector256.Create(Convert.ToUInt32(value)).As<T>();
+ }
+ else if (typeof(T) == typeof(long))
+ {
+ return Vector256.Create(Convert.ToInt64(value)).As<T>();
+ }
+ else if (typeof(T) == typeof(ulong))
+ {
+ return Vector256.Create(Convert.ToUInt64(value)).As<T>();
+ }
+ else if (typeof(T) == typeof(float))
+ {
+ return Vector256.Create(Convert.ToSingle(value)).As<T>();
+ }
+ else if (typeof(T) == typeof(double))
{
- return Sse2.SetZeroVector128<T>();
+ return Vector256.Create(Convert.ToDouble(value)).As<T>();
}
else
{
@@ -264,4 +284,4 @@ internal partial class IntelHardwareIntrinsicTest
throw new ArgumentException();
}
}
-} \ No newline at end of file
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet.cs b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet.cs
index 0eb1218795..c9d927b22e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorRet.cs
@@ -50,12 +50,12 @@ internal partial class IntelHardwareIntrinsicTest
s_v128_array = new Vector128<float>[10];
for (int i = 0; i < 10; i++)
{
- s_v128_array[i] = Sse.SetAllVector128(random.Next(100));
+ s_v128_array[i] = Vector128.Create((float)random.Next(100));
}
- s_v128_0 = Sse.SetAllVector128((float)random.Next(100));
- s_v128_1 = Sse.SetAllVector128((float)random.Next(100));
- s_v128_2 = Sse.SetAllVector128((float)random.Next(100));
- s_v128_3 = Sse.SetAllVector128((float)random.Next(100));
+ s_v128_0 = Vector128.Create((float)random.Next(100));
+ s_v128_1 = Vector128.Create((float)random.Next(100));
+ s_v128_2 = Vector128.Create((float)random.Next(100));
+ s_v128_3 = Vector128.Create((float)random.Next(100));
}
if (Sse2.IsSupported)
@@ -63,12 +63,12 @@ internal partial class IntelHardwareIntrinsicTest
s_v128i_array = new Vector128<short>[10];
for (int i = 0; i < 10; i++)
{
- s_v128i_array[i] = Sse2.SetAllVector128((short)random.Next(100));
+ s_v128i_array[i] = Vector128.Create((short)random.Next(100));
}
- s_v128i_0 = Sse2.SetAllVector128((short)random.Next(100));
- s_v128i_1 = Sse2.SetAllVector128((short)random.Next(100));
- s_v128i_2 = Sse2.SetAllVector128((short)random.Next(100));
- s_v128i_3 = Sse2.SetAllVector128((short)random.Next(100));
+ s_v128i_0 = Vector128.Create((short)random.Next(100));
+ s_v128i_1 = Vector128.Create((short)random.Next(100));
+ s_v128i_2 = Vector128.Create((short)random.Next(100));
+ s_v128i_3 = Vector128.Create((short)random.Next(100));
}
if (Avx.IsSupported)
@@ -76,12 +76,12 @@ internal partial class IntelHardwareIntrinsicTest
s_v256_array = new Vector256<float>[10];
for (int i = 0; i < 10; i++)
{
- s_v256_array[i] = Avx.SetAllVector256((float)random.Next(100));
+ s_v256_array[i] = Vector256.Create((float)random.Next(100));
}
- s_v256_0 = Avx.SetAllVector256((float)random.Next(100));
- s_v256_1 = Avx.SetAllVector256((float)random.Next(100));
- s_v256_2 = Avx.SetAllVector256((float)random.Next(100));
- s_v256_3 = Avx.SetAllVector256((float)random.Next(100));
+ s_v256_0 = Vector256.Create((float)random.Next(100));
+ s_v256_1 = Vector256.Create((float)random.Next(100));
+ s_v256_2 = Vector256.Create((float)random.Next(100));
+ s_v256_3 = Vector256.Create((float)random.Next(100));
}
if (Avx2.IsSupported)
@@ -89,12 +89,12 @@ internal partial class IntelHardwareIntrinsicTest
s_v256i_array = new Vector256<byte>[10];
for (int i = 0; i < 10; i++)
{
- s_v256i_array[i] = Avx.SetAllVector256((byte)random.Next(100));
+ s_v256i_array[i] = Vector256.Create((byte)random.Next(100));
}
- s_v256i_0 = Avx.SetAllVector256((byte)random.Next(100));
- s_v256i_1 = Avx.SetAllVector256((byte)random.Next(100));
- s_v256i_2 = Avx.SetAllVector256((byte)random.Next(100));
- s_v256i_3 = Avx.SetAllVector256((byte)random.Next(100));
+ s_v256i_0 = Vector256.Create((byte)random.Next(100));
+ s_v256i_1 = Vector256.Create((byte)random.Next(100));
+ s_v256i_2 = Vector256.Create((byte)random.Next(100));
+ s_v256i_3 = Vector256.Create((byte)random.Next(100));
}
}
@@ -106,8 +106,8 @@ internal partial class IntelHardwareIntrinsicTest
float t1 = 3 * ti * ti * t;
float t2 = 3 * ti * t * t;
float t3 = t * t * t;
- Vector128<float> tmp1 = Sse.Add(Sse.Subtract(Sse.SetAllVector128(t0), s_v128_0), Sse.Subtract(Sse.SetAllVector128(t1), s_v128_1));
- Vector128<float> tmp2 = Sse.Add(Sse.Subtract(Sse.SetAllVector128(t2), s_v128_2), Sse.Subtract(Sse.SetAllVector128(t3), s_v128_3));
+ Vector128<float> tmp1 = Sse.Add(Sse.Subtract(Vector128.Create(t0), s_v128_0), Sse.Subtract(Vector128.Create(t1), s_v128_1));
+ Vector128<float> tmp2 = Sse.Add(Sse.Subtract(Vector128.Create(t2), s_v128_2), Sse.Subtract(Vector128.Create(t3), s_v128_3));
return Sse.Add(tmp1, tmp2);
}
@@ -133,8 +133,8 @@ internal partial class IntelHardwareIntrinsicTest
int t1 = 3 * ti * ti * t;
int t2 = 3 * ti * t * t;
int t3 = t * t * t;
- Vector128<short> tmp1 = Sse2.Add(Sse2.Subtract(Sse2.SetAllVector128((short)t0), s_v128i_0), Sse2.Subtract(Sse2.SetAllVector128((short)t1), s_v128i_1));
- Vector128<short> tmp2 = Sse2.Add(Sse2.Subtract(Sse2.SetAllVector128((short)t2), s_v128i_2), Sse2.Subtract(Sse2.SetAllVector128((short)t3), s_v128i_3));
+ Vector128<short> tmp1 = Sse2.Add(Sse2.Subtract(Vector128.Create((short)t0), s_v128i_0), Sse2.Subtract(Vector128.Create((short)t1), s_v128i_1));
+ Vector128<short> tmp2 = Sse2.Add(Sse2.Subtract(Vector128.Create((short)t2), s_v128i_2), Sse2.Subtract(Vector128.Create((short)t3), s_v128i_3));
return Sse2.Add(tmp1, tmp2);
}
@@ -160,8 +160,8 @@ internal partial class IntelHardwareIntrinsicTest
float t1 = 3 * ti * ti * t;
float t2 = 3 * ti * t * t;
float t3 = t * t * t;
- Vector256<float> tmp1 = Avx.Add(Avx.Subtract(Avx.SetAllVector256(t0), s_v256_0), Avx.Subtract(Avx.SetAllVector256(t1), s_v256_1));
- Vector256<float> tmp2 = Avx.Add(Avx.Subtract(Avx.SetAllVector256(t2), s_v256_2), Avx.Subtract(Avx.SetAllVector256(t3), s_v256_3));
+ Vector256<float> tmp1 = Avx.Add(Avx.Subtract(Vector256.Create(t0), s_v256_0), Avx.Subtract(Vector256.Create(t1), s_v256_1));
+ Vector256<float> tmp2 = Avx.Add(Avx.Subtract(Vector256.Create(t2), s_v256_2), Avx.Subtract(Vector256.Create(t3), s_v256_3));
return Avx.Add(tmp1, tmp2);
}
@@ -187,8 +187,8 @@ internal partial class IntelHardwareIntrinsicTest
int t1 = 3 * ti * ti * t;
int t2 = 3 * ti * t * t;
int t3 = t * t * t;
- Vector256<byte> tmp1 = Avx2.Add(Avx2.Subtract(Avx.SetAllVector256((byte)t0), s_v256i_0), Avx2.Subtract(Avx.SetAllVector256((byte)t1), s_v256i_1));
- Vector256<byte> tmp2 = Avx2.Add(Avx2.Subtract(Avx.SetAllVector256((byte)t2), s_v256i_2), Avx2.Subtract(Avx.SetAllVector256((byte)t3), s_v256i_3));
+ Vector256<byte> tmp1 = Avx2.Add(Avx2.Subtract(Vector256.Create((byte)t0), s_v256i_0), Avx2.Subtract(Vector256.Create((byte)t1), s_v256i_1));
+ Vector256<byte> tmp2 = Avx2.Add(Avx2.Subtract(Vector256.Create((byte)t2), s_v256i_2), Avx2.Subtract(Vector256.Create((byte)t3), s_v256i_3));
return Avx2.Add(tmp1, tmp2);
}
@@ -209,13 +209,13 @@ internal partial class IntelHardwareIntrinsicTest
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static Vector128<T> Vector128One<T>() where T : struct
{
- return SetAllVector128(GetValueFromInt<T>(1));
+ return CreateVector128(GetValueFromInt<T>(1));
}
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static Vector256<T> Vector256One<T>() where T : struct
{
- return Avx.SetAllVector256(GetValueFromInt<T>(1));
+ return CreateVector256(GetValueFromInt<T>(1));
}
[MethodImplAttribute(MethodImplOptions.NoInlining)]
@@ -234,7 +234,7 @@ internal partial class IntelHardwareIntrinsicTest
public static unsafe int Vector128ReturnTest()
{
- Vector128<float> v1 = Sse.SetAllVector128(2.0f);
+ Vector128<float> v1 = Vector128.Create(2.0f);
Vector128<float> vres1 = Vector128PlusOne<float>(v1);
float* result1 = stackalloc float[4];
@@ -252,7 +252,7 @@ internal partial class IntelHardwareIntrinsicTest
}
- Vector128<int> v2 = Sse2.SetAllVector128((int)5);
+ Vector128<int> v2 = Vector128.Create((int)5);
Vector128<int> vres2 = Vector128PlusOne<int>(v2);
int* result2 = stackalloc int[4];
@@ -275,7 +275,7 @@ internal partial class IntelHardwareIntrinsicTest
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static Vector128<short> GetVector128Int16One()
{
- return Sse2.SetAllVector128((short)1);
+ return Vector128.Create((short)1);
}
[MethodImplAttribute(MethodImplOptions.NoInlining)]
@@ -287,7 +287,7 @@ internal partial class IntelHardwareIntrinsicTest
public static unsafe int Vector128Int16ReturnTest()
{
- Vector128<short> v1 = Sse2.SetVector128(10, 9, 8, 7, 6, 5, 4, 3);
+ Vector128<short> v1 = Vector128.Create(3, 4, 5, 6, 7, 8, 9, 10);
Vector128<short> vres = GetVector128Int16PlusOne(v1);
short* result = stackalloc short[8];
@@ -311,7 +311,7 @@ internal partial class IntelHardwareIntrinsicTest
public static unsafe int Vector256ReturnTest()
{
- Vector256<float> v1 = Avx.SetAllVector256(2.0f);
+ Vector256<float> v1 = Vector256.Create(2.0f);
Vector256<float> vres1 = Vector256PlusOne<float>(v1);
float* result1 = stackalloc float[8];
@@ -329,7 +329,7 @@ internal partial class IntelHardwareIntrinsicTest
}
- Vector256<int> v2 = Avx.SetAllVector256((int)5);
+ Vector256<int> v2 = Vector256.Create((int)5);
Vector256<int> vres2 = Vector256PlusOne<int>(v2);
int* result2 = stackalloc int[8];
@@ -352,7 +352,7 @@ internal partial class IntelHardwareIntrinsicTest
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static Vector256<int> GetVector256Int32One()
{
- return Avx.SetAllVector256(1);
+ return Vector256.Create(1);
}
[MethodImplAttribute(MethodImplOptions.NoInlining)]
@@ -364,7 +364,7 @@ internal partial class IntelHardwareIntrinsicTest
public static unsafe int Vector256Int32ReturnTest()
{
- Vector256<int> v1 = Avx.SetVector256(10, 9, 8, 7, 6, 5, 4, 3);
+ Vector256<int> v1 = Vector256.Create(3, 4, 5, 6, 7, 8, 9, 10);
Vector256<int> vres = GetVector256Int32PlusOne(v1);
int* result = stackalloc int[8];
@@ -515,4 +515,4 @@ internal partial class IntelHardwareIntrinsicTest
Console.WriteLine("PASSED");
return Pass;
}
-} \ No newline at end of file
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/General/VectorUnused.cs b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorUnused.cs
index fe537c7184..223c54230d 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/General/VectorUnused.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/General/VectorUnused.cs
@@ -21,8 +21,8 @@ internal partial class IntelHardwareIntrinsicTest
{
if (Sse2.IsSupported)
{
- Vector128<T> v1 = SetAllVector128<T>(t1);
- v1 = Vector128Add<T>(v1, SetZeroVector128<T>());
+ Vector128<T> v1 = CreateVector128<T>(t1);
+ v1 = Vector128Add<T>(v1, Vector128<T>.Zero);
}
return Pass;
@@ -35,8 +35,8 @@ internal partial class IntelHardwareIntrinsicTest
{
if (Avx2.IsSupported)
{
- Vector256<T> v1 = Avx.SetAllVector256<T>(t1);
- v1 = Vector256Add<T>(v1, Avx.SetAllVector256<T>(t2));
+ Vector256<T> v1 = CreateVector256<T>(t1);
+ v1 = Vector256Add<T>(v1, CreateVector256<T>(t2));
}
return Pass;
}
@@ -75,4 +75,4 @@ internal partial class IntelHardwareIntrinsicTest
}
return returnVal;
}
-} \ No newline at end of file
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx b/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx
index e0f9f7662f..b555a3d686 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx
@@ -161,7 +161,6 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["NextValueOp2"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((!double.IsNaN(left[0]) && !double.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareUnordered", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["NextValueOp2"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((double.IsNaN(left[0]) || double.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != ((double.IsNaN(left[i]) || double.IsNaN(right[i])) ? -1 : 0)"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "CompareUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["NextValueOp2"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != ((double.IsNaN(left[0]) || double.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
- ("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToDouble", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result)"}),
("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToInt32", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "(int)Math.Round(firstOp[0]) != result"}),
("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToInt32", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "firstOp[0] != result"}),
("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToInt32WithTruncation", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "(int) firstOp[0] != result"}),
@@ -225,15 +224,6 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "PackSignedSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "result[0] != (short)Math.Min(Math.Max(left[0], short.MinValue), short.MaxValue)", ["ValidateRemainingResults"] = "result[i] != ((i < 4) ? (short)Math.Min(Math.Max(left[i], short.MinValue), short.MaxValue) : (short)Math.Min(Math.Max(right[i%4], short.MinValue), short.MaxValue))"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "PackSignedSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt16()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "result[0] != (sbyte)Math.Min(Math.Max(left[0], sbyte.MinValue), sbyte.MaxValue)", ["ValidateRemainingResults"] = "result[i] != ((i < 8) ? (sbyte)Math.Min(Math.Max(left[i], sbyte.MinValue), sbyte.MaxValue) : (sbyte)Math.Min(Math.Max(right[i%8], sbyte.MinValue), sbyte.MaxValue))"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "PackUnsignedSaturate", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt16()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "result[0] != (byte)Math.Min(Math.Max(left[0], byte.MinValue), byte.MaxValue)", ["ValidateRemainingResults"] = "result[i] != ((i < 8) ? (byte)Math.Min(Math.Max(left[i], byte.MinValue), byte.MaxValue) : (byte)Math.Min(Math.Max(right[i%8], byte.MinValue), byte.MaxValue))"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
- ("ScalarSimdUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "SetAllVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "result[0] != firstOp", ["ValidateRemainingResults"] = "result[i] != firstOp"}),
("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "(short)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(short)(firstOp[i] << 1) != result[i]"}),
("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "(ushort)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(ushort)(firstOp[i] << 1) != result[i]"}),
("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ShiftLeftLogical", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "(int)(firstOp[0] << 1) != result[0]", ["ValidateRemainingResults"] = "(int)(firstOp[i] << 1) != result[i]"}),
@@ -536,24 +526,6 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "DuplicateEvenIndexed", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "(i % 2 == 0) ? (BitConverter.DoubleToInt64Bits(firstOp[i]) != BitConverter.DoubleToInt64Bits(result[i])) : (BitConverter.DoubleToInt64Bits(firstOp[i - 1]) != BitConverter.DoubleToInt64Bits(result[i]))"}),
("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "DuplicateEvenIndexed", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(i % 2 == 0) ? (BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i])) : (BitConverter.SingleToInt32Bits(firstOp[i - 1]) != BitConverter.SingleToInt32Bits(result[i]))"}),
("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "DuplicateOddIndexed", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(firstOp[1]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(i % 2 == 0) ? (BitConverter.SingleToInt32Bits(firstOp[i + 1]) != BitConverter.SingleToInt32Bits(result[i])) : (BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i]))"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "20", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "(result[0] != firstOp[20])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "52", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "(result[0] != firstOp[20])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "11", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "(result[0] != firstOp[11])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Imm"] = "27", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "(result[0] != firstOp[11])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "6", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "(result[0] != firstOp[6])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "6", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "(result[0] != firstOp[6])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Imm"] = "22", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "(result[0] != firstOp[6])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Imm"] = "22", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "(result[0] != firstOp[6])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "3", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[3])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "3", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[3])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Imm"] = "19", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[3])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Extract", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "19", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[3])"}),
("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[4])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(firstOp[i+4])"}),
("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(firstOp[2])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(firstOp[i+2])"}),
("ImmUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "result[i] != firstOp[i+16]"}),
@@ -574,30 +546,6 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "result[0] != firstOp[2]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 2])"}),
("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[4])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(firstOp[i + 4]))"}),
("ExtractStoreTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(firstOp[2])", ["ValidateRemainingResults"] = "(BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(firstOp[i + 2]))"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Data"] = "(byte)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Data"] = "(byte)2", ["Imm"] = "20", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)0", ["ValidateFirstResult"] = "(i == 20 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "20", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)0", ["ValidateFirstResult"] = "(i == 20 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Byte", ["Data"] = "(byte)2", ["Imm"] = "52", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(byte)0", ["ValidateFirstResult"] = "(i == 20 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "52", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(sbyte)0", ["ValidateFirstResult"] = "(i == 20 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int16", ["Data"] = "(short)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int16", ["Data"] = "(short)2", ["Imm"] = "11", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)0", ["ValidateFirstResult"] = "(i == 11 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Data"] = "(ushort)2",["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Data"] = "(ushort)2",["Imm"] = "11", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)0", ["ValidateFirstResult"] = "(i == 11 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int16", ["Data"] = "(short)2", ["Imm"] = "27", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(short)0", ["ValidateFirstResult"] = "(i == 11 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt16", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt16", ["Data"] = "(ushort)2",["Imm"] = "27", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ushort)0", ["ValidateFirstResult"] = "(i == 11 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "6", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)0", ["ValidateFirstResult"] = "(i == 6 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "6", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)0", ["ValidateFirstResult"] = "(i == 6 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "22", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(int)0", ["ValidateFirstResult"] = "(i == 6 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "22", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(uint)0", ["ValidateFirstResult"] = "(i == 6 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "3", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)0", ["ValidateFirstResult"] = "(i == 3 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)0", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "3", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)0", ["ValidateFirstResult"] = "(i == 3 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "19", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(long)0", ["ValidateFirstResult"] = "(i == 3 ? result[i] != 2 : result[i] != 0)"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Insert", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector256", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "19", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "(ulong)0", ["ValidateFirstResult"] = "(i == 3 ? result[i] != 2 : result[i] != 0)"}),
("ImmBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["NextValueOp2"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "result[i] != (i < 16 ? left[i] : right[i-16])"}),
("ImmBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "SByte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetSByte()", ["NextValueOp2"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "result[i] != (i < 16 ? left[i] : right[i-16])"}),
("ImmBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int16", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetInt16()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "result[0] != left[0]", ["ValidateRemainingResults"] = "result[i] != (i < 8 ? left[i] : right[i-8])"}),
@@ -620,16 +568,6 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("InsertLoadTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "InsertVector128", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["NextValueOp2"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(left[0])", ["ValidateRemainingResults"] = "(i > 1 ? BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(right[i - 2]) : BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i]))"}),
("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Floor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[i]))"}),
("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "Floor", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[i]))"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetInt16()", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
- ("GenericUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["LoadIsa"] = "Avx", ["Method"] = "GetLowerHalf", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "result[i] != ((i < (Op1ElementCount / 2)) ? firstOp[i] : 0)"}),
("LoadUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["Method"] = "LoadVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
("LoadUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["Method"] = "LoadVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(firstOp[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
("LoadUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx", ["Method"] = "LoadVector256", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "firstOp[0] != result[0]", ["ValidateRemainingResults"] = "firstOp[i] != result[i]"}),
@@ -820,7 +758,6 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((int)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((int)(-1)) : 0)"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((long)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((long)(-1)) : 0)"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector256", ["RetBaseType"] = "SByte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "SByte", ["Op2VectorType"] = "Vector256", ["Op2BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetSByte()", ["NextValueOp2"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((sbyte)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((sbyte)(-1)) : 0)"}),
- ("SimdScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ConvertToDouble", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result)"}),
("SimdScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ConvertToInt32", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "result != firstOp[0]"}),
("SimdScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ConvertToUInt32", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "result != firstOp[0]"}),
("ExtractVector128Test.template", new Dictionary<string, string> { ["Isa"] = "Avx2", ["LoadIsa"] = "Avx", ["Method"] = "ExtractVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] = "Vector256", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "32", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "result[0] != firstOp[16]", ["ValidateRemainingResults"] = "(result[i] != firstOp[i + 16])"}),
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToSingle.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToSingle.cs
deleted file mode 100644
index 9f5abfc070..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToSingle.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Sse.IsSupported)
- {
- using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }))
- {
- var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArrayPtr);
- var f2 = Sse.ConvertToSingle(vf1);
-
- if (f2 != floatTable.inArray[0])
- {
- Console.WriteLine("SSE ConvertToSingle failed on float:");
- Console.WriteLine(f2);
- testResult = Fail;
- }
- }
- }
-
- return testResult;
- }
-
- public unsafe struct TestTable<T> : IDisposable where T : struct
- {
- public T[] inArray;
-
- public void* inArrayPtr => inHandle.AddrOfPinnedObject().ToPointer();
-
- GCHandle inHandle;
- public TestTable(T[] a)
- {
- this.inArray = a;
-
- inHandle = GCHandle.Alloc(inArray, GCHandleType.Pinned);
- }
-
- public void Dispose()
- {
- inHandle.Free();
- }
- }
-
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToSingle_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToSingle_r.csproj
deleted file mode 100644
index 23fca5a07c..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToSingle_r.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize></Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="ConvertToSingle.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToSingle_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToSingle_ro.csproj
deleted file mode 100644
index 1859135619..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToSingle_ro.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize>True</Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="ConvertToSingle.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetAllVector128.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetAllVector128.cs
deleted file mode 100644
index 576e376df0..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetAllVector128.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Sse.IsSupported)
- {
- using (TestTable<float> floatTable = new TestTable<float>(new float[4] { float.NaN, float.NaN, float.NaN, float.NaN }))
- {
- var vf1 = Sse.SetAllVector128(3);
- Unsafe.Write(floatTable.outArrayPtr, vf1);
-
- if (!floatTable.CheckResult((x) => x == 3))
- {
- Console.WriteLine("SSE SetAllVector128 failed on float:");
- foreach (var item in floatTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
- }
-
-
- return testResult;
- }
-
- public unsafe struct TestTable<T> : IDisposable where T : struct
- {
- public T[] outArray;
-
- public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
-
- GCHandle outHandle;
- public TestTable(T[] a)
- {
- this.outArray = a;
-
- outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
- }
- public bool CheckResult(Func<T, bool> check)
- {
- for (int i = 0; i < outArray.Length; i++)
- {
- if (!check(outArray[i]))
- {
- return false;
- }
- }
- return true;
- }
-
- public void Dispose()
- {
- outHandle.Free();
- }
- }
-
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetAllVector128_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetAllVector128_r.csproj
deleted file mode 100644
index a698be2303..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetAllVector128_r.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize></Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetAllVector128.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetAllVector128_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetAllVector128_ro.csproj
deleted file mode 100644
index cb69e0388e..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetAllVector128_ro.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize>True</Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetAllVector128.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetScalarVector128.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetScalarVector128.cs
deleted file mode 100644
index b586b2676e..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetScalarVector128.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Sse.IsSupported)
- {
- using (TestTable<float> floatTable = new TestTable<float>(new float[4] { float.NaN, float.NaN, float.NaN, float.NaN }))
- {
- var vf1 = Sse.SetScalarVector128(3);
- Unsafe.Write(floatTable.outArrayPtr, vf1);
-
- if (!floatTable.CheckResult((x) => (x[0] == 3)
- && (BitConverter.SingleToInt32Bits(x[1]) == 0)
- && (BitConverter.SingleToInt32Bits(x[2]) == 0)
- && (BitConverter.SingleToInt32Bits(x[3]) == 0)))
- {
- Console.WriteLine("SSE SetScalarVector128 failed on float:");
- foreach (var item in floatTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
- }
-
-
- return testResult;
- }
-
- public unsafe struct TestTable<T> : IDisposable where T : struct
- {
- public T[] outArray;
-
- public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
-
- GCHandle outHandle;
- public TestTable(T[] a)
- {
- this.outArray = a;
-
- outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
- }
- public bool CheckResult(Func<T[], bool> check)
- {
- return check(outArray);
- }
-
- public void Dispose()
- {
- outHandle.Free();
- }
- }
-
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetScalarVector128_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetScalarVector128_r.csproj
deleted file mode 100644
index ba6a715dc5..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetScalarVector128_r.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize></Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetScalarVector128.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetScalarVector128_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetScalarVector128_ro.csproj
deleted file mode 100644
index d1d78bbb29..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetScalarVector128_ro.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize>True</Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetScalarVector128.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetVector128.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetVector128.cs
deleted file mode 100644
index f9aee743f0..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetVector128.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Sse.IsSupported)
- {
- using (TestTable<float> floatTable = new TestTable<float>(new float[4] { float.NaN, float.NaN, float.NaN, float.NaN }))
- {
- var vf1 = Sse.SetVector128(1, -5, 100, 0);
- Unsafe.Write(floatTable.outArrayPtr, vf1);
-
- if (!floatTable.CheckResult((x) => (x[0] == 0) && (x[1] == 100) &&
- (x[2] == -5) && (x[3] == 1)))
- {
- Console.WriteLine("SSE SetVector128 failed on float:");
- foreach (var item in floatTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
- }
-
-
- return testResult;
- }
-
- public unsafe struct TestTable<T> : IDisposable where T : struct
- {
- public T[] outArray;
-
- public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
-
- GCHandle outHandle;
- public TestTable(T[] a)
- {
- this.outArray = a;
-
- outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
- }
- public bool CheckResult(Func<T[], bool> check)
- {
- return check(outArray);
- }
-
- public void Dispose()
- {
- outHandle.Free();
- }
- }
-
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetVector128_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetVector128_r.csproj
deleted file mode 100644
index e2189e135c..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetVector128_r.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize></Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetVector128.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetVector128_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetVector128_ro.csproj
deleted file mode 100644
index f6f271ebfc..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetVector128_ro.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize>True</Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetVector128.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetZeroVector128.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetZeroVector128.cs
deleted file mode 100644
index 8f6d75435b..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetZeroVector128.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Sse.IsSupported)
- {
- using (TestTable<float> floatTable = new TestTable<float>(new float[4] { float.NaN, float.NaN, float.NaN, float.NaN }))
- {
- var vf1 = Sse.SetZeroVector128();
- Unsafe.Write(floatTable.outArrayPtr, vf1);
-
- if (!floatTable.CheckResult((x) => BitConverter.SingleToInt32Bits(x) == 0))
- {
- Console.WriteLine("SSE SetZeroVector128 failed on float:");
- foreach (var item in floatTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
- }
-
-
- return testResult;
- }
-
- public unsafe struct TestTable<T> : IDisposable where T : struct
- {
- public T[] outArray;
-
- public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
-
- GCHandle outHandle;
- public TestTable(T[] a)
- {
- this.outArray = a;
-
- outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
- }
- public bool CheckResult(Func<T, bool> check)
- {
- for (int i = 0; i < outArray.Length; i++)
- {
- if (!check(outArray[i]))
- {
- return false;
- }
- }
- return true;
- }
-
- public void Dispose()
- {
- outHandle.Free();
- }
- }
-
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetZeroVector128_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetZeroVector128_r.csproj
deleted file mode 100644
index a08c99813e..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetZeroVector128_r.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize></Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetZeroVector128.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetZeroVector128_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetZeroVector128_ro.csproj
deleted file mode 100644
index e763ec6384..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/SetZeroVector128_ro.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize>True</Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetZeroVector128.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast.cs
deleted file mode 100644
index 707b9b1780..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- // that it is intentionally designed to be a struct type that meets
- // the generic constraint but is not supported by any intrinsics
- struct Num
- {
- public int a;
- }
-
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Sse.IsSupported)
- {
- using (TestTable<float, int> floatTable = new TestTable<float, int>(new float[4] { 1, float.NaN, float.PositiveInfinity, float.NegativeInfinity }, new int[4]))
- {
-
- var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArrayPtr);
- var vf2 = Sse.StaticCast<float, int>(vf1);
- Unsafe.Write(floatTable.outArrayPtr, vf2);
-
- if (!floatTable.CheckResult((x, y) => BitConverter.SingleToInt32Bits(x) == y))
- {
- Console.WriteLine("SSE StaticCast failed on float:");
- foreach (var item in floatTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
-
- // the successful path is the one that catches the exception, so that does nothing,
- // it is the fall-through path that's the error path
- try
- {
- var v = Sse.StaticCast<float, Num>(vf1);
- Unsafe.Write(floatTable.outArrayPtr, v);
- Console.WriteLine("SSE StaticCast failed on target type test:");
- testResult = Fail;
- }
- catch (System.NotSupportedException)
- {
- }
-
- // the successful path is the one that catches the exception, so that does nothing,
- // it is the fall-through path that's the error path
- try
- {
- var v = TestSrcType();
- Unsafe.Write(floatTable.outArrayPtr, v);
- Console.WriteLine("SSE StaticCast failed on source type test:");
- testResult = Fail;
- }
- catch (System.NotSupportedException)
- {
- }
- }
- }
-
- return testResult;
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
- static Vector128<int> TestSrcType()
- {
- Vector128<Num> v1 = new Vector128<Num>();
- Vector128<Num> v2 = new Vector128<Num>();
- return Sse2.Add(Sse.StaticCast<Num, int>(v1), Sse.StaticCast<Num, int>(v2));
- }
-
- public unsafe struct TestTable<T, U> : IDisposable where T : struct where U : struct
- {
- public T[] inArray;
- public U[] outArray;
-
- public void* inArrayPtr => inHandle.AddrOfPinnedObject().ToPointer();
- public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
-
- GCHandle inHandle;
- GCHandle outHandle;
- public TestTable(T[] a, U[] b)
- {
- this.inArray = a;
- this.outArray = b;
-
- inHandle = GCHandle.Alloc(inArray, GCHandleType.Pinned);
- outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
- }
- public bool CheckResult(Func<T, U, bool> check)
- {
- for (int i = 0; i < inArray.Length; i++)
- {
- if (!check(inArray[i], outArray[i]))
- {
- return false;
- }
- }
- return true;
- }
-
- public void Dispose()
- {
- inHandle.Free();
- outHandle.Free();
- }
- }
-
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast_r.csproj
deleted file mode 100644
index 6e4d20a77b..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast_r.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize></Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="StaticCast.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast_ro.csproj
deleted file mode 100644
index b3956c20eb..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/StaticCast_ro.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize>True</Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="StaticCast.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToDouble.Vector128Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToDouble.Vector128Double.cs
deleted file mode 100644
index 8a98842286..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToDouble.Vector128Double.cs
+++ /dev/null
@@ -1,341 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void ConvertToDoubleVector128Double()
- {
- var test = new SimdScalarUnaryOpConvertTest__ConvertToDoubleVector128Double();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works, using Unsafe.Read
- test.RunBasicScenario_UnsafeRead();
-
- if (Sse2.IsSupported)
- {
- // Validates basic functionality works, using Load
- test.RunBasicScenario_Load();
-
- // Validates basic functionality works, using LoadAligned
- test.RunBasicScenario_LoadAligned();
- }
-
- // Validates calling via reflection works, using Unsafe.Read
- test.RunReflectionScenario_UnsafeRead();
-
- if (Sse2.IsSupported)
- {
- // Validates calling via reflection works, using Load
- test.RunReflectionScenario_Load();
-
- // Validates calling via reflection works, using LoadAligned
- test.RunReflectionScenario_LoadAligned();
- }
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works, using Unsafe.Read
- test.RunLclVarScenario_UnsafeRead();
-
- if (Sse2.IsSupported)
- {
- // Validates passing a local works, using Load
- test.RunLclVarScenario_Load();
-
- // Validates passing a local works, using LoadAligned
- test.RunLclVarScenario_LoadAligned();
- }
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class SimdScalarUnaryOpConvertTest__ConvertToDoubleVector128Double
- {
- private struct TestStruct
- {
- public Vector128<Double> _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref testStruct._fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
-
- return testStruct;
- }
-
- public void RunStructFldScenario(SimdScalarUnaryOpConvertTest__ConvertToDoubleVector128Double testClass)
- {
- var result = Sse2.ConvertToDouble(_fld);
- testClass.ValidateResult(_fld, result);
- }
- }
-
- private static readonly int LargestVectorSize = 16;
-
- private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
-
- private static Double[] _data = new Double[Op1ElementCount];
-
- private static Vector128<Double> _clsVar;
-
- private Vector128<Double> _fld;
-
- private SimdScalarUnaryOpTest__DataTable<Double> _dataTable;
-
- static SimdScalarUnaryOpConvertTest__ConvertToDoubleVector128Double()
- {
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
- }
-
- public SimdScalarUnaryOpConvertTest__ConvertToDoubleVector128Double()
- {
- Succeeded = true;
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
-
- for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
- _dataTable = new SimdScalarUnaryOpTest__DataTable<Double>(_data, LargestVectorSize);
- }
-
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Double) != typeof(long)) && (typeof(Double) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Sse2.ConvertToDouble(
- Unsafe.Read<Vector128<Double>>(_dataTable.inArrayPtr)
- );
-
- ValidateResult(_dataTable.inArrayPtr, result);
- }
-
- public void RunBasicScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
-
- var result = Sse2.ConvertToDouble(
- Sse2.LoadVector128((Double*)(_dataTable.inArrayPtr))
- );
-
- ValidateResult(_dataTable.inArrayPtr, result);
- }
-
- public void RunBasicScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
-
- var result = Sse2.ConvertToDouble(
- Sse2.LoadAlignedVector128((Double*)(_dataTable.inArrayPtr))
- );
-
- ValidateResult(_dataTable.inArrayPtr, result);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertToDouble), new Type[] { typeof(Vector128<Double>) })
- .Invoke(null, new object[] {
- Unsafe.Read<Vector128<Double>>(_dataTable.inArrayPtr)
- });
-
- ValidateResult(_dataTable.inArrayPtr, (Double)(result));
- }
-
- public void RunReflectionScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
-
- var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertToDouble), new Type[] { typeof(Vector128<Double>) })
- .Invoke(null, new object[] {
- Sse2.LoadVector128((Double*)(_dataTable.inArrayPtr))
- });
-
- ValidateResult(_dataTable.inArrayPtr, (Double)(result));
- }
-
- public void RunReflectionScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
-
- var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertToDouble), new Type[] { typeof(Vector128<Double>) })
- .Invoke(null, new object[] {
- Sse2.LoadAlignedVector128((Double*)(_dataTable.inArrayPtr))
- });
-
- ValidateResult(_dataTable.inArrayPtr, (Double)(result));
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Sse2.ConvertToDouble(
- _clsVar
- );
-
- ValidateResult(_clsVar, result);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var firstOp = Unsafe.Read<Vector128<Double>>(_dataTable.inArrayPtr);
- var result = Sse2.ConvertToDouble(firstOp);
-
- ValidateResult(firstOp, result);
- }
-
- public void RunLclVarScenario_Load()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
-
- var firstOp = Sse2.LoadVector128((Double*)(_dataTable.inArrayPtr));
- var result = Sse2.ConvertToDouble(firstOp);
-
- ValidateResult(firstOp, result);
- }
-
- public void RunLclVarScenario_LoadAligned()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
-
- var firstOp = Sse2.LoadAlignedVector128((Double*)(_dataTable.inArrayPtr));
- var result = Sse2.ConvertToDouble(firstOp);
-
- ValidateResult(firstOp, result);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new SimdScalarUnaryOpConvertTest__ConvertToDoubleVector128Double();
- var result = Sse2.ConvertToDouble(test._fld);
-
- ValidateResult(test._fld, result);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Sse2.ConvertToDouble(_fld);
-
- ValidateResult(_fld, result);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Sse2.ConvertToDouble(test._fld);
-
- ValidateResult(test._fld, result);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Vector128<Double> firstOp, Double result, [CallerMemberName] string method = "")
- {
- Double[] inArray = new Double[Op1ElementCount];
- Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
- ValidateResult(inArray, result, method);
- }
-
- private void ValidateResult(void* firstOp, Double result, [CallerMemberName] string method = "")
- {
- Double[] inArray = new Double[Op1ElementCount];
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
- ValidateResult(inArray, result, method);
- }
-
- private void ValidateResult(Double[] firstOp, Double result, [CallerMemberName] string method = "")
- {
- if (BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result))
- {
- Succeeded = false;
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.ConvertToDouble)}<Double>(Vector128<Double>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: result");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MaskMove.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MaskMove.cs
index 0eac3227a0..08a31ce2e6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MaskMove.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/MaskMove.cs
@@ -24,7 +24,7 @@ namespace IntelHardwareIntrinsicTest
{
using (TestTable<byte> byteTable = new TestTable<byte>(new byte[16] { 255, 2, 0, 80, 0, 7, 0, 1, 2, 7, 80, 0, 123, 127, 5, 255 }, new byte[16] { 255, 0, 255, 0, 255, 0, 255, 0, 0, 255, 0, 255, 0, 255, 0, 255 }, new byte[16]))
{
- Unsafe.Write(byteTable.outArrayPtr, Sse2.SetZeroVector128<byte>());
+ Unsafe.Write(byteTable.outArrayPtr, Vector128<byte>.Zero);
var vf1 = Unsafe.Read<Vector128<byte>>(byteTable.inArray1Ptr);
var vf2 = Unsafe.Read<Vector128<byte>>(byteTable.inArray2Ptr);
@@ -44,7 +44,7 @@ namespace IntelHardwareIntrinsicTest
using (TestTable<sbyte> sbyteTable = new TestTable<sbyte>(new sbyte[16] { -1, 2, 0, 6, 0, 7, 111, 1, 2, 55, 80, 0, 11, 127, 5, -9 }, new sbyte[16] { -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1 }, new sbyte[16]))
{
- Unsafe.Write(sbyteTable.outArrayPtr, Sse2.SetZeroVector128<sbyte>());
+ Unsafe.Write(sbyteTable.outArrayPtr, Vector128<sbyte>.Zero);
var vf1 = Unsafe.Read<Vector128<sbyte>>(sbyteTable.inArray1Ptr);
var vf2 = Unsafe.Read<Vector128<sbyte>>(sbyteTable.inArray2Ptr);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Program.Sse2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Program.Sse2.cs
index 9505bc7308..b572b56202 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Program.Sse2.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Program.Sse2.cs
@@ -94,7 +94,6 @@ namespace JIT.HardwareIntrinsics.X86
["CompareOrderedScalar.Double"] = CompareOrderedScalarDouble,
["CompareUnordered.Double"] = CompareUnorderedDouble,
["CompareUnorderedScalar.Double"] = CompareUnorderedScalarDouble,
- ["ConvertToDouble.Vector128Double"] = ConvertToDoubleVector128Double,
["ConvertToInt32.Vector128Double"] = ConvertToInt32Vector128Double,
["ConvertToInt32.Vector128Int32"] = ConvertToInt32Vector128Int32,
["ConvertToInt32WithTruncation.Vector128Double"] = ConvertToInt32WithTruncationVector128Double,
@@ -158,15 +157,6 @@ namespace JIT.HardwareIntrinsics.X86
["PackSignedSaturate.Int16"] = PackSignedSaturateInt16,
["PackSignedSaturate.SByte"] = PackSignedSaturateSByte,
["PackUnsignedSaturate.Byte"] = PackUnsignedSaturateByte,
- ["SetAllVector128.Byte"] = SetAllVector128Byte,
- ["SetAllVector128.SByte"] = SetAllVector128SByte,
- ["SetAllVector128.Int16"] = SetAllVector128Int16,
- ["SetAllVector128.UInt16"] = SetAllVector128UInt16,
- ["SetAllVector128.Int32"] = SetAllVector128Int32,
- ["SetAllVector128.UInt32"] = SetAllVector128UInt32,
- ["SetAllVector128.Int64"] = SetAllVector128Int64,
- ["SetAllVector128.UInt64"] = SetAllVector128UInt64,
- ["SetAllVector128.Double"] = SetAllVector128Double,
["ShiftLeftLogical.Int16.1"] = ShiftLeftLogicalInt161,
["ShiftLeftLogical.UInt16.1"] = ShiftLeftLogicalUInt161,
["ShiftLeftLogical.Int32.1"] = ShiftLeftLogicalInt321,
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Byte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Byte.cs
deleted file mode 100644
index 8357bb23ea..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Byte.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void SetAllVector128Byte()
- {
- var test = new ScalarSimdUnaryOpTest__SetAllVector128Byte();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works
- test.RunBasicScenario_UnsafeRead();
-
- // Validates calling via reflection works
- test.RunReflectionScenario_UnsafeRead();
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works
- test.RunLclVarScenario_UnsafeRead();
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ScalarSimdUnaryOpTest__SetAllVector128Byte
- {
- private struct TestStruct
- {
- public Byte _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- testStruct._fld = TestLibrary.Generator.GetByte();
- return testStruct;
- }
-
- public void RunStructFldScenario(ScalarSimdUnaryOpTest__SetAllVector128Byte testClass)
- {
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 16;
-
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
-
- private static Byte _data;
-
- private static Byte _clsVar;
-
- private Byte _fld;
-
- private ScalarSimdUnaryOpTest__DataTable<Byte> _dataTable;
-
- static ScalarSimdUnaryOpTest__SetAllVector128Byte()
- {
- _clsVar = TestLibrary.Generator.GetByte();
- }
-
- public ScalarSimdUnaryOpTest__SetAllVector128Byte()
- {
- Succeeded = true;
-
- _fld = TestLibrary.Generator.GetByte();
- _data = TestLibrary.Generator.GetByte();
- _dataTable = new ScalarSimdUnaryOpTest__DataTable<Byte>(new Byte[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Byte) != typeof(long)) && (typeof(Byte) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Sse2.SetAllVector128(
- Unsafe.ReadUnaligned<Byte>(ref Unsafe.As<Byte, byte>(ref _data))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Byte) })
- .Invoke(null, new object[] {
- Unsafe.ReadUnaligned<Byte>(ref Unsafe.As<Byte, byte>(ref _data))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Byte>)(result));
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Sse2.SetAllVector128(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var data = Unsafe.ReadUnaligned<Byte>(ref Unsafe.As<Byte, byte>(ref _data));
- var result = Sse2.SetAllVector128(data);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(data, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ScalarSimdUnaryOpTest__SetAllVector128Byte();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Byte firstOp, void* result, [CallerMemberName] string method = "")
- {
- Byte[] outArray = new Byte[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
-
- ValidateResult(firstOp, outArray, method);
- }
-
- private void ValidateResult(Byte firstOp, Byte[] result, [CallerMemberName] string method = "")
- {
- if (result[0] != firstOp)
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != firstOp)
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.SetAllVector128)}<Byte>(Vector128<Byte>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Double.cs
deleted file mode 100644
index ed8e7d9376..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Double.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void SetAllVector128Double()
- {
- var test = new ScalarSimdUnaryOpTest__SetAllVector128Double();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works
- test.RunBasicScenario_UnsafeRead();
-
- // Validates calling via reflection works
- test.RunReflectionScenario_UnsafeRead();
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works
- test.RunLclVarScenario_UnsafeRead();
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ScalarSimdUnaryOpTest__SetAllVector128Double
- {
- private struct TestStruct
- {
- public Double _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- testStruct._fld = TestLibrary.Generator.GetDouble();
- return testStruct;
- }
-
- public void RunStructFldScenario(ScalarSimdUnaryOpTest__SetAllVector128Double testClass)
- {
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 16;
-
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
-
- private static Double _data;
-
- private static Double _clsVar;
-
- private Double _fld;
-
- private ScalarSimdUnaryOpTest__DataTable<Double> _dataTable;
-
- static ScalarSimdUnaryOpTest__SetAllVector128Double()
- {
- _clsVar = TestLibrary.Generator.GetDouble();
- }
-
- public ScalarSimdUnaryOpTest__SetAllVector128Double()
- {
- Succeeded = true;
-
- _fld = TestLibrary.Generator.GetDouble();
- _data = TestLibrary.Generator.GetDouble();
- _dataTable = new ScalarSimdUnaryOpTest__DataTable<Double>(new Double[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Double) != typeof(long)) && (typeof(Double) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Sse2.SetAllVector128(
- Unsafe.ReadUnaligned<Double>(ref Unsafe.As<Double, byte>(ref _data))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Double) })
- .Invoke(null, new object[] {
- Unsafe.ReadUnaligned<Double>(ref Unsafe.As<Double, byte>(ref _data))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result));
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Sse2.SetAllVector128(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var data = Unsafe.ReadUnaligned<Double>(ref Unsafe.As<Double, byte>(ref _data));
- var result = Sse2.SetAllVector128(data);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(data, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ScalarSimdUnaryOpTest__SetAllVector128Double();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Double firstOp, void* result, [CallerMemberName] string method = "")
- {
- Double[] outArray = new Double[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
-
- ValidateResult(firstOp, outArray, method);
- }
-
- private void ValidateResult(Double firstOp, Double[] result, [CallerMemberName] string method = "")
- {
- if (result[0] != firstOp)
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != firstOp)
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.SetAllVector128)}<Double>(Vector128<Double>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int16.cs
deleted file mode 100644
index d8965df10e..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int16.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void SetAllVector128Int16()
- {
- var test = new ScalarSimdUnaryOpTest__SetAllVector128Int16();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works
- test.RunBasicScenario_UnsafeRead();
-
- // Validates calling via reflection works
- test.RunReflectionScenario_UnsafeRead();
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works
- test.RunLclVarScenario_UnsafeRead();
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ScalarSimdUnaryOpTest__SetAllVector128Int16
- {
- private struct TestStruct
- {
- public Int16 _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- testStruct._fld = TestLibrary.Generator.GetInt16();
- return testStruct;
- }
-
- public void RunStructFldScenario(ScalarSimdUnaryOpTest__SetAllVector128Int16 testClass)
- {
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 16;
-
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
-
- private static Int16 _data;
-
- private static Int16 _clsVar;
-
- private Int16 _fld;
-
- private ScalarSimdUnaryOpTest__DataTable<Int16> _dataTable;
-
- static ScalarSimdUnaryOpTest__SetAllVector128Int16()
- {
- _clsVar = TestLibrary.Generator.GetInt16();
- }
-
- public ScalarSimdUnaryOpTest__SetAllVector128Int16()
- {
- Succeeded = true;
-
- _fld = TestLibrary.Generator.GetInt16();
- _data = TestLibrary.Generator.GetInt16();
- _dataTable = new ScalarSimdUnaryOpTest__DataTable<Int16>(new Int16[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Int16) != typeof(long)) && (typeof(Int16) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Sse2.SetAllVector128(
- Unsafe.ReadUnaligned<Int16>(ref Unsafe.As<Int16, byte>(ref _data))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Int16) })
- .Invoke(null, new object[] {
- Unsafe.ReadUnaligned<Int16>(ref Unsafe.As<Int16, byte>(ref _data))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int16>)(result));
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Sse2.SetAllVector128(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var data = Unsafe.ReadUnaligned<Int16>(ref Unsafe.As<Int16, byte>(ref _data));
- var result = Sse2.SetAllVector128(data);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(data, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ScalarSimdUnaryOpTest__SetAllVector128Int16();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Int16 firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int16[] outArray = new Int16[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
-
- ValidateResult(firstOp, outArray, method);
- }
-
- private void ValidateResult(Int16 firstOp, Int16[] result, [CallerMemberName] string method = "")
- {
- if (result[0] != firstOp)
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != firstOp)
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.SetAllVector128)}<Int16>(Vector128<Int16>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int32.cs
deleted file mode 100644
index 388cd57ee7..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int32.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void SetAllVector128Int32()
- {
- var test = new ScalarSimdUnaryOpTest__SetAllVector128Int32();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works
- test.RunBasicScenario_UnsafeRead();
-
- // Validates calling via reflection works
- test.RunReflectionScenario_UnsafeRead();
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works
- test.RunLclVarScenario_UnsafeRead();
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ScalarSimdUnaryOpTest__SetAllVector128Int32
- {
- private struct TestStruct
- {
- public Int32 _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- testStruct._fld = TestLibrary.Generator.GetInt32();
- return testStruct;
- }
-
- public void RunStructFldScenario(ScalarSimdUnaryOpTest__SetAllVector128Int32 testClass)
- {
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 16;
-
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
-
- private static Int32 _data;
-
- private static Int32 _clsVar;
-
- private Int32 _fld;
-
- private ScalarSimdUnaryOpTest__DataTable<Int32> _dataTable;
-
- static ScalarSimdUnaryOpTest__SetAllVector128Int32()
- {
- _clsVar = TestLibrary.Generator.GetInt32();
- }
-
- public ScalarSimdUnaryOpTest__SetAllVector128Int32()
- {
- Succeeded = true;
-
- _fld = TestLibrary.Generator.GetInt32();
- _data = TestLibrary.Generator.GetInt32();
- _dataTable = new ScalarSimdUnaryOpTest__DataTable<Int32>(new Int32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Sse2.SetAllVector128(
- Unsafe.ReadUnaligned<Int32>(ref Unsafe.As<Int32, byte>(ref _data))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Int32) })
- .Invoke(null, new object[] {
- Unsafe.ReadUnaligned<Int32>(ref Unsafe.As<Int32, byte>(ref _data))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result));
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Sse2.SetAllVector128(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var data = Unsafe.ReadUnaligned<Int32>(ref Unsafe.As<Int32, byte>(ref _data));
- var result = Sse2.SetAllVector128(data);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(data, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ScalarSimdUnaryOpTest__SetAllVector128Int32();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Int32 firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int32[] outArray = new Int32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
-
- ValidateResult(firstOp, outArray, method);
- }
-
- private void ValidateResult(Int32 firstOp, Int32[] result, [CallerMemberName] string method = "")
- {
- if (result[0] != firstOp)
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != firstOp)
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.SetAllVector128)}<Int32>(Vector128<Int32>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int64.cs
deleted file mode 100644
index 1969539db6..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.Int64.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void SetAllVector128Int64()
- {
- var test = new ScalarSimdUnaryOpTest__SetAllVector128Int64();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works
- test.RunBasicScenario_UnsafeRead();
-
- // Validates calling via reflection works
- test.RunReflectionScenario_UnsafeRead();
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works
- test.RunLclVarScenario_UnsafeRead();
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ScalarSimdUnaryOpTest__SetAllVector128Int64
- {
- private struct TestStruct
- {
- public Int64 _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- testStruct._fld = TestLibrary.Generator.GetInt64();
- return testStruct;
- }
-
- public void RunStructFldScenario(ScalarSimdUnaryOpTest__SetAllVector128Int64 testClass)
- {
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 16;
-
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
-
- private static Int64 _data;
-
- private static Int64 _clsVar;
-
- private Int64 _fld;
-
- private ScalarSimdUnaryOpTest__DataTable<Int64> _dataTable;
-
- static ScalarSimdUnaryOpTest__SetAllVector128Int64()
- {
- _clsVar = TestLibrary.Generator.GetInt64();
- }
-
- public ScalarSimdUnaryOpTest__SetAllVector128Int64()
- {
- Succeeded = true;
-
- _fld = TestLibrary.Generator.GetInt64();
- _data = TestLibrary.Generator.GetInt64();
- _dataTable = new ScalarSimdUnaryOpTest__DataTable<Int64>(new Int64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Sse2.SetAllVector128(
- Unsafe.ReadUnaligned<Int64>(ref Unsafe.As<Int64, byte>(ref _data))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(Int64) })
- .Invoke(null, new object[] {
- Unsafe.ReadUnaligned<Int64>(ref Unsafe.As<Int64, byte>(ref _data))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int64>)(result));
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Sse2.SetAllVector128(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var data = Unsafe.ReadUnaligned<Int64>(ref Unsafe.As<Int64, byte>(ref _data));
- var result = Sse2.SetAllVector128(data);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(data, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ScalarSimdUnaryOpTest__SetAllVector128Int64();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(Int64 firstOp, void* result, [CallerMemberName] string method = "")
- {
- Int64[] outArray = new Int64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int64>>());
-
- ValidateResult(firstOp, outArray, method);
- }
-
- private void ValidateResult(Int64 firstOp, Int64[] result, [CallerMemberName] string method = "")
- {
- if (result[0] != firstOp)
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != firstOp)
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.SetAllVector128)}<Int64>(Vector128<Int64>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.SByte.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.SByte.cs
deleted file mode 100644
index 094e097466..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.SByte.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void SetAllVector128SByte()
- {
- var test = new ScalarSimdUnaryOpTest__SetAllVector128SByte();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works
- test.RunBasicScenario_UnsafeRead();
-
- // Validates calling via reflection works
- test.RunReflectionScenario_UnsafeRead();
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works
- test.RunLclVarScenario_UnsafeRead();
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ScalarSimdUnaryOpTest__SetAllVector128SByte
- {
- private struct TestStruct
- {
- public SByte _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- testStruct._fld = TestLibrary.Generator.GetSByte();
- return testStruct;
- }
-
- public void RunStructFldScenario(ScalarSimdUnaryOpTest__SetAllVector128SByte testClass)
- {
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 16;
-
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
-
- private static SByte _data;
-
- private static SByte _clsVar;
-
- private SByte _fld;
-
- private ScalarSimdUnaryOpTest__DataTable<SByte> _dataTable;
-
- static ScalarSimdUnaryOpTest__SetAllVector128SByte()
- {
- _clsVar = TestLibrary.Generator.GetSByte();
- }
-
- public ScalarSimdUnaryOpTest__SetAllVector128SByte()
- {
- Succeeded = true;
-
- _fld = TestLibrary.Generator.GetSByte();
- _data = TestLibrary.Generator.GetSByte();
- _dataTable = new ScalarSimdUnaryOpTest__DataTable<SByte>(new SByte[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(SByte) != typeof(long)) && (typeof(SByte) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Sse2.SetAllVector128(
- Unsafe.ReadUnaligned<SByte>(ref Unsafe.As<SByte, byte>(ref _data))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(SByte) })
- .Invoke(null, new object[] {
- Unsafe.ReadUnaligned<SByte>(ref Unsafe.As<SByte, byte>(ref _data))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(result));
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Sse2.SetAllVector128(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var data = Unsafe.ReadUnaligned<SByte>(ref Unsafe.As<SByte, byte>(ref _data));
- var result = Sse2.SetAllVector128(data);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(data, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ScalarSimdUnaryOpTest__SetAllVector128SByte();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(SByte firstOp, void* result, [CallerMemberName] string method = "")
- {
- SByte[] outArray = new SByte[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>());
-
- ValidateResult(firstOp, outArray, method);
- }
-
- private void ValidateResult(SByte firstOp, SByte[] result, [CallerMemberName] string method = "")
- {
- if (result[0] != firstOp)
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != firstOp)
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.SetAllVector128)}<SByte>(Vector128<SByte>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt16.cs
deleted file mode 100644
index 118560b740..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt16.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void SetAllVector128UInt16()
- {
- var test = new ScalarSimdUnaryOpTest__SetAllVector128UInt16();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works
- test.RunBasicScenario_UnsafeRead();
-
- // Validates calling via reflection works
- test.RunReflectionScenario_UnsafeRead();
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works
- test.RunLclVarScenario_UnsafeRead();
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ScalarSimdUnaryOpTest__SetAllVector128UInt16
- {
- private struct TestStruct
- {
- public UInt16 _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- testStruct._fld = TestLibrary.Generator.GetUInt16();
- return testStruct;
- }
-
- public void RunStructFldScenario(ScalarSimdUnaryOpTest__SetAllVector128UInt16 testClass)
- {
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 16;
-
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16);
-
- private static UInt16 _data;
-
- private static UInt16 _clsVar;
-
- private UInt16 _fld;
-
- private ScalarSimdUnaryOpTest__DataTable<UInt16> _dataTable;
-
- static ScalarSimdUnaryOpTest__SetAllVector128UInt16()
- {
- _clsVar = TestLibrary.Generator.GetUInt16();
- }
-
- public ScalarSimdUnaryOpTest__SetAllVector128UInt16()
- {
- Succeeded = true;
-
- _fld = TestLibrary.Generator.GetUInt16();
- _data = TestLibrary.Generator.GetUInt16();
- _dataTable = new ScalarSimdUnaryOpTest__DataTable<UInt16>(new UInt16[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt16) != typeof(long)) && (typeof(UInt16) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Sse2.SetAllVector128(
- Unsafe.ReadUnaligned<UInt16>(ref Unsafe.As<UInt16, byte>(ref _data))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(UInt16) })
- .Invoke(null, new object[] {
- Unsafe.ReadUnaligned<UInt16>(ref Unsafe.As<UInt16, byte>(ref _data))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result));
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Sse2.SetAllVector128(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var data = Unsafe.ReadUnaligned<UInt16>(ref Unsafe.As<UInt16, byte>(ref _data));
- var result = Sse2.SetAllVector128(data);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(data, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ScalarSimdUnaryOpTest__SetAllVector128UInt16();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(UInt16 firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt16[] outArray = new UInt16[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>());
-
- ValidateResult(firstOp, outArray, method);
- }
-
- private void ValidateResult(UInt16 firstOp, UInt16[] result, [CallerMemberName] string method = "")
- {
- if (result[0] != firstOp)
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != firstOp)
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.SetAllVector128)}<UInt16>(Vector128<UInt16>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt32.cs
deleted file mode 100644
index 1aeaccaa32..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt32.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void SetAllVector128UInt32()
- {
- var test = new ScalarSimdUnaryOpTest__SetAllVector128UInt32();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works
- test.RunBasicScenario_UnsafeRead();
-
- // Validates calling via reflection works
- test.RunReflectionScenario_UnsafeRead();
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works
- test.RunLclVarScenario_UnsafeRead();
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ScalarSimdUnaryOpTest__SetAllVector128UInt32
- {
- private struct TestStruct
- {
- public UInt32 _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- testStruct._fld = TestLibrary.Generator.GetUInt32();
- return testStruct;
- }
-
- public void RunStructFldScenario(ScalarSimdUnaryOpTest__SetAllVector128UInt32 testClass)
- {
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 16;
-
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32);
-
- private static UInt32 _data;
-
- private static UInt32 _clsVar;
-
- private UInt32 _fld;
-
- private ScalarSimdUnaryOpTest__DataTable<UInt32> _dataTable;
-
- static ScalarSimdUnaryOpTest__SetAllVector128UInt32()
- {
- _clsVar = TestLibrary.Generator.GetUInt32();
- }
-
- public ScalarSimdUnaryOpTest__SetAllVector128UInt32()
- {
- Succeeded = true;
-
- _fld = TestLibrary.Generator.GetUInt32();
- _data = TestLibrary.Generator.GetUInt32();
- _dataTable = new ScalarSimdUnaryOpTest__DataTable<UInt32>(new UInt32[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt32) != typeof(long)) && (typeof(UInt32) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Sse2.SetAllVector128(
- Unsafe.ReadUnaligned<UInt32>(ref Unsafe.As<UInt32, byte>(ref _data))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(UInt32) })
- .Invoke(null, new object[] {
- Unsafe.ReadUnaligned<UInt32>(ref Unsafe.As<UInt32, byte>(ref _data))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result));
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Sse2.SetAllVector128(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var data = Unsafe.ReadUnaligned<UInt32>(ref Unsafe.As<UInt32, byte>(ref _data));
- var result = Sse2.SetAllVector128(data);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(data, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ScalarSimdUnaryOpTest__SetAllVector128UInt32();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(UInt32 firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt32[] outArray = new UInt32[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>());
-
- ValidateResult(firstOp, outArray, method);
- }
-
- private void ValidateResult(UInt32 firstOp, UInt32[] result, [CallerMemberName] string method = "")
- {
- if (result[0] != firstOp)
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != firstOp)
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.SetAllVector128)}<UInt32>(Vector128<UInt32>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt64.cs
deleted file mode 100644
index 333d556eac..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetAllVector128.UInt64.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/******************************************************************************
- * This file is auto-generated from a template file by the GenerateTests.csx *
- * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
- * changes, please update the corresponding template and run according to the *
- * directions listed in the file. *
- ******************************************************************************/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace JIT.HardwareIntrinsics.X86
-{
- public static partial class Program
- {
- private static void SetAllVector128UInt64()
- {
- var test = new ScalarSimdUnaryOpTest__SetAllVector128UInt64();
-
- if (test.IsSupported)
- {
- // Validates basic functionality works
- test.RunBasicScenario_UnsafeRead();
-
- // Validates calling via reflection works
- test.RunReflectionScenario_UnsafeRead();
-
- // Validates passing a static member works
- test.RunClsVarScenario();
-
- // Validates passing a local works
- test.RunLclVarScenario_UnsafeRead();
-
- // Validates passing the field of a local class works
- test.RunClassLclFldScenario();
-
- // Validates passing an instance member of a class works
- test.RunClassFldScenario();
-
- // Validates passing the field of a local struct works
- test.RunStructLclFldScenario();
-
- // Validates passing an instance member of a struct works
- test.RunStructFldScenario();
- }
- else
- {
- // Validates we throw on unsupported hardware
- test.RunUnsupportedScenario();
- }
-
- if (!test.Succeeded)
- {
- throw new Exception("One or more scenarios did not complete as expected.");
- }
- }
- }
-
- public sealed unsafe class ScalarSimdUnaryOpTest__SetAllVector128UInt64
- {
- private struct TestStruct
- {
- public UInt64 _fld;
-
- public static TestStruct Create()
- {
- var testStruct = new TestStruct();
-
- testStruct._fld = TestLibrary.Generator.GetUInt64();
- return testStruct;
- }
-
- public void RunStructFldScenario(ScalarSimdUnaryOpTest__SetAllVector128UInt64 testClass)
- {
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(testClass._dataTable.outArrayPtr, result);
- testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
- }
- }
-
- private static readonly int LargestVectorSize = 16;
-
- private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
-
- private static UInt64 _data;
-
- private static UInt64 _clsVar;
-
- private UInt64 _fld;
-
- private ScalarSimdUnaryOpTest__DataTable<UInt64> _dataTable;
-
- static ScalarSimdUnaryOpTest__SetAllVector128UInt64()
- {
- _clsVar = TestLibrary.Generator.GetUInt64();
- }
-
- public ScalarSimdUnaryOpTest__SetAllVector128UInt64()
- {
- Succeeded = true;
-
- _fld = TestLibrary.Generator.GetUInt64();
- _data = TestLibrary.Generator.GetUInt64();
- _dataTable = new ScalarSimdUnaryOpTest__DataTable<UInt64>(new UInt64[RetElementCount], LargestVectorSize);
- }
-
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
-
- public bool Succeeded { get; set; }
-
- public void RunBasicScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
-
- var result = Sse2.SetAllVector128(
- Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data))
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunReflectionScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
-
- var result = typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), new Type[] { typeof(UInt64) })
- .Invoke(null, new object[] {
- Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data))
- });
-
- Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result));
- ValidateResult(_data, _dataTable.outArrayPtr);
- }
-
- public void RunClsVarScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
-
- var result = Sse2.SetAllVector128(
- _clsVar
- );
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_clsVar, _dataTable.outArrayPtr);
- }
-
- public void RunLclVarScenario_UnsafeRead()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
-
- var data = Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data));
- var result = Sse2.SetAllVector128(data);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(data, _dataTable.outArrayPtr);
- }
-
- public void RunClassLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
-
- var test = new ScalarSimdUnaryOpTest__SetAllVector128UInt64();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunClassFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
-
- var result = Sse2.SetAllVector128(_fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(_fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructLclFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
-
- var test = TestStruct.Create();
- var result = Sse2.SetAllVector128(test._fld);
-
- Unsafe.Write(_dataTable.outArrayPtr, result);
- ValidateResult(test._fld, _dataTable.outArrayPtr);
- }
-
- public void RunStructFldScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
-
- var test = TestStruct.Create();
- test.RunStructFldScenario(this);
- }
-
- public void RunUnsupportedScenario()
- {
- TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
-
- Succeeded = false;
-
- try
- {
- RunBasicScenario_UnsafeRead();
- }
- catch (PlatformNotSupportedException)
- {
- Succeeded = true;
- }
- }
-
- private void ValidateResult(UInt64 firstOp, void* result, [CallerMemberName] string method = "")
- {
- UInt64[] outArray = new UInt64[RetElementCount];
-
- Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
-
- ValidateResult(firstOp, outArray, method);
- }
-
- private void ValidateResult(UInt64 firstOp, UInt64[] result, [CallerMemberName] string method = "")
- {
- if (result[0] != firstOp)
- {
- Succeeded = false;
- }
- else
- {
- for (var i = 1; i < RetElementCount; i++)
- {
- if (result[i] != firstOp)
- {
- Succeeded = false;
- break;
- }
- }
- }
-
- if (!Succeeded)
- {
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.SetAllVector128)}<UInt64>(Vector128<UInt64>): {method} failed:");
- TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
- TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
- TestLibrary.TestFramework.LogInformation(string.Empty);
- }
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetScalarVector128.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetScalarVector128.cs
deleted file mode 100644
index 4c5e209b31..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetScalarVector128.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Sse2.IsSupported)
- {
- using (TestTable<double> doubleTable = new TestTable<double>(new double[2] { double.NaN, double.NaN, }))
- {
- var vf1 = Sse2.SetScalarVector128(3);
- Unsafe.Write(doubleTable.outArrayPtr, vf1);
-
- if (!doubleTable.CheckResult((x) => (x[0] == 3) && (BitConverter.DoubleToInt64Bits(x[1]) == 0)))
- {
- Console.WriteLine("SSE2 SetScalarVector128 failed on double:");
- foreach (var item in doubleTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
- }
-
-
- return testResult;
- }
-
- public unsafe struct TestTable<T> : IDisposable where T : struct
- {
- public T[] outArray;
-
- public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer();
-
- GCHandle outHandle;
- public TestTable(T[] a)
- {
- this.outArray = a;
-
- outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned);
- }
- public bool CheckResult(Func<T[], bool> check)
- {
- return check(outArray);
- }
-
- public void Dispose()
- {
- outHandle.Free();
- }
- }
-
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetScalarVector128_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetScalarVector128_r.csproj
deleted file mode 100644
index ea0aa03110..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetScalarVector128_r.csproj
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{84BA61FF-08AD-4FB6-8BB3-94E9939122AC}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize></Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetScalarVector128.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
- </PropertyGroup>
-</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetScalarVector128_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetScalarVector128_ro.csproj
deleted file mode 100644
index f1627e1002..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetScalarVector128_ro.csproj
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{FA416B03-0EE9-4464-8799-3B353DE97BC4}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize>True</Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetScalarVector128.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
- </PropertyGroup>
-</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetVector128.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetVector128.cs
deleted file mode 100644
index c43fb75371..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetVector128.cs
+++ /dev/null
@@ -1,312 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace IntelHardwareIntrinsicTest
-{
- internal static partial class Program
- {
- private const int Pass = 100;
- private const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
- int testsCount = 21;
- string methodUnderTestName = nameof(Sse2.SetVector128);
-
- if (Sse2.IsSupported)
- {
- using (var doubleTable = TestTableSse2<double>.Create(testsCount))
- using (var longTable = TestTableSse2<long>.Create(testsCount))
- using (var ulongTable = TestTableSse2<ulong>.Create(testsCount))
- using (var intTable = TestTableSse2<int>.Create(testsCount))
- using (var uintTable = TestTableSse2<uint>.Create(testsCount))
- using (var shortTable = TestTableSse2<short>.Create(testsCount))
- using (var ushortTable = TestTableSse2<ushort>.Create(testsCount))
- using (var sbyteTable = TestTableSse2<sbyte>.Create(testsCount))
- using (var byteTable = TestTableSse2<byte>.Create(testsCount))
- {
- for (int i = 0; i < testsCount; i++)
- {
- Span<double> value = doubleTable.GetAssignmentData(i).Span;
- Vector128<double> result = Sse2.SetVector128(value[1], value[0]);
- doubleTable.SetOutArray(result, i);
- }
-
- if (Environment.Is64BitProcess)
- {
- for (int i = 0; i < testsCount; i++)
- {
- Span<long> value = longTable.GetAssignmentData(i).Span;
- Vector128<long> result = Sse2.SetVector128(value[1], value[0]);
- longTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Span<ulong> value = ulongTable.GetAssignmentData(i).Span;
- Vector128<ulong> result = Sse2.SetVector128(value[1], value[0]);
- ulongTable.SetOutArray(result, i);
- }
- }
- else
- {
- try
- {
- for (int i = 0; i < testsCount; i++)
- {
- Span<long> value = longTable.GetAssignmentData(i).Span;
- Vector128<long> result = Sse2.SetVector128(value[1], value[0]);
- longTable.SetOutArray(result, i);
- }
- testResult = Fail;
- Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.SetVector128)} failed on long: expected PlatformNotSupportedException exception.");
- }
- catch (PlatformNotSupportedException)
- {
- // We expect PlatformNotSupportedException
- }
- catch (Exception ex)
- {
- testResult = Fail;
- Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.SetVector128)}-{ex} failed on long: expected PlatformNotSupportedException exception.");
- }
-
- try
- {
- for (int i = 0; i < testsCount; i++)
- {
- Span<ulong> value = ulongTable.GetAssignmentData(i).Span;
- Vector128<ulong> result = Sse2.SetVector128(value[1], value[0]);
- ulongTable.SetOutArray(result, i);
- }
- testResult = Fail;
- Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.SetVector128)} failed on ulong: expected PlatformNotSupportedException exception.");
- }
- catch (PlatformNotSupportedException)
- {
- // We expect PlatformNotSupportedException
- }
- catch (Exception ex)
- {
- testResult = Fail;
- Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.SetVector128)}-{ex} failed on ulong: expected PlatformNotSupportedException exception.");
- }
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Span<int> value = intTable.GetAssignmentData(i).Span;
- Vector128<int> result = Sse2.SetVector128(value[3], value[2], value[1], value[0]);
- intTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Span<uint> value = uintTable.GetAssignmentData(i).Span;
- Vector128<uint> result = Sse2.SetVector128(value[3], value[2], value[1], value[0]);
- uintTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Span<short> value = shortTable.GetAssignmentData(i).Span;
- Vector128<short> result = Sse2.SetVector128(value[7], value[6], value[5], value[4], value[3], value[2], value[1], value[0]);
- shortTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Span<ushort> value = ushortTable.GetAssignmentData(i).Span;
- Vector128<ushort> result = Sse2.SetVector128(value[7], value[6], value[5], value[4], value[3], value[2], value[1], value[0]);
- ushortTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Span<sbyte> value = sbyteTable.GetAssignmentData(i).Span;
- Vector128<sbyte> result = Sse2.SetVector128(value[15], value[14], value[13], value[12], value[11], value[10], value[9],
- value[8], value[7], value[6], value[5], value[4], value[3], value[2], value[1], value[0]);
- sbyteTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Span<byte> value = byteTable.GetAssignmentData(i).Span;
- Vector128<byte> result = Sse2.SetVector128(value[15], value[14], value[13], value[12], value[11], value[10], value[9],
- value[8], value[7], value[6], value[5], value[4], value[3], value[2], value[1], value[0]);
- byteTable.SetOutArray(result, i);
- }
-
- CheckMethodSpan<double> checkDouble = (Span<double> x, Span<double> y, Span<double> z, Span<double> a) =>
- {
- bool result = true;
- for (int i = 0; i < x.Length; i++)
- {
- if (BitConverter.DoubleToInt64Bits(z[i]) != BitConverter.DoubleToInt64Bits(x[i]))
- result = false;
- }
- return result;
- };
-
- if (!doubleTable.CheckResult(checkDouble))
- {
- PrintError(doubleTable, methodUnderTestName, "(double x, double y, double z, ref double a) => (a = BitwiseXor(x, y)) == z", checkDouble);
- testResult = Fail;
- }
-
- if (Environment.Is64BitProcess)
- {
- CheckMethodSpan<long> checkLong = (Span<long> x, Span<long> y, Span<long> z, Span<long> a) =>
- {
- bool result = true;
- for (int i = 0; i < x.Length; i++)
- {
- if (x[i] != z[i])
- result = false;
- }
- return result;
- };
-
- if (!longTable.CheckResult(checkLong))
- {
- PrintError(longTable, methodUnderTestName, "(long x, long y, long z, ref long a) => (a = x ^ y) == z", checkLong);
- testResult = Fail;
- }
-
- CheckMethodSpan<ulong> checkUlong = (Span<ulong> x, Span<ulong> y, Span<ulong> z, Span<ulong> a) =>
- {
- bool result = true;
- for (int i = 0; i < x.Length; i++)
- {
- if (x[i] != z[i])
- result = false;
- }
- return result;
- };
-
- if (!longTable.CheckResult(checkLong))
- {
- PrintError(ulongTable, methodUnderTestName, "(ulong x, ulong y, ulong z, ref ulong a) => (a = x ^ y) == z", checkUlong);
- testResult = Fail;
- }
- }
-
- CheckMethodSpan<int> checkInt32 = (Span<int> x, Span<int> y, Span<int> z, Span<int> a) =>
- {
- bool result = true;
- for (int i = 0; i < x.Length; i++)
- {
- if (x[i] != z[i])
- result = false;
- }
- return result;
- };
-
- if (!intTable.CheckResult(checkInt32))
- {
- PrintError(intTable, methodUnderTestName, "(int x, int y, int z, ref int a) => (a = x ^ y) == z", checkInt32);
- testResult = Fail;
- }
-
- CheckMethodSpan<uint> checkUInt32 = (Span<uint> x, Span<uint> y, Span<uint> z, Span<uint> a) =>
- {
- bool result = true;
- for (int i = 0; i < x.Length; i++)
- {
- if (x[i] != z[i])
- result = false;
- }
- return result;
- };
-
- if (!uintTable.CheckResult(checkUInt32))
- {
- PrintError(uintTable, methodUnderTestName, "(uint x, uint y, uint z, ref uint a) => (a = x ^ y) == z", checkUInt32);
- testResult = Fail;
- }
-
- CheckMethodSpan<short> checkInt16 = (Span<short> x, Span<short> y, Span<short> z, Span<short> a) =>
- {
- bool result = true;
- for (int i = 0; i < x.Length; i++)
- {
- if (x[i] != z[i])
- result = false;
- }
- return result;
- };
-
- if (!shortTable.CheckResult(checkInt16))
- {
- PrintError(shortTable, methodUnderTestName, "(short x, short y, short z, ref short a) => (a = (short)(x ^ y)) == z", checkInt16);
- testResult = Fail;
- }
-
- CheckMethodSpan<ushort> checkUInt16 = (Span<ushort> x, Span<ushort> y, Span<ushort> z, Span<ushort> a) =>
- {
- bool result = true;
- for (int i = 0; i < x.Length; i++)
- {
- if (x[i] != z[i])
- result = false;
- }
- return result;
- };
-
- if (!ushortTable.CheckResult(checkUInt16))
- {
- PrintError(ushortTable, methodUnderTestName, "(ushort x, ushort y, ushort z, ref ushort a) => (a = (ushort)(x ^ y)) == z", checkUInt16);
- testResult = Fail;
- }
-
- CheckMethodSpan<sbyte> checkSByte = (Span<sbyte> x, Span<sbyte> y, Span<sbyte> z, Span<sbyte> a) =>
- {
- bool result = true;
- for (int i = 0; i < x.Length; i++)
- {
- if (x[i] != z[i])
- result = false;
- }
- return result;
- };
-
- if (!sbyteTable.CheckResult(checkSByte))
- {
- PrintError(sbyteTable, methodUnderTestName, "(sbyte x, sbyte y, sbyte z, ref sbyte a) => (a = (sbyte)(x ^ y)) == z", checkSByte);
- testResult = Fail;
- }
-
- CheckMethodSpan<byte> checkByte = (Span<byte> x, Span<byte> y, Span<byte> z, Span<byte> a) =>
- {
- bool result = true;
- for (int i = 0; i < x.Length; i++)
- {
- if (x[i] != z[i])
- result = false;
- }
- return result;
- };
-
- if (!byteTable.CheckResult(checkByte))
- {
- PrintError(byteTable, methodUnderTestName, "(byte x, byte y, byte z, ref byte a) => (a = (byte)(x ^ y)) == z", checkByte);
- testResult = Fail;
- }
- }
- }
- else
- {
- Console.WriteLine($"Sse2.IsSupported: {Sse2.IsSupported}, skipped tests of {typeof(Sse2)}.{methodUnderTestName}");
- }
-
- return testResult;
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetVector128_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetVector128_r.csproj
deleted file mode 100644
index de08a46398..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetVector128_r.csproj
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{665DD5BC-EADE-4B3F-98BA-8C54613567AB}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize></Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetVector128.cs" />
- <Compile Include="TestTableSse2.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
- </PropertyGroup>
-</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetVector128_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetVector128_ro.csproj
deleted file mode 100644
index e655200d58..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetVector128_ro.csproj
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{6C321EFB-B47D-4E9D-9898-B7BD1B32FB9A}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize>True</Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetVector128.cs" />
- <Compile Include="TestTableSse2.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
- </PropertyGroup>
-</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetZeroVector128.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetZeroVector128.cs
deleted file mode 100644
index 4a5974addf..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetZeroVector128.cs
+++ /dev/null
@@ -1,178 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-
-namespace IntelHardwareIntrinsicTest
-{
- internal static partial class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
- int testsCount = 21;
- string methodUnderTestName = nameof(Sse2.SetZeroVector128);
-
- if (Sse2.IsSupported)
- {
- using (var doubleTable = TestTableSse2<double>.Create(testsCount))
- using (var longTable = TestTableSse2<long>.Create(testsCount))
- using (var ulongTable = TestTableSse2<ulong>.Create(testsCount))
- using (var intTable = TestTableSse2<int>.Create(testsCount))
- using (var uintTable = TestTableSse2<uint>.Create(testsCount))
- using (var shortTable = TestTableSse2<short>.Create(testsCount))
- using (var ushortTable = TestTableSse2<ushort>.Create(testsCount))
- using (var sbyteTable = TestTableSse2<sbyte>.Create(testsCount))
- using (var byteTable = TestTableSse2<byte>.Create(testsCount))
- {
- for (int i = 0; i < testsCount; i++)
- {
- Vector128<double> result = Sse2.SetZeroVector128<double>();
- doubleTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Vector128<long> result = Sse2.SetZeroVector128<long>();
- longTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Vector128<ulong> result = Sse2.SetZeroVector128<ulong>();
- ulongTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Vector128<int> result = Sse2.SetZeroVector128<int>();
- intTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Vector128<uint> result = Sse2.SetZeroVector128<uint>();
- uintTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Vector128<short> result = Sse2.SetZeroVector128<short>();
- shortTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Vector128<ushort> result = Sse2.SetZeroVector128<ushort>();
- ushortTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Vector128<sbyte> result = Sse2.SetZeroVector128<sbyte>();
- sbyteTable.SetOutArray(result, i);
- }
-
- for (int i = 0; i < testsCount; i++)
- {
- Vector128<byte> result = Sse2.SetZeroVector128<byte>();
- byteTable.SetOutArray(result, i);
- }
-
- CheckMethod<double> checkDouble = (double x, double y, double z, ref double a) => (a = BitwiseXor(x, x)) == z;
-
- if (!doubleTable.CheckResult(checkDouble))
- {
- PrintError(doubleTable, methodUnderTestName, "(double x, double y, double z, ref double a) => (a = BitwiseXor(x, y)) == z", checkDouble);
- testResult = Fail;
- }
-
- CheckMethod<long> checkLong = (long x, long y, long z, ref long a) => (a = x ^ x) == z;
-
- if (!longTable.CheckResult(checkLong))
- {
- PrintError(longTable, methodUnderTestName, "(long x, long y, long z, ref long a) => (a = x ^ x) == z", checkLong);
- testResult = Fail;
- }
-
- CheckMethod<ulong> checkUlong = (ulong x, ulong y, ulong z, ref ulong a) => (a = x ^ x) == z;
-
- if (!longTable.CheckResult(checkLong))
- {
- PrintError(ulongTable, methodUnderTestName, "(ulong x, ulong y, ulong z, ref ulong a) => (a = x ^ x) == z", checkUlong);
- testResult = Fail;
- }
-
- CheckMethod<int> checkInt32 = (int x, int y, int z, ref int a) => (a = x ^ x) == z;
-
- if (!intTable.CheckResult(checkInt32))
- {
- PrintError(intTable, methodUnderTestName, "(int x, int y, int z, ref int a) => (a = x ^ x) == z", checkInt32);
- testResult = Fail;
- }
-
- CheckMethod<uint> checkUInt32 = (uint x, uint y, uint z, ref uint a) => (a = x ^ x) == z;
-
- if (!uintTable.CheckResult(checkUInt32))
- {
- PrintError(uintTable, methodUnderTestName, "(uint x, uint y, uint z, ref uint a) => (a = x ^ x) == z", checkUInt32);
- testResult = Fail;
- }
-
- CheckMethod<short> checkInt16 = (short x, short y, short z, ref short a) => (a = (short)(x ^ x)) == z;
-
- if (!shortTable.CheckResult(checkInt16))
- {
- PrintError(shortTable, methodUnderTestName, "(short x, short y, short z, ref short a) => (a = (short)(x ^ x)) == z", checkInt16);
- testResult = Fail;
- }
-
- CheckMethod<ushort> checkUInt16 = (ushort x, ushort y, ushort z, ref ushort a) => (a = (ushort)(x ^ x)) == z;
-
- if (!ushortTable.CheckResult(checkUInt16))
- {
- PrintError(ushortTable, methodUnderTestName, "(ushort x, ushort y, ushort z, ref ushort a) => (a = (ushort)(x ^ x)) == z", checkUInt16);
- testResult = Fail;
- }
-
- CheckMethod<sbyte> checkSByte = (sbyte x, sbyte y, sbyte z, ref sbyte a) => (a = (sbyte)(x ^ x)) == z;
-
- if (!sbyteTable.CheckResult(checkSByte))
- {
- PrintError(sbyteTable, methodUnderTestName, "(sbyte x, sbyte y, sbyte z, ref sbyte a) => (a = (sbyte)(x ^ x)) == z", checkSByte);
- testResult = Fail;
- }
-
- CheckMethod<byte> checkByte = (byte x, byte y, byte z, ref byte a) => (a = (byte)(x ^ x)) == z;
-
- if (!byteTable.CheckResult(checkByte))
- {
- PrintError(byteTable, methodUnderTestName, "(byte x, byte y, byte z, ref byte a) => (a = (byte)(x ^ x)) == z", checkByte);
- testResult = Fail;
- }
- }
- }
- else
- {
- Console.WriteLine($"Sse2.IsSupported: {Sse2.IsSupported}, skipped tests of {typeof(Sse2)}.{methodUnderTestName}");
- }
-
- return testResult;
- }
-
- public static unsafe double BitwiseXor(double x, double y)
- {
- var xUlong = BitConverter.ToUInt64(BitConverter.GetBytes(x));
- var yUlong = BitConverter.ToUInt64(BitConverter.GetBytes(y));
- var longAnd = xUlong ^ yUlong;
- return BitConverter.ToDouble(BitConverter.GetBytes(longAnd));
- }
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetZeroVector128_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetZeroVector128_r.csproj
deleted file mode 100644
index 6ac8bff863..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetZeroVector128_r.csproj
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{CEE19E36-E1A6-4C13-93EB-35FB2F69DF7D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize></Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetZeroVector128.cs" />
- <Compile Include="TestTableSse2.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
- </PropertyGroup>
-</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetZeroVector128_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetZeroVector128_ro.csproj
deleted file mode 100644
index 47c3a5cd47..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/SetZeroVector128_ro.csproj
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{5EDC665C-0CA9-4061-B048-06DE58DF3B79}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
- <DebugType>Embedded</DebugType>
- <Optimize>True</Optimize>
- </PropertyGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="SetZeroVector128.cs" />
- <Compile Include="TestTableSse2.cs" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
- </PropertyGroup>
-</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_r.csproj
index 39af5e9c9c..f99644c6a2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_r.csproj
@@ -109,7 +109,6 @@
<Compile Include="CompareOrderedScalar.Double.cs" />
<Compile Include="CompareUnordered.Double.cs" />
<Compile Include="CompareUnorderedScalar.Double.cs" />
- <Compile Include="ConvertToDouble.Vector128Double.cs" />
<Compile Include="ConvertToInt32.Vector128Double.cs" />
<Compile Include="ConvertToInt32.Vector128Int32.cs" />
<Compile Include="ConvertToInt32WithTruncation.Vector128Double.cs" />
@@ -173,15 +172,6 @@
<Compile Include="PackSignedSaturate.Int16.cs" />
<Compile Include="PackSignedSaturate.SByte.cs" />
<Compile Include="PackUnsignedSaturate.Byte.cs" />
- <Compile Include="SetAllVector128.Byte.cs" />
- <Compile Include="SetAllVector128.SByte.cs" />
- <Compile Include="SetAllVector128.Int16.cs" />
- <Compile Include="SetAllVector128.UInt16.cs" />
- <Compile Include="SetAllVector128.Int32.cs" />
- <Compile Include="SetAllVector128.UInt32.cs" />
- <Compile Include="SetAllVector128.Int64.cs" />
- <Compile Include="SetAllVector128.UInt64.cs" />
- <Compile Include="SetAllVector128.Double.cs" />
<Compile Include="ShiftLeftLogical.Int16.1.cs" />
<Compile Include="ShiftLeftLogical.UInt16.1.cs" />
<Compile Include="ShiftLeftLogical.Int32.1.cs" />
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_ro.csproj
index 1ed7fddd8c..cc917832d4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_ro.csproj
@@ -109,7 +109,6 @@
<Compile Include="CompareOrderedScalar.Double.cs" />
<Compile Include="CompareUnordered.Double.cs" />
<Compile Include="CompareUnorderedScalar.Double.cs" />
- <Compile Include="ConvertToDouble.Vector128Double.cs" />
<Compile Include="ConvertToInt32.Vector128Double.cs" />
<Compile Include="ConvertToInt32.Vector128Int32.cs" />
<Compile Include="ConvertToInt32WithTruncation.Vector128Double.cs" />
@@ -174,15 +173,6 @@
<Compile Include="PackSignedSaturate.SByte.cs" />
<Compile Include="PackUnsignedSaturate.Byte.cs" />
<Compile Include="Program.Sse2.cs" />
- <Compile Include="SetAllVector128.Byte.cs" />
- <Compile Include="SetAllVector128.Double.cs" />
- <Compile Include="SetAllVector128.Int16.cs" />
- <Compile Include="SetAllVector128.Int32.cs" />
- <Compile Include="SetAllVector128.Int64.cs" />
- <Compile Include="SetAllVector128.SByte.cs" />
- <Compile Include="SetAllVector128.UInt16.cs" />
- <Compile Include="SetAllVector128.UInt32.cs" />
- <Compile Include="SetAllVector128.UInt64.cs" />
<Compile Include="ShiftLeftLogical.Int16.1.cs" />
<Compile Include="ShiftLeftLogical.Int16.16.cs" />
<Compile Include="ShiftLeftLogical.Int32.1.cs" />
diff --git a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Camera.cs b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Camera.cs
index 42f3c8baac..6e274e4747 100644
--- a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Camera.cs
+++ b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Camera.cs
@@ -19,8 +19,8 @@ internal class Camera
public static Camera Create(VectorPacket256 pos, VectorPacket256 lookAt)
{
VectorPacket256 forward = (lookAt - pos).Normalize();
- VectorPacket256 down = new VectorPacket256(SetZeroVector256<float>(), SetAllVector256<float>(-1), SetZeroVector256<float>());
- Vector256<float> OnePointFive = SetAllVector256<float>(1.5f);
+ VectorPacket256 down = new VectorPacket256(Vector256<float>.Zero, Vector256.Create(-1.0f), Vector256<float>.Zero);
+ Vector256<float> OnePointFive = Vector256.Create(1.5f);
VectorPacket256 right = OnePointFive * VectorPacket256.CrossProduct(forward, down).Normalize();
VectorPacket256 up = OnePointFive * VectorPacket256.CrossProduct(forward, right).Normalize();
diff --git a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/ColorPacket.cs b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/ColorPacket.cs
index 3aa36171aa..59756243d6 100644
--- a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/ColorPacket.cs
+++ b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/ColorPacket.cs
@@ -13,8 +13,8 @@ using ColorPacket256 = VectorPacket256;
internal static class ColorPacket256Helper
{
- private static readonly Vector256<float> One = SetAllVector256<float>(1.0f);
- private static readonly Vector256<float> Max = SetAllVector256<float>(255.0f);
+ private static readonly Vector256<float> One = Vector256.Create(1.0f);
+ private static readonly Vector256<float> Max = Vector256.Create(255.0f);
public static Int32RGBPacket256 ConvertToIntRGB(this VectorPacket256 colors)
{
@@ -39,8 +39,8 @@ internal static class ColorPacket256Helper
return new VectorPacket256(Multiply(left.Xs, right.Xs), Multiply(left.Ys, right.Ys), Multiply(left.Zs, right.Zs));
}
- public static readonly ColorPacket256 BackgroundColor = new ColorPacket256(SetZeroVector256<float>());
- public static readonly ColorPacket256 DefaultColor = new ColorPacket256(SetZeroVector256<float>());
+ public static readonly ColorPacket256 BackgroundColor = new ColorPacket256(Vector256<float>.Zero);
+ public static readonly ColorPacket256 DefaultColor = new ColorPacket256(Vector256<float>.Zero);
}
internal struct Int32RGBPacket256
diff --git a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Intersections.cs b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Intersections.cs
index 54e4d2d4dc..917b3dbb3b 100644
--- a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Intersections.cs
+++ b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Intersections.cs
@@ -15,8 +15,8 @@ internal struct Intersections
public Vector256<float> Distances;
public Vector256<int> ThingIndices;
- public static readonly Vector256<float> NullDistance = SetAllVector256<float>(float.MaxValue);
- public static readonly Vector256<int> NullIndex = SetAllVector256<int>(-1);
+ public static readonly Vector256<float> NullDistance = Vector256.Create(float.MaxValue);
+ public static readonly Vector256<int> NullIndex = Vector256.Create(-1);
public Intersections(Vector256<float> dis, Vector256<int> things)
{
@@ -34,10 +34,10 @@ internal struct Intersections
public static bool AllNullIntersections(Vector256<float> dis)
{
var cmp = Compare(dis, NullDistance, FloatComparisonMode.EqualOrderedNonSignaling);
- var zero = SetZeroVector256<int>();
+ var zero = Vector256<int>.Zero;
// efficiently generate an all-one mask vector by lower latency AVX2 ComapreEqual
var mask = Avx2.CompareEqual(zero, zero);
- return TestC(cmp, StaticCast<int, float>(mask));
+ return TestC(cmp, mask.AsSingle());
}
}
diff --git a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/PacketTracer.cs b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/PacketTracer.cs
index ba52a472a0..b0d2fe7201 100644
--- a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/PacketTracer.cs
+++ b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/PacketTracer.cs
@@ -18,7 +18,7 @@ internal class Packet256Tracer
public int Height { get; }
private static readonly int MaxDepth = 5;
- private static readonly Vector256<float> SevenToZero = SetVector256(7f, 6f, 5f, 4f, 3f, 2f, 1f, 0f);
+ private static readonly Vector256<float> SevenToZero = Vector256.Create(0f, 1f, 2f, 3f, 4f, 5f, 6f, 7f);
public Packet256Tracer(int width, int height)
{
@@ -40,8 +40,8 @@ internal class Packet256Tracer
for (int x = 0; x < Width; x += VectorPacket256.Packet256Size)
{
float fx = x;
- Vector256<float> Xs = Add(SetAllVector256(fx), SevenToZero);
- var dirs = GetPoints(Xs, SetAllVector256<float>(y), camera);
+ Vector256<float> Xs = Add(Vector256.Create(fx), SevenToZero);
+ VectorPacket256 dirs = GetPoints(Xs, Vector256.Create((float)(y)), camera);
var rayPacket256 = new RayPacket256(camera.Pos, dirs);
var SoAcolors = TraceRay(rayPacket256, scene, depth: 0);
@@ -80,10 +80,10 @@ internal class Packet256Tracer
var isect = MinIntersections(rayPacket256, scene);
if (isect.AllNullIntersections())
{
- return SetZeroVector256<float>();
+ return Vector256<float>.Zero;
}
var isNull = Compare(isect.Distances, Intersections.NullDistance, FloatComparisonMode.EqualOrderedNonSignaling);
- return BlendVariable(isect.Distances, SetZeroVector256<float>(), isNull);
+ return BlendVariable(isect.Distances, Vector256<float>.Zero, isNull);
}
private Intersections MinIntersections(RayPacket256 rayPacket256, Scene scene)
@@ -101,9 +101,9 @@ internal class Packet256Tracer
var lessMinMask = Compare(mins.Distances, distance, FloatComparisonMode.GreaterThanOrderedNonSignaling);
var minMask = And(notNullMask, Or(nullMinMask, lessMinMask));
var minDis = BlendVariable(mins.Distances, distance, minMask);
- var minIndices = StaticCast<float, int>(BlendVariable(StaticCast<int, float>(mins.ThingIndices),
- StaticCast<int, float>(SetAllVector256<int>(i)),
- minMask));
+ var minIndices = BlendVariable(mins.ThingIndices.AsSingle(),
+ Vector256.Create(i).AsSingle(),
+ minMask).AsInt32();
mins.Distances = minDis;
mins.ThingIndices = minIndices;
}
@@ -117,7 +117,7 @@ internal class Packet256Tracer
var ds = rays.Dirs;
var pos = isect.Distances * ds + rays.Starts;
var normals = scene.Normals(isect.ThingIndices, pos);
- var reflectDirs = ds - (Multiply(VectorPacket256.DotProduct(normals, ds), SetAllVector256<float>(2)) * normals);
+ var reflectDirs = ds - (Multiply(VectorPacket256.DotProduct(normals, ds), Vector256.Create(2.0f)) * normals);
var colors = GetNaturalColor(isect.ThingIndices, pos, normals, reflectDirs, scene);
if (depth >= MaxDepth)
@@ -125,7 +125,7 @@ internal class Packet256Tracer
return colors + new ColorPacket256(.5f, .5f, .5f);
}
- return colors + GetReflectionColor(isect.ThingIndices, pos + (SetAllVector256<float>(0.001f) * reflectDirs), normals, reflectDirs, scene, depth);
+ return colors + GetReflectionColor(isect.ThingIndices, pos + (Vector256.Create(0.001f) * reflectDirs), normals, reflectDirs, scene, depth);
}
private ColorPacket256 GetNaturalColor(Vector256<int> things, VectorPacket256 pos, VectorPacket256 norms, VectorPacket256 rds, Scene scene)
@@ -134,7 +134,7 @@ internal class Packet256Tracer
for (int i = 0; i < scene.Lights.Length; i++)
{
var lights = scene.Lights[i];
- var zero = SetZeroVector256<float>();
+ var zero = Vector256<float>.Zero;
var colorPacket = lights.Colors;
var ldis = lights.Positions - pos;
var livec = ldis.Normalize();
@@ -159,12 +159,12 @@ internal class Packet256Tracer
var difColor = new ColorPacket256(1, 1, 1);
var splColor = new ColorPacket256(1, 1, 1);
- var roughness = SetAllVector256<float>(1);
+ var roughness = Vector256.Create(1.0f);
for (int j = 0; j < scene.Things.Length; j++)
{
- Vector256<float> thingMask = StaticCast<int, float>(CompareEqual(things, SetAllVector256<int>(j)));
- var rgh = SetAllVector256<float>(scene.Things[j].Surface.Roughness);
+ Vector256<float> thingMask = CompareEqual(things, Vector256.Create(j)).AsSingle();
+ Vector256<float> rgh = Vector256.Create(scene.Things[j].Surface.Roughness);
var dif = scene.Things[j].Surface.Diffuse(pos);
var spl = scene.Things[j].Surface.Specular;
@@ -200,12 +200,12 @@ internal class Packet256Tracer
return scene.Reflect(things, pos) * TraceRay(new RayPacket256(pos, rds), scene, depth + 1);
}
- private readonly static Vector256<float> ConstTwo = SetAllVector256(2.0f);
+ private readonly static Vector256<float> ConstTwo = Vector256.Create(2.0f);
private VectorPacket256 GetPoints(Vector256<float> x, Vector256<float> y, Camera camera)
{
- var widthVector = SetAllVector256<float>(Width);
- var heightVector = SetAllVector256<float>(Height);
+ Vector256<float> widthVector = Vector256.Create((float)(Width));
+ Vector256<float> heightVector = Vector256.Create((float)(Height));
var widthRate1 = Divide(widthVector, ConstTwo);
var widthRate2 = Multiply(widthVector, ConstTwo);
@@ -214,7 +214,7 @@ internal class Packet256Tracer
var heightRate2 = Multiply(heightVector, ConstTwo);
var recenteredX = Divide(Subtract(x, widthRate1), widthRate2);
- var recenteredY = Subtract(SetZeroVector256<float>(), Divide(Subtract(y, heightRate1), heightRate2));
+ var recenteredY = Subtract(Vector256<float>.Zero, Divide(Subtract(y, heightRate1), heightRate2));
var result = camera.Forward + (recenteredX * camera.Right) + (recenteredY * camera.Up);
@@ -226,9 +226,9 @@ internal class Packet256Tracer
private static Scene CreateDefaultScene()
{
ObjectPacket256[] things = {
- new SpherePacket256(new VectorPacket256(-0.5f, 1f, 1.5f), SetAllVector256(0.5f), Surfaces.MatteShiny),
- new SpherePacket256(new VectorPacket256(0f, 1f, -0.25f), SetAllVector256(1f), Surfaces.Shiny),
- new PlanePacket256((new VectorPacket256(0, 1, 0)), SetAllVector256(0f), Surfaces.CheckerBoard)
+ new SpherePacket256(new VectorPacket256(-0.5f, 1f, 1.5f), Vector256.Create(0.5f), Surfaces.MatteShiny),
+ new SpherePacket256(new VectorPacket256(0f, 1f, -0.25f), Vector256.Create(1f), Surfaces.Shiny),
+ new PlanePacket256((new VectorPacket256(0, 1, 0)), Vector256.Create(0f), Surfaces.CheckerBoard)
};
LightPacket256[] lights = {
diff --git a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/PlanePacket.cs b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/PlanePacket.cs
index 0269367955..b3607b9581 100644
--- a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/PlanePacket.cs
+++ b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/PlanePacket.cs
@@ -28,8 +28,8 @@ internal sealed class PlanePacket256 : ObjectPacket256
public override Vector256<float> Intersect(RayPacket256 rayPacket256)
{
var denom = VectorPacket256.DotProduct(Norms, rayPacket256.Dirs);
- var dist = Divide(Add(VectorPacket256.DotProduct(Norms, rayPacket256.Starts), Offsets), Subtract(SetZeroVector256<float>(), denom));
- var gtMask = Compare(denom, SetZeroVector256<float>(), FloatComparisonMode.GreaterThanOrderedNonSignaling);
+ var dist = Divide(Add(VectorPacket256.DotProduct(Norms, rayPacket256.Starts), Offsets), Subtract(Vector256<float>.Zero, denom));
+ var gtMask = Compare(denom, Vector256<float>.Zero, FloatComparisonMode.GreaterThanOrderedNonSignaling);
return BlendVariable(dist, Intersections.NullDistance, gtMask);
}
}
diff --git a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Program.cs b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Program.cs
index 3ae923a9b1..b2b49acc21 100644
--- a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Program.cs
+++ b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Program.cs
@@ -8,6 +8,7 @@ using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Concurrent;
+using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
//using Microsoft.Xunit.Performance;
@@ -103,7 +104,7 @@ class Program
// Determine the new position of the sphere based on the current time elapsed
float dy2 = 0.8f * MathF.Abs(MathF.Sin((float)(totalTime.ElapsedMilliseconds * Math.PI / 3000)));
- sphere2.Centers.Ys = Avx.Add(baseY, Avx.SetAllVector256(dy2));
+ sphere2.Centers.Ys = Avx.Add(baseY, Vector256.Create(dy2));
// Render the scene
renderingTime.Reset();
diff --git a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Scene.cs b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Scene.cs
index 9edbb946b1..0cc0ab6bc5 100644
--- a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Scene.cs
+++ b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Scene.cs
@@ -26,7 +26,7 @@ internal class Scene
for (int i = 0; i < Things.Length; i++)
{
- Vector256<float> mask = StaticCast<int, float>(CompareEqual(things, SetAllVector256<int>(i)));
+ Vector256<float> mask = CompareEqual(things, Vector256.Create(i)).AsSingle();
var n = Things[i].Normals(pos);
norms.Xs = BlendVariable(norms.Xs, n.Xs, mask);
norms.Ys = BlendVariable(norms.Ys, n.Ys, mask);
@@ -39,10 +39,10 @@ internal class Scene
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Vector256<float> Reflect(Vector256<int> things, VectorPacket256 pos)
{
- Vector256<float> rfl = SetAllVector256<float>(1);
+ Vector256<float> rfl = Vector256.Create(1.0f);
for (int i = 0; i < Things.Length; i++)
{
- Vector256<float> mask = StaticCast<int, float>(CompareEqual(things, SetAllVector256<int>(i)));
+ Vector256<float> mask = CompareEqual(things, Vector256.Create(i)).AsSingle();
rfl = BlendVariable(rfl, Things[i].Surface.Reflect(pos), mask);
}
return rfl;
diff --git a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/SpherePacket.cs b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/SpherePacket.cs
index b1e2b496a7..09e461201e 100644
--- a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/SpherePacket.cs
+++ b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/SpherePacket.cs
@@ -29,7 +29,7 @@ internal sealed class SpherePacket256 : ObjectPacket256
{
var eo = Centers - rayPacket256.Starts;
var v = VectorPacket256.DotProduct(eo, rayPacket256.Dirs);
- var zero = SetZeroVector256<float>();
+ var zero = Vector256<float>.Zero;
var vLessZeroMask = Compare(v, zero, FloatComparisonMode.LessThanOrderedNonSignaling);
var discs = Subtract(Multiply(Radiuses, Radiuses), Subtract(VectorPacket256.DotProduct(eo, eo), Multiply(v, v)));
var discLessZeroMask = Compare(discs, zero, FloatComparisonMode.LessThanOrderedNonSignaling);
diff --git a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Surfaces.cs b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Surfaces.cs
index 7e467ae34e..a376872a16 100644
--- a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Surfaces.cs
+++ b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/Surfaces.cs
@@ -13,7 +13,7 @@ using System;
internal static class Surfaces
{
- private static readonly ColorPacket256 White = new ColorPacket256(SetAllVector256(1.0f));
+ private static readonly ColorPacket256 White = new ColorPacket256(Vector256.Create(1.0f));
private static readonly ColorPacket256 Black = new ColorPacket256(0.02f, 0.0f, 0.14f);
// Only works with X-Z plane.
public static readonly Surface CheckerBoard =
@@ -21,13 +21,13 @@ internal static class Surfaces
delegate (VectorPacket256 pos)
{
var floored = ConvertToVector256Int32(Add(Floor(pos.Zs), Floor(pos.Xs)));
- var modMask = SetAllVector256<int>(1);
+ var modMask = Vector256.Create(1);
var evenMaskint = Avx2.And(floored, modMask);
var evenMask = Avx2.CompareEqual(evenMaskint, modMask);
- var resultX = BlendVariable(Black.Xs, White.Xs, StaticCast<int, float>(evenMask));
- var resultY = BlendVariable(Black.Ys, White.Ys, StaticCast<int, float>(evenMask));
- var resultZ = BlendVariable(Black.Zs, White.Zs, StaticCast<int, float>(evenMask));
+ var resultX = BlendVariable(Black.Xs, White.Xs, evenMask.AsSingle());
+ var resultY = BlendVariable(Black.Ys, White.Ys, evenMask.AsSingle());
+ var resultZ = BlendVariable(Black.Zs, White.Zs, evenMask.AsSingle());
return new ColorPacket256(resultX, resultY, resultZ);
},
@@ -35,11 +35,11 @@ internal static class Surfaces
delegate (VectorPacket256 pos)
{
var floored = ConvertToVector256Int32(Add(Floor(pos.Zs), Floor(pos.Xs)));
- var modMask = SetAllVector256<int>(1);
+ var modMask = Vector256.Create(1);
var evenMaskUint = Avx2.And(floored, modMask);
var evenMask = Avx2.CompareEqual(evenMaskUint, modMask);
- return BlendVariable(SetAllVector256(0.5f), SetAllVector256(0.1f), StaticCast<int, float>(evenMask));
+ return BlendVariable(Vector256.Create(0.5f), Vector256.Create(0.1f), evenMask.AsSingle());
},
150f);
@@ -49,13 +49,13 @@ internal static class Surfaces
new Surface(
delegate (VectorPacket256 pos) { return new VectorPacket256(1f, 1f, 1f); },
new VectorPacket256(.5f, .5f, .5f),
- delegate (VectorPacket256 pos) { return SetAllVector256<float>(0.7f); },
+ delegate (VectorPacket256 pos) { return Vector256.Create(0.7f); },
250f);
public static readonly Surface MatteShiny =
new Surface(
delegate (VectorPacket256 pos) { return new VectorPacket256(1f, 1f, 1f); },
new VectorPacket256(.25f, .25f, .25f),
- delegate (VectorPacket256 pos) { return SetAllVector256<float>(0.7f); },
+ delegate (VectorPacket256 pos) { return Vector256.Create(0.7f); },
250f);
}
diff --git a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/VectorMath.cs b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/VectorMath.cs
index 51c87605aa..c0e3437af2 100644
--- a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/VectorMath.cs
+++ b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/VectorMath.cs
@@ -11,33 +11,33 @@ using System;
public static class VectorMath
{
- static readonly Vector256<float> MaxValue = SetAllVector256<float>(88.0f);
- static readonly Vector256<float> MinValue = SetAllVector256<float>(-88.0f);
- static readonly Vector256<float> Log2 = SetAllVector256<float>(1.44269502f);
- static readonly Vector256<float> C1 = SetAllVector256<float>(0.693359375f);
- static readonly Vector256<float> C2 = SetAllVector256<float>(-0.0002121944417f);
- static readonly Vector256<float> P0 = SetAllVector256<float>(0.0001987569121f);
- static readonly Vector256<float> P1 = SetAllVector256<float>(0.001398199936f);
- static readonly Vector256<float> P2 = SetAllVector256<float>(0.008333452046f);
- static readonly Vector256<float> P3 = SetAllVector256<float>(0.04166579619f);
- static readonly Vector256<float> P4 = SetAllVector256<float>(0.1666666567f);
- static readonly Vector256<float> LogP0 = SetAllVector256<float>(0.07037683576f);
- static readonly Vector256<float> LogP1 = SetAllVector256<float>(-0.1151461005f);
- static readonly Vector256<float> LogP2 = SetAllVector256<float>(0.1167699844f);
- static readonly Vector256<float> LogP3 = SetAllVector256<float>(-0.1242014095f);
- static readonly Vector256<float> LogP4 = SetAllVector256<float>(0.1424932331f);
- static readonly Vector256<float> LogP5 = SetAllVector256<float>(-0.1666805744f);
- static readonly Vector256<float> LogP6 = SetAllVector256<float>(0.2000071406f);
- static readonly Vector256<float> LogP7 = SetAllVector256<float>(-0.2499999404f);
- static readonly Vector256<float> LogP8 = SetAllVector256<float>(0.3333333135f);
- static readonly Vector256<float> LogQ1 = SetAllVector256<float>(-0.0002121944417f);
- static readonly Vector256<float> LogQ2 = SetAllVector256<float>(0.693359375f);
- static readonly Vector256<float> Point5 = SetAllVector256<float>(0.5f);
- static readonly Vector256<float> Sqrthf = SetAllVector256<float>(0.7071067691f);
- static readonly Vector256<float> One = SetAllVector256<float>(1.0f);
- static readonly Vector256<int> Ox7 = SetAllVector256<int>(127);
- static readonly Vector256<int> MinNormPos = SetAllVector256<int>(8388608);
- static readonly Vector256<int> MantMask = SetAllVector256<int>(-2139095041);
+ static readonly Vector256<float> MaxValue = Vector256.Create(88.0f);
+ static readonly Vector256<float> MinValue = Vector256.Create(-88.0f);
+ static readonly Vector256<float> Log2 = Vector256.Create(1.44269502f);
+ static readonly Vector256<float> C1 = Vector256.Create(0.693359375f);
+ static readonly Vector256<float> C2 = Vector256.Create(-0.0002121944417f);
+ static readonly Vector256<float> P0 = Vector256.Create(0.0001987569121f);
+ static readonly Vector256<float> P1 = Vector256.Create(0.001398199936f);
+ static readonly Vector256<float> P2 = Vector256.Create(0.008333452046f);
+ static readonly Vector256<float> P3 = Vector256.Create(0.04166579619f);
+ static readonly Vector256<float> P4 = Vector256.Create(0.1666666567f);
+ static readonly Vector256<float> LogP0 = Vector256.Create(0.07037683576f);
+ static readonly Vector256<float> LogP1 = Vector256.Create(-0.1151461005f);
+ static readonly Vector256<float> LogP2 = Vector256.Create(0.1167699844f);
+ static readonly Vector256<float> LogP3 = Vector256.Create(-0.1242014095f);
+ static readonly Vector256<float> LogP4 = Vector256.Create(0.1424932331f);
+ static readonly Vector256<float> LogP5 = Vector256.Create(-0.1666805744f);
+ static readonly Vector256<float> LogP6 = Vector256.Create(0.2000071406f);
+ static readonly Vector256<float> LogP7 = Vector256.Create(-0.2499999404f);
+ static readonly Vector256<float> LogP8 = Vector256.Create(0.3333333135f);
+ static readonly Vector256<float> LogQ1 = Vector256.Create(-0.0002121944417f);
+ static readonly Vector256<float> LogQ2 = Vector256.Create(0.693359375f);
+ static readonly Vector256<float> Point5 = Vector256.Create(0.5f);
+ static readonly Vector256<float> Sqrthf = Vector256.Create(0.7071067691f);
+ static readonly Vector256<float> One = Vector256.Create(1.0f);
+ static readonly Vector256<int> Ox7 = Vector256.Create(127);
+ static readonly Vector256<int> MinNormPos = Vector256.Create(8388608);
+ static readonly Vector256<int> MantMask = Vector256.Create(-2139095041);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector256<float> Pow(Vector256<float> left, Vector256<float> right)
@@ -70,16 +70,16 @@ public static class VectorMath
pow2n = Avx2.Add(pow2n, Ox7);
pow2n = Avx2.ShiftLeftLogical(pow2n, 23);
- return Multiply(y, StaticCast<int, float>(pow2n));
+ return Multiply(y, pow2n.AsSingle());
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector256<float> Log(Vector256<float> value)
{
- Vector256<float> invalidMask = Compare(value, SetZeroVector256<float>(), FloatComparisonMode.LessThanOrEqualOrderedNonSignaling);
- Vector256<float> x = Max(value, StaticCast<int, float>(MinNormPos));
- Vector256<int> ei = Avx2.ShiftRightLogical(StaticCast<float, int>(x), 23);
- x = Or(And(x, StaticCast<int, float>(MantMask)), Point5);
+ Vector256<float> invalidMask = Compare(value, Vector256<float>.Zero, FloatComparisonMode.LessThanOrEqualOrderedNonSignaling);
+ Vector256<float> x = Max(value, MinNormPos.AsSingle());
+ Vector256<int> ei = Avx2.ShiftRightLogical(x.AsInt32(), 23);
+ x = Or(And(x, MantMask.AsSingle()), Point5);
ei = Avx2.Subtract(ei, Ox7);
Vector256<float> e = Add(ConvertToVector256Single(ei), One);
Vector256<float> mask = Compare(x, Sqrthf, FloatComparisonMode.LessThanOrderedNonSignaling);
diff --git a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/VectorPacket.cs b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/VectorPacket.cs
index 6a108cbb1d..6cbc79b60f 100644
--- a/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/VectorPacket.cs
+++ b/tests/src/JIT/Performance/CodeQuality/HWIntrinsic/X86/PacketTracer/VectorPacket.cs
@@ -38,9 +38,9 @@ internal struct VectorPacket256
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public VectorPacket256(float xs, float ys, float zs)
{
- Xs = SetAllVector256(xs);
- Ys = SetAllVector256(ys);
- Zs = SetAllVector256(zs);
+ Xs = Vector256.Create(xs);
+ Ys = Vector256.Create(ys);
+ Zs = Vector256.Create(zs);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -55,9 +55,9 @@ internal struct VectorPacket256
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe VectorPacket256(float* vectors)
{
- Vector256<float> m03 = ExtendToVector256<float>(LoadVector128(&vectors[0])); // load lower halves
- Vector256<float> m14 = ExtendToVector256<float>(LoadVector128(&vectors[4]));
- Vector256<float> m25 = ExtendToVector256<float>(LoadVector128(&vectors[8]));
+ Vector256<float> m03 = LoadVector128(&vectors[0]).ToVector256(); // load lower halves
+ Vector256<float> m14 = LoadVector128(&vectors[4]).ToVector256();
+ Vector256<float> m25 = LoadVector128(&vectors[8]).ToVector256();
m03 = InsertVector128(m03, &vectors[12], 1); // load higher halves
m14 = InsertVector128(m14, &vectors[16], 1);
m25 = InsertVector128(m25, &vectors[20], 1);
@@ -85,16 +85,16 @@ internal struct VectorPacket256
var r14 = Shuffle(ryz, rxy, 3 << 6 | 1 << 4 | 2 << 2 | 0);
var r25 = Shuffle(rzx, ryz, 3 << 6 | 1 << 4 | 3 << 2 | 1);
- var m0 = GetLowerHalf<float>(r03);
- var m1 = GetLowerHalf<float>(r14);
- var m2 = GetLowerHalf<float>(r25);
+ var m0 = r03.GetLower();
+ var m1 = r14.GetLower();
+ var m2 = r25.GetLower();
var m3 = ExtractVector128(r03, 1);
var m4 = ExtractVector128(r14, 1);
var m5 = ExtractVector128(r25, 1);
- var _Xs = SetHighLow(m1, m0);
- var _ys = SetHighLow(m3, m2);
- var _Zs = SetHighLow(m5, m4);
+ var _Xs = Vector256.Create(m0, m1);
+ var _ys = Vector256.Create(m2, m3);
+ var _Zs = Vector256.Create(m4, m5);
return new VectorPacket256(_Xs, _ys, _Zs);
}