From: Tanner Gooding Date: Wed, 13 Nov 2019 23:41:01 +0000 (-0800) Subject: Adding tests for the new apis to convert between S.Numerics and S.R.Intrinsic vectors... X-Git-Tag: submit/tizen/20210909.063632~11030^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fee95aed7a9f8ee310bbab2f529d3d31aaee71f6;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Adding tests for the new apis to convert between S.Numerics and S.R.Intrinsic vectors (dotnet/coreclr#27481) * Updating Vector128.AsVector3 to have a functioning implementation * Adding test template metadata covering the new methods for converting between S.Numerics and S.R.Intrinsics * Regenerating the existing tests * Generating the new Vector conversion tests Commit migrated from https://github.com/dotnet/coreclr/commit/4b902f244e529b7596b1501eea6fdf27753b91ca --- diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Shared/GenerateTests.csx b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Shared/GenerateTests.csx index 28dca4f..13a54c5 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Shared/GenerateTests.csx +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Shared/GenerateTests.csx @@ -200,16 +200,31 @@ private static readonly (string templateFileName, Dictionary tem ("VectorZeroTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "Zero", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16" }), ("VectorZeroTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "Zero", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "16" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(byte)TestLibrary.Generator.GetByte()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(double)TestLibrary.Generator.GetDouble()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(short)TestLibrary.Generator.GetInt16()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(int)TestLibrary.Generator.GetInt32()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(long)TestLibrary.Generator.GetInt64()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(sbyte)TestLibrary.Generator.GetSByte()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(float)TestLibrary.Generator.GetSingle()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(ushort)TestLibrary.Generator.GetUInt16()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(uint)TestLibrary.Generator.GetUInt32()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "As", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(ulong)TestLibrary.Generator.GetUInt64()" }), + + ("VectorAsNumericsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "AsVector2", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["NumericsType"] = "Vector2", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()" }), + ("VectorAsNumericsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "AsVector3", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["NumericsType"] = "Vector3", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()" }), + ("VectorAsNumericsTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "AsVector4", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["NumericsType"] = "Vector4", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()" }), + + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "AsVector", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(byte)TestLibrary.Generator.GetByte()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "AsVector", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(double)TestLibrary.Generator.GetDouble()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "AsVector", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(short)TestLibrary.Generator.GetInt16()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "AsVector", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(int)TestLibrary.Generator.GetInt32()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "AsVector", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(long)TestLibrary.Generator.GetInt64()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "AsVector", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(sbyte)TestLibrary.Generator.GetSByte()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "AsVector", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(float)TestLibrary.Generator.GetSingle()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "AsVector", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(ushort)TestLibrary.Generator.GetUInt16()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "AsVector", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(uint)TestLibrary.Generator.GetUInt32()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector128_1", ["Method"] = "AsVector", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "16", ["NextValueOp"] = "(ulong)TestLibrary.Generator.GetUInt64()" }), ("VectorGetAndWithElementTest.template", new Dictionary { ["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 { ["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]" }), @@ -353,16 +368,27 @@ private static readonly (string templateFileName, Dictionary tem ("VectorZeroTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "Zero", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32" }), ("VectorZeroTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "Zero", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()" }), - ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(byte)TestLibrary.Generator.GetByte()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(double)TestLibrary.Generator.GetDouble()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(short)TestLibrary.Generator.GetInt16()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(int)TestLibrary.Generator.GetInt32()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(long)TestLibrary.Generator.GetInt64()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(sbyte)TestLibrary.Generator.GetSByte()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(float)TestLibrary.Generator.GetSingle()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(ushort)TestLibrary.Generator.GetUInt16()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(uint)TestLibrary.Generator.GetUInt32()" }), + ("VectorAsTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "As", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(ulong)TestLibrary.Generator.GetUInt64()" }), + + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "AsVector", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(byte)TestLibrary.Generator.GetByte()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "AsVector", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(double)TestLibrary.Generator.GetDouble()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "AsVector", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(short)TestLibrary.Generator.GetInt16()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "AsVector", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(int)TestLibrary.Generator.GetInt32()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "AsVector", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(long)TestLibrary.Generator.GetInt64()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "AsVector", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(sbyte)TestLibrary.Generator.GetSByte()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "AsVector", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(float)TestLibrary.Generator.GetSingle()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "AsVector", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(ushort)TestLibrary.Generator.GetUInt16()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "AsVector", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(uint)TestLibrary.Generator.GetUInt32()" }), + ("VectorAsNumericsVectorTest.template", new Dictionary { ["Isa"] = "Vector256_1", ["Method"] = "AsVector", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["NumericsType"] = "Vector", ["LargestVectorSize"] = "32", ["NextValueOp"] = "(ulong)TestLibrary.Generator.GetUInt64()" }), ("VectorGetAndWithElementTest.template", new Dictionary { ["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 { ["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]" }), diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorAsNumericsTest.template b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorAsNumericsTest.template new file mode 100644 index 0000000..239b2c7 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorAsNumericsTest.template @@ -0,0 +1,148 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Numerics; +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 calling 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 VectorElementCount = Unsafe.SizeOf<{VectorType}<{BaseType}>>() / sizeof({BaseType}); + + private static readonly int NumericsElementCount = Unsafe.SizeOf<{NumericsType}>() / sizeof({BaseType}); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + {VectorType}<{BaseType}> value; + + value = {VectorType}.Create({NextValueOp}); + {NumericsType} result = value.As{NumericsType}(); + ValidateResult(result, value); + + value = result.As{VectorType}(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + {VectorType}<{BaseType}> value; + + value = {VectorType}.Create({NextValueOp}); + object Result = typeof({VectorType}) + .GetMethod(nameof({VectorType}.As{NumericsType})) + .Invoke(null, new object[] { value }); + ValidateResult(({NumericsType})(Result), value); + + value = ({VectorType}<{BaseType}>)typeof({VectorType}) + .GetMethod(nameof({VectorType}.As{VectorType}), new Type[] { typeof({NumericsType}) }) + .Invoke(null, new object[] { Result }); + ValidateResult(value, ({NumericsType})(Result)); + } + + private void ValidateResult({NumericsType} result, {VectorType}<{BaseType}> value, [CallerMemberName] string method = "") + { + {BaseType}[] resultElements = new {BaseType}[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref resultElements[0]), result); + + {BaseType}[] valueElements = new {BaseType}[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult({VectorType}<{BaseType}> result, {NumericsType} value, [CallerMemberName] string method = "") + { + {BaseType}[] resultElements = new {BaseType}[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref resultElements[0]), result); + + {BaseType}[] valueElements = new {BaseType}[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult({BaseType}[] resultElements, {BaseType}[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}>.{Method}: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorAsNumericsVectorTest.template b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorAsNumericsVectorTest.template new file mode 100644 index 0000000..4cbd2bb --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorAsNumericsVectorTest.template @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +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 calling 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 VectorElementCount = Unsafe.SizeOf<{VectorType}<{BaseType}>>() / sizeof({BaseType}); + + private static readonly int NumericsElementCount = Unsafe.SizeOf<{NumericsType}<{BaseType}>>() / sizeof({BaseType}); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + {VectorType}<{BaseType}> value; + + value = {VectorType}.Create({NextValueOp}); + {NumericsType}<{BaseType}> result = value.AsVector(); + ValidateResult(result, value); + + value = result.As{VectorType}(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + {VectorType}<{BaseType}> value; + + value = {VectorType}.Create({NextValueOp}); + object Result = typeof({VectorType}) + .GetMethod(nameof({VectorType}.AsVector)) + .MakeGenericMethod(typeof({BaseType})) + .Invoke(null, new object[] { value }); + ValidateResult(({NumericsType}<{BaseType}>)(Result), value); + + value = ({VectorType}<{BaseType}>)typeof({VectorType}) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof({VectorType}.As{VectorType})) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof({NumericsType}<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof({BaseType})) + .Invoke(null, new object[] { Result }); + ValidateResult(value, ({NumericsType}<{BaseType}>)(Result)); + } + + private void ValidateResult({NumericsType}<{BaseType}> result, {VectorType}<{BaseType}> value, [CallerMemberName] string method = "") + { + {BaseType}[] resultElements = new {BaseType}[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref resultElements[0]), result); + + {BaseType}[] valueElements = new {BaseType}[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult({VectorType}<{BaseType}> result, {NumericsType}<{BaseType}> value, [CallerMemberName] string method = "") + { + {BaseType}[] resultElements = new {BaseType}[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref resultElements[0]), result); + + {BaseType}[] valueElements = new {BaseType}[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As<{BaseType}, byte>(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult({BaseType}[] resultElements, {BaseType}[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"{VectorType}<{BaseType}>.{Method}: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Byte.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Byte.cs index e08c250..c78d132 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Byte.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Byte.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 intResult = value.As(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 longResult = value.As(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); Vector128 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); object byteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsByte)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(byteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); object doubleResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsDouble)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(doubleResult), value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); object shortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt16)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(shortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); object intResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt32)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(intResult), value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); object longResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt64)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(longResult), value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); object sbyteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSByte)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(sbyteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); object floatResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSingle)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(floatResult), value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); object ushortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt16)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(ushortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); object uintResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt32)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(uintResult), value); - value = Vector128.Create(TestLibrary.Generator.GetByte()); + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); object ulongResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt64)) .MakeGenericMethod(typeof(Byte)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Double.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Double.cs index 9124824..2e176c4 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Double.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Double.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 intResult = value.As(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 longResult = value.As(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); Vector128 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); object byteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsByte)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(byteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); object doubleResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsDouble)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(doubleResult), value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); object shortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt16)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(shortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); object intResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt32)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(intResult), value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); object longResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt64)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(longResult), value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); object sbyteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSByte)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(sbyteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); object floatResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSingle)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(floatResult), value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); object ushortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt16)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(ushortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); object uintResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt32)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(uintResult), value); - value = Vector128.Create(TestLibrary.Generator.GetDouble()); + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); object ulongResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt64)) .MakeGenericMethod(typeof(Double)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int16.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int16.cs index 98ba477..254e228 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int16.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int16.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 intResult = value.As(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 longResult = value.As(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); Vector128 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); object byteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsByte)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(byteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); object doubleResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsDouble)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(doubleResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); object shortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt16)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(shortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); object intResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt32)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(intResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); object longResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt64)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(longResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); object sbyteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSByte)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(sbyteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); object floatResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSingle)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(floatResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); object ushortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt16)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(ushortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); object uintResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt32)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(uintResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt16()); + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); object ulongResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt64)) .MakeGenericMethod(typeof(Int16)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int32.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int32.cs index bf35ffd..ee7f4a3 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int32.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int32.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 intResult = value.As(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 longResult = value.As(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); Vector128 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); object byteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsByte)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(byteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); object doubleResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsDouble)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(doubleResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); object shortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt16)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(shortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); object intResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt32)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(intResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); object longResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt64)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(longResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); object sbyteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSByte)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(sbyteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); object floatResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSingle)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(floatResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); object ushortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt16)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(ushortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); object uintResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt32)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(uintResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt32()); + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); object ulongResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt64)) .MakeGenericMethod(typeof(Int32)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int64.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int64.cs index 1ec98ac..e3aaeca 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int64.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Int64.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 intResult = value.As(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 longResult = value.As(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); Vector128 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); object byteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsByte)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(byteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); object doubleResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsDouble)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(doubleResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); object shortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt16)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(shortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); object intResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt32)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(intResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); object longResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt64)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(longResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); object sbyteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSByte)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(sbyteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); object floatResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSingle)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(floatResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); object ushortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt16)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(ushortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); object uintResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt32)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(uintResult), value); - value = Vector128.Create(TestLibrary.Generator.GetInt64()); + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); object ulongResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt64)) .MakeGenericMethod(typeof(Int64)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.SByte.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.SByte.cs index a7ca785..6029c32 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.SByte.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.SByte.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 intResult = value.As(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 longResult = value.As(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector128 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); object byteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsByte)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(byteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); object doubleResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsDouble)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(doubleResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); object shortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt16)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(shortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); object intResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt32)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(intResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); object longResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt64)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(longResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); object sbyteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSByte)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(sbyteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); object floatResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSingle)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(floatResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); object ushortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt16)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(ushortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); object uintResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt32)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(uintResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSByte()); + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); object ulongResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt64)) .MakeGenericMethod(typeof(SByte)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Single.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Single.cs index 990e4ec..58b3428 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Single.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.Single.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 intResult = value.As(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 longResult = value.As(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); Vector128 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); object byteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsByte)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(byteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); object doubleResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsDouble)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(doubleResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); object shortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt16)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(shortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); object intResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt32)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(intResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); object longResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt64)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(longResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); object sbyteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSByte)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(sbyteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); object floatResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSingle)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(floatResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); object ushortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt16)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(ushortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); object uintResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt32)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(uintResult), value); - value = Vector128.Create(TestLibrary.Generator.GetSingle()); + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); object ulongResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt64)) .MakeGenericMethod(typeof(Single)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt16.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt16.cs index 21f892e..b7d4d3d 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt16.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt16.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 intResult = value.As(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 longResult = value.As(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector128 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); object byteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsByte)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(byteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); object doubleResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsDouble)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(doubleResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); object shortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt16)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(shortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); object intResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt32)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(intResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); object longResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt64)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(longResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); object sbyteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSByte)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(sbyteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); object floatResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSingle)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(floatResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); object ushortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt16)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(ushortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); object uintResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt32)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(uintResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt16()); + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); object ulongResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt64)) .MakeGenericMethod(typeof(UInt16)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt32.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt32.cs index 4a1c2f5..a85289b 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt32.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt32.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 intResult = value.As(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 longResult = value.As(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); Vector128 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); object byteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsByte)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(byteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); object doubleResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsDouble)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(doubleResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); object shortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt16)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(shortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); object intResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt32)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(intResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); object longResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt64)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(longResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); object sbyteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSByte)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(sbyteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); object floatResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSingle)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(floatResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); object ushortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt16)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(ushortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); object uintResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt32)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(uintResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt32()); + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); object ulongResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt64)) .MakeGenericMethod(typeof(UInt32)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt64.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt64.cs index 27321f9..3c81793 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt64.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/As.UInt64.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 intResult = value.As(); ValidateResult(intResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 longResult = value.As(); ValidateResult(longResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector128 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector128 value; - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); object byteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsByte)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(byteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); object doubleResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsDouble)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(doubleResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); object shortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt16)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(shortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); object intResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt32)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(intResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); object longResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsInt64)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(longResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); object sbyteResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSByte)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(sbyteResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); object floatResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsSingle)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(floatResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); object ushortResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt16)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(ushortResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); object uintResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt32)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector128)(uintResult), value); - value = Vector128.Create(TestLibrary.Generator.GetUInt64()); + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); object ulongResult = typeof(Vector128) .GetMethod(nameof(Vector128.AsUInt64)) .MakeGenericMethod(typeof(UInt64)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Byte.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Byte.cs new file mode 100644 index 0000000..8b51c95 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Byte.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorByte() + { + var test = new VectorAs__AsVectorByte(); + + // 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 VectorAs__AsVectorByte + { + private static readonly int LargestVectorSize = 16; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Byte); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(Byte); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector128 value; + + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector128(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector128 value; + + value = Vector128.Create((byte)TestLibrary.Generator.GetByte()); + object Result = typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector)) + .MakeGenericMethod(typeof(Byte)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector128)typeof(Vector128) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector128.AsVector128)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(Byte)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector128 value, [CallerMemberName] string method = "") + { + Byte[] resultElements = new Byte[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Byte[] valueElements = new Byte[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector128 result, Vector value, [CallerMemberName] string method = "") + { + Byte[] resultElements = new Byte[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Byte[] valueElements = new Byte[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Byte[] resultElements, Byte[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Double.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Double.cs new file mode 100644 index 0000000..0db7a5f --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Double.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorDouble() + { + var test = new VectorAs__AsVectorDouble(); + + // 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 VectorAs__AsVectorDouble + { + private static readonly int LargestVectorSize = 16; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Double); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(Double); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector128 value; + + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector128(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector128 value; + + value = Vector128.Create((double)TestLibrary.Generator.GetDouble()); + object Result = typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector)) + .MakeGenericMethod(typeof(Double)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector128)typeof(Vector128) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector128.AsVector128)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(Double)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector128 value, [CallerMemberName] string method = "") + { + Double[] resultElements = new Double[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Double[] valueElements = new Double[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector128 result, Vector value, [CallerMemberName] string method = "") + { + Double[] resultElements = new Double[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Double[] valueElements = new Double[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Double[] resultElements, Double[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Int16.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Int16.cs new file mode 100644 index 0000000..a064aa9 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Int16.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorInt16() + { + var test = new VectorAs__AsVectorInt16(); + + // 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 VectorAs__AsVectorInt16 + { + private static readonly int LargestVectorSize = 16; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Int16); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(Int16); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector128 value; + + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector128(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector128 value; + + value = Vector128.Create((short)TestLibrary.Generator.GetInt16()); + object Result = typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector)) + .MakeGenericMethod(typeof(Int16)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector128)typeof(Vector128) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector128.AsVector128)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(Int16)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector128 value, [CallerMemberName] string method = "") + { + Int16[] resultElements = new Int16[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Int16[] valueElements = new Int16[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector128 result, Vector value, [CallerMemberName] string method = "") + { + Int16[] resultElements = new Int16[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Int16[] valueElements = new Int16[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Int16[] resultElements, Int16[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Int32.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Int32.cs new file mode 100644 index 0000000..bedd3e4 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Int32.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorInt32() + { + var test = new VectorAs__AsVectorInt32(); + + // 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 VectorAs__AsVectorInt32 + { + private static readonly int LargestVectorSize = 16; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Int32); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(Int32); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector128 value; + + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector128(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector128 value; + + value = Vector128.Create((int)TestLibrary.Generator.GetInt32()); + object Result = typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector)) + .MakeGenericMethod(typeof(Int32)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector128)typeof(Vector128) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector128.AsVector128)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(Int32)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector128 value, [CallerMemberName] string method = "") + { + Int32[] resultElements = new Int32[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Int32[] valueElements = new Int32[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector128 result, Vector value, [CallerMemberName] string method = "") + { + Int32[] resultElements = new Int32[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Int32[] valueElements = new Int32[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Int32[] resultElements, Int32[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Int64.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Int64.cs new file mode 100644 index 0000000..74b95a8 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Int64.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorInt64() + { + var test = new VectorAs__AsVectorInt64(); + + // 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 VectorAs__AsVectorInt64 + { + private static readonly int LargestVectorSize = 16; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Int64); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(Int64); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector128 value; + + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector128(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector128 value; + + value = Vector128.Create((long)TestLibrary.Generator.GetInt64()); + object Result = typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector)) + .MakeGenericMethod(typeof(Int64)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector128)typeof(Vector128) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector128.AsVector128)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(Int64)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector128 value, [CallerMemberName] string method = "") + { + Int64[] resultElements = new Int64[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Int64[] valueElements = new Int64[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector128 result, Vector value, [CallerMemberName] string method = "") + { + Int64[] resultElements = new Int64[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Int64[] valueElements = new Int64[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Int64[] resultElements, Int64[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.SByte.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.SByte.cs new file mode 100644 index 0000000..01276b8 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.SByte.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorSByte() + { + var test = new VectorAs__AsVectorSByte(); + + // 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 VectorAs__AsVectorSByte + { + private static readonly int LargestVectorSize = 16; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(SByte); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(SByte); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector128 value; + + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector128(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector128 value; + + value = Vector128.Create((sbyte)TestLibrary.Generator.GetSByte()); + object Result = typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector)) + .MakeGenericMethod(typeof(SByte)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector128)typeof(Vector128) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector128.AsVector128)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(SByte)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector128 value, [CallerMemberName] string method = "") + { + SByte[] resultElements = new SByte[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + SByte[] valueElements = new SByte[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector128 result, Vector value, [CallerMemberName] string method = "") + { + SByte[] resultElements = new SByte[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + SByte[] valueElements = new SByte[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(SByte[] resultElements, SByte[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Single.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Single.cs new file mode 100644 index 0000000..03277bb --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.Single.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorSingle() + { + var test = new VectorAs__AsVectorSingle(); + + // 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 VectorAs__AsVectorSingle + { + private static readonly int LargestVectorSize = 16; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Single); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(Single); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector128 value; + + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector128(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector128 value; + + value = Vector128.Create((float)TestLibrary.Generator.GetSingle()); + object Result = typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector)) + .MakeGenericMethod(typeof(Single)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector128)typeof(Vector128) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector128.AsVector128)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(Single)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector128 value, [CallerMemberName] string method = "") + { + Single[] resultElements = new Single[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Single[] valueElements = new Single[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector128 result, Vector value, [CallerMemberName] string method = "") + { + Single[] resultElements = new Single[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Single[] valueElements = new Single[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Single[] resultElements, Single[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.UInt16.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.UInt16.cs new file mode 100644 index 0000000..0be39b1 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.UInt16.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorUInt16() + { + var test = new VectorAs__AsVectorUInt16(); + + // 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 VectorAs__AsVectorUInt16 + { + private static readonly int LargestVectorSize = 16; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(UInt16); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(UInt16); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector128 value; + + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector128(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector128 value; + + value = Vector128.Create((ushort)TestLibrary.Generator.GetUInt16()); + object Result = typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector)) + .MakeGenericMethod(typeof(UInt16)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector128)typeof(Vector128) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector128.AsVector128)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(UInt16)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector128 value, [CallerMemberName] string method = "") + { + UInt16[] resultElements = new UInt16[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + UInt16[] valueElements = new UInt16[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector128 result, Vector value, [CallerMemberName] string method = "") + { + UInt16[] resultElements = new UInt16[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + UInt16[] valueElements = new UInt16[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(UInt16[] resultElements, UInt16[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.UInt32.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.UInt32.cs new file mode 100644 index 0000000..49f5db5 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.UInt32.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorUInt32() + { + var test = new VectorAs__AsVectorUInt32(); + + // 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 VectorAs__AsVectorUInt32 + { + private static readonly int LargestVectorSize = 16; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(UInt32); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(UInt32); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector128 value; + + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector128(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector128 value; + + value = Vector128.Create((uint)TestLibrary.Generator.GetUInt32()); + object Result = typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector)) + .MakeGenericMethod(typeof(UInt32)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector128)typeof(Vector128) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector128.AsVector128)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(UInt32)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector128 value, [CallerMemberName] string method = "") + { + UInt32[] resultElements = new UInt32[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + UInt32[] valueElements = new UInt32[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector128 result, Vector value, [CallerMemberName] string method = "") + { + UInt32[] resultElements = new UInt32[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + UInt32[] valueElements = new UInt32[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(UInt32[] resultElements, UInt32[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.UInt64.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.UInt64.cs new file mode 100644 index 0000000..35a5620 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector.UInt64.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorUInt64() + { + var test = new VectorAs__AsVectorUInt64(); + + // 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 VectorAs__AsVectorUInt64 + { + private static readonly int LargestVectorSize = 16; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(UInt64); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(UInt64); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector128 value; + + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector128(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector128 value; + + value = Vector128.Create((ulong)TestLibrary.Generator.GetUInt64()); + object Result = typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector)) + .MakeGenericMethod(typeof(UInt64)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector128)typeof(Vector128) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector128.AsVector128)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(UInt64)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector128 value, [CallerMemberName] string method = "") + { + UInt64[] resultElements = new UInt64[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + UInt64[] valueElements = new UInt64[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector128 result, Vector value, [CallerMemberName] string method = "") + { + UInt64[] resultElements = new UInt64[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + UInt64[] valueElements = new UInt64[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(UInt64[] resultElements, UInt64[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector2.Single.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector2.Single.cs new file mode 100644 index 0000000..6f54642 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector2.Single.cs @@ -0,0 +1,148 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVector2Single() + { + var test = new VectorAs__AsVector2Single(); + + // 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 VectorAs__AsVector2Single + { + private static readonly int LargestVectorSize = 16; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Single); + + private static readonly int NumericsElementCount = Unsafe.SizeOf() / sizeof(Single); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector128 value; + + value = Vector128.Create(TestLibrary.Generator.GetSingle()); + Vector2 result = value.AsVector2(); + ValidateResult(result, value); + + value = result.AsVector128(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector128 value; + + value = Vector128.Create(TestLibrary.Generator.GetSingle()); + object Result = typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector2)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector2)(Result), value); + + value = (Vector128)typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector128), new Type[] { typeof(Vector2) }) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector2)(Result)); + } + + private void ValidateResult(Vector2 result, Vector128 value, [CallerMemberName] string method = "") + { + Single[] resultElements = new Single[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Single[] valueElements = new Single[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector128 result, Vector2 value, [CallerMemberName] string method = "") + { + Single[] resultElements = new Single[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Single[] valueElements = new Single[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Single[] resultElements, Single[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128.AsVector2: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector3.Single.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector3.Single.cs new file mode 100644 index 0000000..d3431cb --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector3.Single.cs @@ -0,0 +1,148 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVector3Single() + { + var test = new VectorAs__AsVector3Single(); + + // 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 VectorAs__AsVector3Single + { + private static readonly int LargestVectorSize = 16; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Single); + + private static readonly int NumericsElementCount = Unsafe.SizeOf() / sizeof(Single); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector128 value; + + value = Vector128.Create(TestLibrary.Generator.GetSingle()); + Vector3 result = value.AsVector3(); + ValidateResult(result, value); + + value = result.AsVector128(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector128 value; + + value = Vector128.Create(TestLibrary.Generator.GetSingle()); + object Result = typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector3)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector3)(Result), value); + + value = (Vector128)typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector128), new Type[] { typeof(Vector3) }) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector3)(Result)); + } + + private void ValidateResult(Vector3 result, Vector128 value, [CallerMemberName] string method = "") + { + Single[] resultElements = new Single[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Single[] valueElements = new Single[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector128 result, Vector3 value, [CallerMemberName] string method = "") + { + Single[] resultElements = new Single[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Single[] valueElements = new Single[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Single[] resultElements, Single[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128.AsVector3: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector4.Single.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector4.Single.cs new file mode 100644 index 0000000..facc875 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/AsVector4.Single.cs @@ -0,0 +1,148 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVector4Single() + { + var test = new VectorAs__AsVector4Single(); + + // 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 VectorAs__AsVector4Single + { + private static readonly int LargestVectorSize = 16; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Single); + + private static readonly int NumericsElementCount = Unsafe.SizeOf() / sizeof(Single); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector128 value; + + value = Vector128.Create(TestLibrary.Generator.GetSingle()); + Vector4 result = value.AsVector4(); + ValidateResult(result, value); + + value = result.AsVector128(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector128 value; + + value = Vector128.Create(TestLibrary.Generator.GetSingle()); + object Result = typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector4)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector4)(Result), value); + + value = (Vector128)typeof(Vector128) + .GetMethod(nameof(Vector128.AsVector128), new Type[] { typeof(Vector4) }) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector4)(Result)); + } + + private void ValidateResult(Vector4 result, Vector128 value, [CallerMemberName] string method = "") + { + Single[] resultElements = new Single[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Single[] valueElements = new Single[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector128 result, Vector4 value, [CallerMemberName] string method = "") + { + Single[] resultElements = new Single[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Single[] valueElements = new Single[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Single[] resultElements, Single[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128.AsVector4: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Program.Vector128_1.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Program.Vector128_1.cs index 370d6dc..d20b224 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Program.Vector128_1.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Program.Vector128_1.cs @@ -32,6 +32,19 @@ namespace JIT.HardwareIntrinsics.General ["As.UInt16"] = AsUInt16, ["As.UInt32"] = AsUInt32, ["As.UInt64"] = AsUInt64, + ["AsVector2.Single"] = AsVector2Single, + ["AsVector3.Single"] = AsVector3Single, + ["AsVector4.Single"] = AsVector4Single, + ["AsVector.Byte"] = AsVectorByte, + ["AsVector.Double"] = AsVectorDouble, + ["AsVector.Int16"] = AsVectorInt16, + ["AsVector.Int32"] = AsVectorInt32, + ["AsVector.Int64"] = AsVectorInt64, + ["AsVector.SByte"] = AsVectorSByte, + ["AsVector.Single"] = AsVectorSingle, + ["AsVector.UInt16"] = AsVectorUInt16, + ["AsVector.UInt32"] = AsVectorUInt32, + ["AsVector.UInt64"] = AsVectorUInt64, ["GetAndWithElement.Byte.0"] = GetAndWithElementByte0, ["GetAndWithElement.Byte.7"] = GetAndWithElementByte7, ["GetAndWithElement.Byte.15"] = GetAndWithElementByte15, diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_r.csproj b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_r.csproj index ae12675..461789a 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_r.csproj +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_r.csproj @@ -18,6 +18,19 @@ + + + + + + + + + + + + + diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_ro.csproj b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_ro.csproj index bd0242c..3a91a6f 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_ro.csproj +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_ro.csproj @@ -18,6 +18,19 @@ + + + + + + + + + + + + + diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Byte.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Byte.cs index 2015313..9191e1f 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Byte.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Byte.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 intResult = value.As(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 longResult = value.As(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); Vector256 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); object byteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsByte)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(byteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); object doubleResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsDouble)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(doubleResult), value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); object shortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt16)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(shortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); object intResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt32)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(intResult), value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); object longResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt64)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(longResult), value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); object sbyteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSByte)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(sbyteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); object floatResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSingle)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(floatResult), value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); object ushortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt16)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(ushortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); object uintResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt32)) .MakeGenericMethod(typeof(Byte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(uintResult), value); - value = Vector256.Create(TestLibrary.Generator.GetByte()); + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); object ulongResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt64)) .MakeGenericMethod(typeof(Byte)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Double.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Double.cs index 69f4e01..542c1da 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Double.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Double.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 intResult = value.As(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 longResult = value.As(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); Vector256 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); object byteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsByte)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(byteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); object doubleResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsDouble)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(doubleResult), value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); object shortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt16)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(shortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); object intResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt32)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(intResult), value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); object longResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt64)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(longResult), value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); object sbyteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSByte)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(sbyteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); object floatResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSingle)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(floatResult), value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); object ushortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt16)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(ushortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); object uintResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt32)) .MakeGenericMethod(typeof(Double)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(uintResult), value); - value = Vector256.Create(TestLibrary.Generator.GetDouble()); + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); object ulongResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt64)) .MakeGenericMethod(typeof(Double)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int16.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int16.cs index 094971d..5e2688f 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int16.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int16.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 intResult = value.As(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 longResult = value.As(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); Vector256 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); object byteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsByte)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(byteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); object doubleResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsDouble)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(doubleResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); object shortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt16)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(shortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); object intResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt32)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(intResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); object longResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt64)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(longResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); object sbyteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSByte)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(sbyteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); object floatResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSingle)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(floatResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); object ushortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt16)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(ushortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); object uintResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt32)) .MakeGenericMethod(typeof(Int16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(uintResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt16()); + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); object ulongResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt64)) .MakeGenericMethod(typeof(Int16)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int32.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int32.cs index 09c19be..13bfefc 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int32.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int32.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 intResult = value.As(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 longResult = value.As(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); Vector256 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); object byteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsByte)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(byteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); object doubleResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsDouble)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(doubleResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); object shortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt16)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(shortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); object intResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt32)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(intResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); object longResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt64)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(longResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); object sbyteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSByte)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(sbyteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); object floatResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSingle)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(floatResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); object ushortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt16)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(ushortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); object uintResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt32)) .MakeGenericMethod(typeof(Int32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(uintResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt32()); + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); object ulongResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt64)) .MakeGenericMethod(typeof(Int32)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int64.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int64.cs index 0bea200..ba52cec 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int64.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Int64.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 intResult = value.As(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 longResult = value.As(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); Vector256 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); object byteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsByte)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(byteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); object doubleResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsDouble)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(doubleResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); object shortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt16)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(shortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); object intResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt32)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(intResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); object longResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt64)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(longResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); object sbyteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSByte)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(sbyteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); object floatResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSingle)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(floatResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); object ushortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt16)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(ushortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); object uintResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt32)) .MakeGenericMethod(typeof(Int64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(uintResult), value); - value = Vector256.Create(TestLibrary.Generator.GetInt64()); + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); object ulongResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt64)) .MakeGenericMethod(typeof(Int64)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.SByte.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.SByte.cs index 3bd14a0..a9d631e 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.SByte.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.SByte.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 intResult = value.As(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 longResult = value.As(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); Vector256 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); object byteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsByte)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(byteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); object doubleResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsDouble)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(doubleResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); object shortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt16)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(shortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); object intResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt32)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(intResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); object longResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt64)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(longResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); object sbyteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSByte)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(sbyteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); object floatResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSingle)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(floatResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); object ushortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt16)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(ushortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); object uintResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt32)) .MakeGenericMethod(typeof(SByte)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(uintResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSByte()); + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); object ulongResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt64)) .MakeGenericMethod(typeof(SByte)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Single.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Single.cs index d921f57..8a1c71e 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Single.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.Single.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 intResult = value.As(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 longResult = value.As(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); Vector256 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); object byteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsByte)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(byteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); object doubleResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsDouble)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(doubleResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); object shortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt16)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(shortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); object intResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt32)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(intResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); object longResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt64)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(longResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); object sbyteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSByte)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(sbyteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); object floatResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSingle)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(floatResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); object ushortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt16)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(ushortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); object uintResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt32)) .MakeGenericMethod(typeof(Single)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(uintResult), value); - value = Vector256.Create(TestLibrary.Generator.GetSingle()); + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); object ulongResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt64)) .MakeGenericMethod(typeof(Single)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt16.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt16.cs index 02af220..9025b61 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt16.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt16.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 intResult = value.As(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 longResult = value.As(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); Vector256 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); object byteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsByte)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(byteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); object doubleResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsDouble)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(doubleResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); object shortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt16)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(shortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); object intResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt32)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(intResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); object longResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt64)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(longResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); object sbyteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSByte)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(sbyteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); object floatResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSingle)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(floatResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); object ushortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt16)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(ushortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); object uintResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt32)) .MakeGenericMethod(typeof(UInt16)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(uintResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt16()); + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); object ulongResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt64)) .MakeGenericMethod(typeof(UInt16)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt32.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt32.cs index 8db55b5..85c0800 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt32.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt32.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 intResult = value.As(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 longResult = value.As(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); Vector256 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); object byteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsByte)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(byteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); object doubleResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsDouble)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(doubleResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); object shortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt16)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(shortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); object intResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt32)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(intResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); object longResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt64)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(longResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); object sbyteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSByte)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(sbyteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); object floatResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSingle)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(floatResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); object ushortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt16)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(ushortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); object uintResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt32)) .MakeGenericMethod(typeof(UInt32)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(uintResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt32()); + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); object ulongResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt64)) .MakeGenericMethod(typeof(UInt32)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt64.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt64.cs index 0808d05..e056156 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt64.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/As.UInt64.cs @@ -51,43 +51,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 byteResult = value.AsByte(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 doubleResult = value.AsDouble(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 shortResult = value.AsInt16(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 intResult = value.AsInt32(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 longResult = value.AsInt64(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 sbyteResult = value.AsSByte(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 floatResult = value.AsSingle(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 ushortResult = value.AsUInt16(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 uintResult = value.AsUInt32(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 ulongResult = value.AsUInt64(); ValidateResult(ulongResult, value); } @@ -97,43 +97,43 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunGenericScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 byteResult = value.As(); ValidateResult(byteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 doubleResult = value.As(); ValidateResult(doubleResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 shortResult = value.As(); ValidateResult(shortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 intResult = value.As(); ValidateResult(intResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 longResult = value.As(); ValidateResult(longResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 sbyteResult = value.As(); ValidateResult(sbyteResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 floatResult = value.As(); ValidateResult(floatResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 ushortResult = value.As(); ValidateResult(ushortResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 uintResult = value.As(); ValidateResult(uintResult, value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); Vector256 ulongResult = value.As(); ValidateResult(ulongResult, value); } @@ -143,70 +143,70 @@ namespace JIT.HardwareIntrinsics.General TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Vector256 value; - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); object byteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsByte)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(byteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); object doubleResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsDouble)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(doubleResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); object shortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt16)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(shortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); object intResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt32)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(intResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); object longResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsInt64)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(longResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); object sbyteResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSByte)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(sbyteResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); object floatResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsSingle)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(floatResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); object ushortResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt16)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(ushortResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); object uintResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt32)) .MakeGenericMethod(typeof(UInt64)) .Invoke(null, new object[] { value }); ValidateResult((Vector256)(uintResult), value); - value = Vector256.Create(TestLibrary.Generator.GetUInt64()); + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); object ulongResult = typeof(Vector256) .GetMethod(nameof(Vector256.AsUInt64)) .MakeGenericMethod(typeof(UInt64)) diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Byte.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Byte.cs new file mode 100644 index 0000000..d768bd5 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Byte.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorByte() + { + var test = new VectorAs__AsVectorByte(); + + // 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 VectorAs__AsVectorByte + { + private static readonly int LargestVectorSize = 32; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Byte); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(Byte); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector256 value; + + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector256(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector256 value; + + value = Vector256.Create((byte)TestLibrary.Generator.GetByte()); + object Result = typeof(Vector256) + .GetMethod(nameof(Vector256.AsVector)) + .MakeGenericMethod(typeof(Byte)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector256)typeof(Vector256) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector256.AsVector256)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(Byte)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector256 value, [CallerMemberName] string method = "") + { + Byte[] resultElements = new Byte[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Byte[] valueElements = new Byte[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector256 result, Vector value, [CallerMemberName] string method = "") + { + Byte[] resultElements = new Byte[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Byte[] valueElements = new Byte[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Byte[] resultElements, Byte[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Double.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Double.cs new file mode 100644 index 0000000..a421577 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Double.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorDouble() + { + var test = new VectorAs__AsVectorDouble(); + + // 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 VectorAs__AsVectorDouble + { + private static readonly int LargestVectorSize = 32; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Double); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(Double); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector256 value; + + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector256(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector256 value; + + value = Vector256.Create((double)TestLibrary.Generator.GetDouble()); + object Result = typeof(Vector256) + .GetMethod(nameof(Vector256.AsVector)) + .MakeGenericMethod(typeof(Double)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector256)typeof(Vector256) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector256.AsVector256)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(Double)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector256 value, [CallerMemberName] string method = "") + { + Double[] resultElements = new Double[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Double[] valueElements = new Double[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector256 result, Vector value, [CallerMemberName] string method = "") + { + Double[] resultElements = new Double[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Double[] valueElements = new Double[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Double[] resultElements, Double[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Int16.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Int16.cs new file mode 100644 index 0000000..8391d3f --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Int16.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorInt16() + { + var test = new VectorAs__AsVectorInt16(); + + // 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 VectorAs__AsVectorInt16 + { + private static readonly int LargestVectorSize = 32; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Int16); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(Int16); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector256 value; + + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector256(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector256 value; + + value = Vector256.Create((short)TestLibrary.Generator.GetInt16()); + object Result = typeof(Vector256) + .GetMethod(nameof(Vector256.AsVector)) + .MakeGenericMethod(typeof(Int16)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector256)typeof(Vector256) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector256.AsVector256)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(Int16)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector256 value, [CallerMemberName] string method = "") + { + Int16[] resultElements = new Int16[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Int16[] valueElements = new Int16[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector256 result, Vector value, [CallerMemberName] string method = "") + { + Int16[] resultElements = new Int16[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Int16[] valueElements = new Int16[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Int16[] resultElements, Int16[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Int32.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Int32.cs new file mode 100644 index 0000000..5bb4a7c --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Int32.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorInt32() + { + var test = new VectorAs__AsVectorInt32(); + + // 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 VectorAs__AsVectorInt32 + { + private static readonly int LargestVectorSize = 32; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Int32); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(Int32); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector256 value; + + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector256(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector256 value; + + value = Vector256.Create((int)TestLibrary.Generator.GetInt32()); + object Result = typeof(Vector256) + .GetMethod(nameof(Vector256.AsVector)) + .MakeGenericMethod(typeof(Int32)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector256)typeof(Vector256) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector256.AsVector256)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(Int32)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector256 value, [CallerMemberName] string method = "") + { + Int32[] resultElements = new Int32[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Int32[] valueElements = new Int32[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector256 result, Vector value, [CallerMemberName] string method = "") + { + Int32[] resultElements = new Int32[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Int32[] valueElements = new Int32[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Int32[] resultElements, Int32[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Int64.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Int64.cs new file mode 100644 index 0000000..70a045d --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Int64.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorInt64() + { + var test = new VectorAs__AsVectorInt64(); + + // 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 VectorAs__AsVectorInt64 + { + private static readonly int LargestVectorSize = 32; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Int64); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(Int64); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector256 value; + + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector256(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector256 value; + + value = Vector256.Create((long)TestLibrary.Generator.GetInt64()); + object Result = typeof(Vector256) + .GetMethod(nameof(Vector256.AsVector)) + .MakeGenericMethod(typeof(Int64)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector256)typeof(Vector256) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector256.AsVector256)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(Int64)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector256 value, [CallerMemberName] string method = "") + { + Int64[] resultElements = new Int64[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Int64[] valueElements = new Int64[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector256 result, Vector value, [CallerMemberName] string method = "") + { + Int64[] resultElements = new Int64[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Int64[] valueElements = new Int64[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Int64[] resultElements, Int64[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.SByte.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.SByte.cs new file mode 100644 index 0000000..017a6b0 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.SByte.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorSByte() + { + var test = new VectorAs__AsVectorSByte(); + + // 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 VectorAs__AsVectorSByte + { + private static readonly int LargestVectorSize = 32; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(SByte); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(SByte); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector256 value; + + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector256(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector256 value; + + value = Vector256.Create((sbyte)TestLibrary.Generator.GetSByte()); + object Result = typeof(Vector256) + .GetMethod(nameof(Vector256.AsVector)) + .MakeGenericMethod(typeof(SByte)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector256)typeof(Vector256) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector256.AsVector256)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(SByte)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector256 value, [CallerMemberName] string method = "") + { + SByte[] resultElements = new SByte[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + SByte[] valueElements = new SByte[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector256 result, Vector value, [CallerMemberName] string method = "") + { + SByte[] resultElements = new SByte[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + SByte[] valueElements = new SByte[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(SByte[] resultElements, SByte[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Single.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Single.cs new file mode 100644 index 0000000..2874cfc --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.Single.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorSingle() + { + var test = new VectorAs__AsVectorSingle(); + + // 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 VectorAs__AsVectorSingle + { + private static readonly int LargestVectorSize = 32; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(Single); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(Single); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector256 value; + + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector256(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector256 value; + + value = Vector256.Create((float)TestLibrary.Generator.GetSingle()); + object Result = typeof(Vector256) + .GetMethod(nameof(Vector256.AsVector)) + .MakeGenericMethod(typeof(Single)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector256)typeof(Vector256) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector256.AsVector256)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(Single)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector256 value, [CallerMemberName] string method = "") + { + Single[] resultElements = new Single[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Single[] valueElements = new Single[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector256 result, Vector value, [CallerMemberName] string method = "") + { + Single[] resultElements = new Single[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + Single[] valueElements = new Single[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Single[] resultElements, Single[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.UInt16.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.UInt16.cs new file mode 100644 index 0000000..ede41db --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.UInt16.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorUInt16() + { + var test = new VectorAs__AsVectorUInt16(); + + // 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 VectorAs__AsVectorUInt16 + { + private static readonly int LargestVectorSize = 32; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(UInt16); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(UInt16); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector256 value; + + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector256(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector256 value; + + value = Vector256.Create((ushort)TestLibrary.Generator.GetUInt16()); + object Result = typeof(Vector256) + .GetMethod(nameof(Vector256.AsVector)) + .MakeGenericMethod(typeof(UInt16)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector256)typeof(Vector256) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector256.AsVector256)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(UInt16)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector256 value, [CallerMemberName] string method = "") + { + UInt16[] resultElements = new UInt16[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + UInt16[] valueElements = new UInt16[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector256 result, Vector value, [CallerMemberName] string method = "") + { + UInt16[] resultElements = new UInt16[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + UInt16[] valueElements = new UInt16[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(UInt16[] resultElements, UInt16[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.UInt32.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.UInt32.cs new file mode 100644 index 0000000..4ba2624 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.UInt32.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorUInt32() + { + var test = new VectorAs__AsVectorUInt32(); + + // 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 VectorAs__AsVectorUInt32 + { + private static readonly int LargestVectorSize = 32; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(UInt32); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(UInt32); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector256 value; + + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector256(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector256 value; + + value = Vector256.Create((uint)TestLibrary.Generator.GetUInt32()); + object Result = typeof(Vector256) + .GetMethod(nameof(Vector256.AsVector)) + .MakeGenericMethod(typeof(UInt32)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector256)typeof(Vector256) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector256.AsVector256)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(UInt32)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector256 value, [CallerMemberName] string method = "") + { + UInt32[] resultElements = new UInt32[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + UInt32[] valueElements = new UInt32[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector256 result, Vector value, [CallerMemberName] string method = "") + { + UInt32[] resultElements = new UInt32[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + UInt32[] valueElements = new UInt32[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(UInt32[] resultElements, UInt32[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.UInt64.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.UInt64.cs new file mode 100644 index 0000000..1342823 --- /dev/null +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/AsVector.UInt64.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Linq; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void AsVectorUInt64() + { + var test = new VectorAs__AsVectorUInt64(); + + // 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 VectorAs__AsVectorUInt64 + { + private static readonly int LargestVectorSize = 32; + + private static readonly int VectorElementCount = Unsafe.SizeOf>() / sizeof(UInt64); + + private static readonly int NumericsElementCount = Unsafe.SizeOf>() / sizeof(UInt64); + + public bool Succeeded { get; set; } = true; + + public void RunBasicScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); + Vector256 value; + + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); + Vector result = value.AsVector(); + ValidateResult(result, value); + + value = result.AsVector256(); + ValidateResult(value, result); + } + + public void RunReflectionScenario() + { + TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); + Vector256 value; + + value = Vector256.Create((ulong)TestLibrary.Generator.GetUInt64()); + object Result = typeof(Vector256) + .GetMethod(nameof(Vector256.AsVector)) + .MakeGenericMethod(typeof(UInt64)) + .Invoke(null, new object[] { value }); + ValidateResult((Vector)(Result), value); + + value = (Vector256)typeof(Vector256) + .GetMethods() + .Where((methodInfo) => { + if (methodInfo.Name == nameof(Vector256.AsVector256)) + { + var parameters = methodInfo.GetParameters(); + return (parameters.Length == 1) && + (parameters[0].ParameterType.IsGenericType) && + (parameters[0].ParameterType.GetGenericTypeDefinition() == typeof(Vector<>)); + } + return false; + }) + .Single() + .MakeGenericMethod(typeof(UInt64)) + .Invoke(null, new object[] { Result }); + ValidateResult(value, (Vector)(Result)); + } + + private void ValidateResult(Vector result, Vector256 value, [CallerMemberName] string method = "") + { + UInt64[] resultElements = new UInt64[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + UInt64[] valueElements = new UInt64[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(Vector256 result, Vector value, [CallerMemberName] string method = "") + { + UInt64[] resultElements = new UInt64[VectorElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref resultElements[0]), result); + + UInt64[] valueElements = new UInt64[NumericsElementCount]; + Unsafe.WriteUnaligned(ref Unsafe.As(ref valueElements[0]), value); + + ValidateResult(resultElements, valueElements, method); + } + + private void ValidateResult(UInt64[] resultElements, UInt64[] valueElements, [CallerMemberName] string method = "") + { + bool succeeded = true; + + if (resultElements.Length <= valueElements.Length) + { + for (var i = 0; i < resultElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + } + else + { + for (var i = 0; i < valueElements.Length; i++) + { + if (resultElements[i] != valueElements[i]) + { + succeeded = false; + break; + } + } + + for (var i = valueElements.Length; i < resultElements.Length; i++) + { + if (resultElements[i] != default) + { + succeeded = false; + break; + } + } + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256.AsVector: {method} failed:"); + TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", valueElements)})"); + TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + Succeeded = false; + } + } + } +} diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Program.Vector256_1.cs b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Program.Vector256_1.cs index 5d28a4f..7db1c54 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Program.Vector256_1.cs +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Program.Vector256_1.cs @@ -32,6 +32,16 @@ namespace JIT.HardwareIntrinsics.General ["As.UInt16"] = AsUInt16, ["As.UInt32"] = AsUInt32, ["As.UInt64"] = AsUInt64, + ["AsVector.Byte"] = AsVectorByte, + ["AsVector.Double"] = AsVectorDouble, + ["AsVector.Int16"] = AsVectorInt16, + ["AsVector.Int32"] = AsVectorInt32, + ["AsVector.Int64"] = AsVectorInt64, + ["AsVector.SByte"] = AsVectorSByte, + ["AsVector.Single"] = AsVectorSingle, + ["AsVector.UInt16"] = AsVectorUInt16, + ["AsVector.UInt32"] = AsVectorUInt32, + ["AsVector.UInt64"] = AsVectorUInt64, ["GetAndWithElement.Byte.0"] = GetAndWithElementByte0, ["GetAndWithElement.Byte.7"] = GetAndWithElementByte7, ["GetAndWithElement.Byte.15"] = GetAndWithElementByte15, diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_r.csproj b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_r.csproj index f31ca37..d7e666d 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_r.csproj +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_r.csproj @@ -18,6 +18,16 @@ + + + + + + + + + + diff --git a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_ro.csproj b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_ro.csproj index b30e3a9..d166ec9 100644 --- a/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_ro.csproj +++ b/src/coreclr/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_ro.csproj @@ -18,6 +18,16 @@ + + + + + + + + + + diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs index 85c1471..a3ca363 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs @@ -223,7 +223,7 @@ namespace System.Runtime.Intrinsics /// reinterpreted as a new . public static Vector3 AsVector3(this Vector128 value) { - throw new PlatformNotSupportedException(); + return Unsafe.As, Vector3>(ref value); } /// Reinterprets a as a new .