From d505b49a285f6cd7776230fb7f0d73d3ac20b73a Mon Sep 17 00:00:00 2001 From: Ganbarukamo41 Date: Tue, 25 Jun 2019 04:44:50 +0900 Subject: [PATCH] Make Vector*.ToString() Culture invariant (#25343) * Remove IFormattable * Hardcode characters * Add tests --- .../System/Runtime/Intrinsics/Vector128_1.cs | 36 ++++------------ .../System/Runtime/Intrinsics/Vector256_1.cs | 36 ++++------------ .../shared/System/Runtime/Intrinsics/Vector64_1.cs | 36 ++++------------ .../General/NotSupported/NotSupported_r.csproj | 3 ++ .../General/NotSupported/NotSupported_ro.csproj | 3 ++ .../General/NotSupported/Program.NotSupported.cs | 3 ++ .../General/NotSupported/Vector128ToString.cs | 43 +++++++++++++++++++ .../General/NotSupported/Vector256ToString.cs | 43 +++++++++++++++++++ .../General/NotSupported/Vector64ToString.cs | 43 +++++++++++++++++++ .../General/Shared/GenerateTests.csx | 36 ++++++++++++++++ .../General/Shared/VectorToStringTest.template | 50 ++++++++++++++++++++++ .../General/Vector128_1/Program.Vector128_1.cs | 10 +++++ .../General/Vector128_1/ToString.Byte.cs | 50 ++++++++++++++++++++++ .../General/Vector128_1/ToString.Double.cs | 50 ++++++++++++++++++++++ .../General/Vector128_1/ToString.Int16.cs | 50 ++++++++++++++++++++++ .../General/Vector128_1/ToString.Int32.cs | 50 ++++++++++++++++++++++ .../General/Vector128_1/ToString.Int64.cs | 50 ++++++++++++++++++++++ .../General/Vector128_1/ToString.SByte.cs | 50 ++++++++++++++++++++++ .../General/Vector128_1/ToString.Single.cs | 50 ++++++++++++++++++++++ .../General/Vector128_1/ToString.UInt16.cs | 50 ++++++++++++++++++++++ .../General/Vector128_1/ToString.UInt32.cs | 50 ++++++++++++++++++++++ .../General/Vector128_1/ToString.UInt64.cs | 50 ++++++++++++++++++++++ .../General/Vector128_1/Vector128_1_r.csproj | 10 +++++ .../General/Vector128_1/Vector128_1_ro.csproj | 10 +++++ .../General/Vector256_1/Program.Vector256_1.cs | 10 +++++ .../General/Vector256_1/ToString.Byte.cs | 50 ++++++++++++++++++++++ .../General/Vector256_1/ToString.Double.cs | 50 ++++++++++++++++++++++ .../General/Vector256_1/ToString.Int16.cs | 50 ++++++++++++++++++++++ .../General/Vector256_1/ToString.Int32.cs | 50 ++++++++++++++++++++++ .../General/Vector256_1/ToString.Int64.cs | 50 ++++++++++++++++++++++ .../General/Vector256_1/ToString.SByte.cs | 50 ++++++++++++++++++++++ .../General/Vector256_1/ToString.Single.cs | 50 ++++++++++++++++++++++ .../General/Vector256_1/ToString.UInt16.cs | 50 ++++++++++++++++++++++ .../General/Vector256_1/ToString.UInt32.cs | 50 ++++++++++++++++++++++ .../General/Vector256_1/ToString.UInt64.cs | 50 ++++++++++++++++++++++ .../General/Vector256_1/Vector256_1_r.csproj | 10 +++++ .../General/Vector256_1/Vector256_1_ro.csproj | 10 +++++ .../General/Vector64_1/Program.Vector64_1.cs | 10 +++++ .../General/Vector64_1/ToString.Byte.cs | 50 ++++++++++++++++++++++ .../General/Vector64_1/ToString.Double.cs | 50 ++++++++++++++++++++++ .../General/Vector64_1/ToString.Int16.cs | 50 ++++++++++++++++++++++ .../General/Vector64_1/ToString.Int32.cs | 50 ++++++++++++++++++++++ .../General/Vector64_1/ToString.Int64.cs | 50 ++++++++++++++++++++++ .../General/Vector64_1/ToString.SByte.cs | 50 ++++++++++++++++++++++ .../General/Vector64_1/ToString.Single.cs | 50 ++++++++++++++++++++++ .../General/Vector64_1/ToString.UInt16.cs | 50 ++++++++++++++++++++++ .../General/Vector64_1/ToString.UInt32.cs | 50 ++++++++++++++++++++++ .../General/Vector64_1/ToString.UInt64.cs | 50 ++++++++++++++++++++++ .../General/Vector64_1/Vector64_1_r.csproj | 10 +++++ .../General/Vector64_1/Vector64_1_ro.csproj | 10 +++++ 50 files changed, 1838 insertions(+), 84 deletions(-) create mode 100644 tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToString.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256ToString.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToString.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Shared/VectorToStringTest.template create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Byte.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Double.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Int16.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Int32.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Int64.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.SByte.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Single.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.UInt16.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.UInt32.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.UInt64.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Byte.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Double.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Int16.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Int32.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Int64.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.SByte.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Single.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.UInt16.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.UInt32.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.UInt64.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Byte.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Double.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Int16.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Int32.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Int64.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.SByte.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Single.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.UInt16.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.UInt32.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.UInt64.cs diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector128_1.cs b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector128_1.cs index 9f609ea..4fda50c 100644 --- a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector128_1.cs +++ b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector128_1.cs @@ -27,7 +27,7 @@ namespace System.Runtime.Intrinsics [DebuggerDisplay("{DisplayString,nq}")] [DebuggerTypeProxy(typeof(Vector128DebugView<>))] [StructLayout(LayoutKind.Sequential, Size = Vector128.Size)] - public readonly struct Vector128 : IEquatable>, IFormattable + public readonly struct Vector128 : IEquatable> where T : struct { // These fields exist to ensure the alignment is 8, rather than 1. @@ -173,42 +173,22 @@ namespace System.Runtime.Intrinsics /// The type of the current instance () is not supported. public override string ToString() { - return ToString("G"); - } - - /// Converts the current instance to an equivalent string representation using the specified format. - /// The format specifier used to format the individual elements of the current instance. - /// An equivalent string representation of the current instance. - /// The type of the current instance () is not supported. - public string ToString(string? format) - { - return ToString(format, formatProvider: null); - } - - /// Converts the current instance to an equivalent string representation using the specified format. - /// The format specifier used to format the individual elements of the current instance. - /// The format provider used to format the individual elements of the current instance. - /// An equivalent string representation of the current instance. - /// The type of the current instance () is not supported. - public string ToString(string? format, IFormatProvider? formatProvider) - { ThrowHelper.ThrowForUnsupportedVectorBaseType(); - string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; int lastElement = Count - 1; + StringBuilder sb = StringBuilderCache.Acquire(); + CultureInfo invariant = CultureInfo.InvariantCulture; - var sb = StringBuilderCache.Acquire(); sb.Append('<'); - for (int i = 0; i < lastElement; i++) { - sb.Append(((IFormattable)(this.GetElement(i))).ToString(format, formatProvider)); - sb.Append(separator); - sb.Append(' '); + sb.Append(((IFormattable)this.GetElement(i)).ToString("G", invariant)) + .Append(',') + .Append(' '); } - sb.Append(((IFormattable)(this.GetElement(lastElement))).ToString(format, formatProvider)); + sb.Append(((IFormattable)this.GetElement(lastElement)).ToString("G", invariant)) + .Append('>'); - sb.Append('>'); return StringBuilderCache.GetStringAndRelease(sb); } } diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256_1.cs b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256_1.cs index 0a9b993..59f8102 100644 --- a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256_1.cs +++ b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256_1.cs @@ -27,7 +27,7 @@ namespace System.Runtime.Intrinsics [DebuggerDisplay("{DisplayString,nq}")] [DebuggerTypeProxy(typeof(Vector256DebugView<>))] [StructLayout(LayoutKind.Sequential, Size = Vector256.Size)] - public readonly struct Vector256 : IEquatable>, IFormattable + public readonly struct Vector256 : IEquatable> where T : struct { // These fields exist to ensure the alignment is 8, rather than 1. @@ -174,42 +174,22 @@ namespace System.Runtime.Intrinsics /// The type of the current instance () is not supported. public override string ToString() { - return ToString("G"); - } - - /// Converts the current instance to an equivalent string representation using the specified format. - /// The format specifier used to format the individual elements of the current instance. - /// An equivalent string representation of the current instance. - /// The type of the current instance () is not supported. - public string ToString(string? format) - { - return ToString(format, formatProvider: null); - } - - /// Converts the current instance to an equivalent string representation using the specified format. - /// The format specifier used to format the individual elements of the current instance. - /// The format provider used to format the individual elements of the current instance. - /// An equivalent string representation of the current instance. - /// The type of the current instance () is not supported. - public string ToString(string? format, IFormatProvider? formatProvider) - { ThrowHelper.ThrowForUnsupportedVectorBaseType(); - string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; int lastElement = Count - 1; + StringBuilder sb = StringBuilderCache.Acquire(); + CultureInfo invariant = CultureInfo.InvariantCulture; - var sb = StringBuilderCache.Acquire(); sb.Append('<'); - for (int i = 0; i < lastElement; i++) { - sb.Append(((IFormattable)(this.GetElement(i))).ToString(format, formatProvider)); - sb.Append(separator); - sb.Append(' '); + sb.Append(((IFormattable)this.GetElement(i)).ToString("G", invariant)) + .Append(',') + .Append(' '); } - sb.Append(((IFormattable)(this.GetElement(lastElement))).ToString(format, formatProvider)); + sb.Append(((IFormattable)this.GetElement(lastElement)).ToString("G", invariant)) + .Append('>'); - sb.Append('>'); return StringBuilderCache.GetStringAndRelease(sb); } } diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector64_1.cs b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector64_1.cs index 7b8f75a..af66c55 100644 --- a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector64_1.cs +++ b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector64_1.cs @@ -15,7 +15,7 @@ namespace System.Runtime.Intrinsics [DebuggerDisplay("{DisplayString,nq}")] [DebuggerTypeProxy(typeof(Vector64DebugView<>))] [StructLayout(LayoutKind.Sequential, Size = Vector64.Size)] - public readonly struct Vector64 : IEquatable>, IFormattable + public readonly struct Vector64 : IEquatable> where T : struct { // These fields exist to ensure the alignment is 8, rather than 1. @@ -127,42 +127,22 @@ namespace System.Runtime.Intrinsics /// The type of the current instance () is not supported. public override string ToString() { - return ToString("G"); - } - - /// Converts the current instance to an equivalent string representation using the specified format. - /// The format specifier used to format the individual elements of the current instance. - /// An equivalent string representation of the current instance. - /// The type of the current instance () is not supported. - public string ToString(string? format) - { - return ToString(format, formatProvider: null); - } - - /// Converts the current instance to an equivalent string representation using the specified format. - /// The format specifier used to format the individual elements of the current instance. - /// The format provider used to format the individual elements of the current instance. - /// An equivalent string representation of the current instance. - /// The type of the current instance () is not supported. - public string ToString(string? format, IFormatProvider? formatProvider) - { ThrowHelper.ThrowForUnsupportedVectorBaseType(); - string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; int lastElement = Count - 1; + StringBuilder sb = StringBuilderCache.Acquire(); + CultureInfo invariant = CultureInfo.InvariantCulture; - var sb = StringBuilderCache.Acquire(); sb.Append('<'); - for (int i = 0; i < lastElement; i++) { - sb.Append(((IFormattable)(this.GetElement(i))).ToString(format, formatProvider)); - sb.Append(separator); - sb.Append(' '); + sb.Append(((IFormattable)this.GetElement(i)).ToString("G", invariant)) + .Append(',') + .Append(' '); } - sb.Append(((IFormattable)(this.GetElement(lastElement))).ToString(format, formatProvider)); + sb.Append(((IFormattable)this.GetElement(lastElement)).ToString("G", invariant)) + .Append('>'); - sb.Append('>'); return StringBuilderCache.GetStringAndRelease(sb); } } diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_r.csproj b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_r.csproj index ac76cd8..37b92fe 100644 --- a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_r.csproj +++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_r.csproj @@ -66,6 +66,7 @@ + @@ -111,6 +112,7 @@ + @@ -156,6 +158,7 @@ + diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_ro.csproj b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_ro.csproj index 5132936..81dbe9c 100644 --- a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_ro.csproj +++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/NotSupported_ro.csproj @@ -66,6 +66,7 @@ + @@ -111,6 +112,7 @@ + @@ -156,6 +158,7 @@ + diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Program.NotSupported.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Program.NotSupported.cs index 6c3a923..8c6ac23 100644 --- a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Program.NotSupported.cs +++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Program.NotSupported.cs @@ -53,6 +53,7 @@ namespace JIT.HardwareIntrinsics.General ["Vector64ToScalar"] = Vector64ToScalar, ["Vector64ToVector128"] = Vector64ToVector128, ["Vector64ToVector128Unsafe"] = Vector64ToVector128Unsafe, + ["Vector64ToString"] = Vector64ToString, ["Vector128Zero"] = Vector128Zero, ["Vector128BooleanAsGeneric_Boolean"] = Vector128BooleanAsGeneric_Boolean, ["Vector128ByteAsGeneric_Boolean"] = Vector128ByteAsGeneric_Boolean, @@ -98,6 +99,7 @@ namespace JIT.HardwareIntrinsics.General ["Vector128ToScalar"] = Vector128ToScalar, ["Vector128ToVector256"] = Vector128ToVector256, ["Vector128ToVector256Unsafe"] = Vector128ToVector256Unsafe, + ["Vector128ToString"] = Vector128ToString, ["Vector256Zero"] = Vector256Zero, ["Vector256BooleanAsGeneric_Boolean"] = Vector256BooleanAsGeneric_Boolean, ["Vector256ByteAsGeneric_Boolean"] = Vector256ByteAsGeneric_Boolean, @@ -141,6 +143,7 @@ namespace JIT.HardwareIntrinsics.General ["Vector256GetUpper"] = Vector256GetUpper, ["Vector256WithUpper"] = Vector256WithUpper, ["Vector256ToScalar"] = Vector256ToScalar, + ["Vector256ToString"] = Vector256ToString, }; } } diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToString.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToString.cs new file mode 100644 index 0000000..8cbafad --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector128ToString.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void Vector128ToString() + { + bool succeeded = false; + + try + { + string result = default(Vector128).ToString(); + } + catch (NotSupportedException) + { + succeeded = true; + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128ToString: RunNotSupportedScenario failed to throw NotSupportedException."); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256ToString.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256ToString.cs new file mode 100644 index 0000000..83a8d26 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector256ToString.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void Vector256ToString() + { + bool succeeded = false; + + try + { + string result = default(Vector256).ToString(); + } + catch (NotSupportedException) + { + succeeded = true; + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256ToString: RunNotSupportedScenario failed to throw NotSupportedException."); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToString.cs b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToString.cs new file mode 100644 index 0000000..c96a1ff --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/NotSupported/Vector64ToString.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make * + * changes, please update the corresponding template and run according to the * + * directions listed in the file. * + ******************************************************************************/ + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private static void Vector64ToString() + { + bool succeeded = false; + + try + { + string result = default(Vector64).ToString(); + } + catch (NotSupportedException) + { + succeeded = true; + } + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector64ToString: RunNotSupportedScenario failed to throw NotSupportedException."); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/GenerateTests.csx b/tests/src/JIT/HardwareIntrinsics/General/Shared/GenerateTests.csx index 71edaa9..28dca4f 100644 --- a/tests/src/JIT/HardwareIntrinsics/General/Shared/GenerateTests.csx +++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/GenerateTests.csx @@ -118,6 +118,17 @@ private static readonly (string templateFileName, Dictionary tem ("VectorExtendTest.template", new Dictionary { ["Isa"] = "Vector64", ["Method"] = "ToVector128", ["VectorType"] = "Vector64", ["BaseType"] = "UInt16", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }), ("VectorExtendTest.template", new Dictionary { ["Isa"] = "Vector64", ["Method"] = "ToVector128", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1]" }), ("VectorExtendTest.template", new Dictionary { ["Isa"] = "Vector64", ["Method"] = "ToVector128", ["VectorType"] = "Vector64", ["BaseType"] = "UInt64", ["TgtVectorType"] = "Vector128", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0]" }), + + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector64", ["Method"] = "ToString", ["VectorType"] = "Vector64", ["BaseType"] = "Byte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector64", ["Method"] = "ToString", ["VectorType"] = "Vector64", ["BaseType"] = "SByte", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector64", ["Method"] = "ToString", ["VectorType"] = "Vector64", ["BaseType"] = "Int16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector64", ["Method"] = "ToString", ["VectorType"] = "Vector64", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector64", ["Method"] = "ToString", ["VectorType"] = "Vector64", ["BaseType"] = "Int32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ConsumeValues"] = "values[0], values[1]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector64", ["Method"] = "ToString", ["VectorType"] = "Vector64", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector64", ["Method"] = "ToString", ["VectorType"] = "Vector64", ["BaseType"] = "Single", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ConsumeValues"] = "values[0], values[1]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector64", ["Method"] = "ToString", ["VectorType"] = "Vector64", ["BaseType"] = "Double", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ConsumeValues"] = "values[0]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector64", ["Method"] = "ToString", ["VectorType"] = "Vector64", ["BaseType"] = "Int64", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ConsumeValues"] = "values[0]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector64", ["Method"] = "ToString", ["VectorType"] = "Vector64", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "8", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0]" }), }; private static readonly (string templateFileName, Dictionary templateData)[] Vector128Inputs = new [] @@ -260,6 +271,17 @@ private static readonly (string templateFileName, Dictionary tem ("VectorExtendTest.template", new Dictionary { ["Isa"] = "Vector128", ["Method"] = "ToVector256", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["TgtVectorType"] = "Vector256", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }), ("VectorExtendTest.template", new Dictionary { ["Isa"] = "Vector128", ["Method"] = "ToVector256", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["TgtVectorType"] = "Vector256", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }), ("VectorExtendTest.template", new Dictionary { ["Isa"] = "Vector128", ["Method"] = "ToVector256", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["TgtVectorType"] = "Vector256", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0], values[1]" }), + + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector128", ["Method"] = "ToString", ["VectorType"] = "Vector128", ["BaseType"] = "Byte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector128", ["Method"] = "ToString", ["VectorType"] = "Vector128", ["BaseType"] = "SByte", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector128", ["Method"] = "ToString", ["VectorType"] = "Vector128", ["BaseType"] = "Int16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector128", ["Method"] = "ToString", ["VectorType"] = "Vector128", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector128", ["Method"] = "ToString", ["VectorType"] = "Vector128", ["BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector128", ["Method"] = "ToString", ["VectorType"] = "Vector128", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector128", ["Method"] = "ToString", ["VectorType"] = "Vector128", ["BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector128", ["Method"] = "ToString", ["VectorType"] = "Vector128", ["BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ConsumeValues"] = "values[0], values[1]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector128", ["Method"] = "ToString", ["VectorType"] = "Vector128", ["BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ConsumeValues"] = "values[0], values[1]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector128", ["Method"] = "ToString", ["VectorType"] = "Vector128", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0], values[1]" }), }; private static readonly (string templateFileName, Dictionary templateData)[] Vector256Inputs = new [] @@ -401,6 +423,17 @@ private static readonly (string templateFileName, Dictionary tem ("VectorToScalarTest.template", new Dictionary { ["Isa"] = "Vector256", ["Method"] = "ToScalar", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }), ("VectorToScalarTest.template", new Dictionary { ["Isa"] = "Vector256", ["Method"] = "ToScalar", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }), ("VectorToScalarTest.template", new Dictionary { ["Isa"] = "Vector256", ["Method"] = "ToScalar", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }), + + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector256", ["Method"] = "ToString", ["VectorType"] = "Vector256", ["BaseType"] = "Byte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector256", ["Method"] = "ToString", ["VectorType"] = "Vector256", ["BaseType"] = "SByte", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSByte()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector256", ["Method"] = "ToString", ["VectorType"] = "Vector256", ["BaseType"] = "Int16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector256", ["Method"] = "ToString", ["VectorType"] = "Vector256", ["BaseType"] = "UInt16", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt16()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector256", ["Method"] = "ToString", ["VectorType"] = "Vector256", ["BaseType"] = "Int32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector256", ["Method"] = "ToString", ["VectorType"] = "Vector256", ["BaseType"] = "UInt32", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt32()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector256", ["Method"] = "ToString", ["VectorType"] = "Vector256", ["BaseType"] = "Single", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetSingle()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector256", ["Method"] = "ToString", ["VectorType"] = "Vector256", ["BaseType"] = "Double", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetDouble()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector256", ["Method"] = "ToString", ["VectorType"] = "Vector256", ["BaseType"] = "Int64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetInt64()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }), + ("VectorToStringTest.template", new Dictionary {["Isa"] = "Vector256", ["Method"] = "ToString", ["VectorType"] = "Vector256", ["BaseType"] = "UInt64", ["LargestVectorSize"] = "32", ["NextValueOp"] = "TestLibrary.Generator.GetUInt64()", ["ConsumeValues"] = "values[0], values[1], values[2], values[3]" }), }; private static readonly (string templateFileName, Dictionary templateData)[] NotSupportedInputs = new [] @@ -446,6 +479,7 @@ private static readonly (string templateFileName, Dictionary tem ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector64ToScalar", ["TargetType"] = "bool", ["Source"] = "default(Vector64)", ["Method"] = "ToScalar()" }), ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector64ToVector128", ["TargetType"] = "Vector128", ["Source"] = "default(Vector64)", ["Method"] = "ToVector128()" }), ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector64ToVector128Unsafe", ["TargetType"] = "Vector128", ["Source"] = "default(Vector64)", ["Method"] = "ToVector128Unsafe()" }), + ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector64ToString", ["TargetType"] = "string", ["Source"] = "default(Vector64)", ["Method"] = "ToString()" }), ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector128Zero", ["TargetType"] = "Vector128", ["Source"] = "Vector128", ["Method"] = "Zero" }), ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector128BooleanAsGeneric_Boolean", ["TargetType"] = "Vector128", ["Source"] = "default(Vector128)", ["Method"] = "As()" }), @@ -492,6 +526,7 @@ private static readonly (string templateFileName, Dictionary tem ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector128ToScalar", ["TargetType"] = "bool", ["Source"] = "default(Vector128)", ["Method"] = "ToScalar()" }), ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector128ToVector256", ["TargetType"] = "Vector256", ["Source"] = "default(Vector128)", ["Method"] = "ToVector256()" }), ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector128ToVector256Unsafe", ["TargetType"] = "Vector256", ["Source"] = "default(Vector128)", ["Method"] = "ToVector256Unsafe()" }), + ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector128ToString", ["TargetType"] = "string", ["Source"] = "default(Vector128)", ["Method"] = "ToString()" }), ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector256Zero", ["TargetType"] = "Vector256", ["Source"] = "Vector256", ["Method"] = "Zero" }), ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector256BooleanAsGeneric_Boolean", ["TargetType"] = "Vector256", ["Source"] = "default(Vector256)", ["Method"] = "As()" }), @@ -536,6 +571,7 @@ private static readonly (string templateFileName, Dictionary tem ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector256GetUpper", ["TargetType"] = "Vector128", ["Source"] = "default(Vector256)", ["Method"] = "GetUpper()" }), ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector256WithUpper", ["TargetType"] = "Vector256", ["Source"] = "default(Vector256)", ["Method"] = "WithUpper(default(Vector128))" }), ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector256ToScalar", ["TargetType"] = "bool", ["Source"] = "default(Vector256)", ["Method"] = "ToScalar()" }), + ("VectorNotSupportedTest.template", new Dictionary { ["Isa"] = "NotSupported", ["Name"] = "Vector256ToString", ["TargetType"] = "string", ["Source"] = "default(Vector256)", ["Method"] = "ToString()" }), }; private static void ProcessInputs(string groupName, (string templateFileName, Dictionary templateData)[] inputs) diff --git a/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorToStringTest.template b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorToStringTest.template new file mode 100644 index 0000000..a54dc13 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Shared/VectorToStringTest.template @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void {Method}{BaseType}() + { + int size = Unsafe.SizeOf<{VectorType}<{BaseType}>>() / sizeof({BaseType}); + {BaseType}[] values = new {BaseType}[size]; + + for (int i = 0; i < size; i++) + { + values[i] = {NextValueOp}; + } + + {VectorType}<{BaseType}> vector = {VectorType}.Create({ConsumeValues}); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"{Isa}{BaseType}{Method}: {VectorType}<{BaseType}>.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Program.Vector128_1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Program.Vector128_1.cs index 24fed27..370d6dc 100644 --- a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Program.Vector128_1.cs +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Program.Vector128_1.cs @@ -89,6 +89,16 @@ namespace JIT.HardwareIntrinsics.General ["ToVector256.UInt16"] = ToVector256UInt16, ["ToVector256.UInt32"] = ToVector256UInt32, ["ToVector256.UInt64"] = ToVector256UInt64, + ["ToString.Byte"] = ToStringByte, + ["ToString.SByte"] = ToStringSByte, + ["ToString.Int16"] = ToStringInt16, + ["ToString.UInt16"] = ToStringUInt16, + ["ToString.Int32"] = ToStringInt32, + ["ToString.UInt32"] = ToStringUInt32, + ["ToString.Single"] = ToStringSingle, + ["ToString.Double"] = ToStringDouble, + ["ToString.Int64"] = ToStringInt64, + ["ToString.UInt64"] = ToStringUInt64, }; } } diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Byte.cs new file mode 100644 index 0000000..3e18366 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Byte.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringByte() + { + int size = Unsafe.SizeOf>() / sizeof(Byte); + Byte[] values = new Byte[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetByte(); + } + + Vector128 vector = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128ByteToString: Vector128.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Double.cs new file mode 100644 index 0000000..031ce53 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Double.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringDouble() + { + int size = Unsafe.SizeOf>() / sizeof(Double); + Double[] values = new Double[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetDouble(); + } + + Vector128 vector = Vector128.Create(values[0], values[1]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128DoubleToString: Vector128.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Int16.cs new file mode 100644 index 0000000..ba99452 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Int16.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringInt16() + { + int size = Unsafe.SizeOf>() / sizeof(Int16); + Int16[] values = new Int16[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetInt16(); + } + + Vector128 vector = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128Int16ToString: Vector128.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Int32.cs new file mode 100644 index 0000000..49dd98f --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Int32.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringInt32() + { + int size = Unsafe.SizeOf>() / sizeof(Int32); + Int32[] values = new Int32[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetInt32(); + } + + Vector128 vector = Vector128.Create(values[0], values[1], values[2], values[3]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128Int32ToString: Vector128.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Int64.cs new file mode 100644 index 0000000..96efb02 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Int64.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringInt64() + { + int size = Unsafe.SizeOf>() / sizeof(Int64); + Int64[] values = new Int64[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetInt64(); + } + + Vector128 vector = Vector128.Create(values[0], values[1]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128Int64ToString: Vector128.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.SByte.cs new file mode 100644 index 0000000..2894cd6 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.SByte.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringSByte() + { + int size = Unsafe.SizeOf>() / sizeof(SByte); + SByte[] values = new SByte[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetSByte(); + } + + Vector128 vector = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128SByteToString: Vector128.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Single.cs new file mode 100644 index 0000000..98d98b9 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.Single.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringSingle() + { + int size = Unsafe.SizeOf>() / sizeof(Single); + Single[] values = new Single[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetSingle(); + } + + Vector128 vector = Vector128.Create(values[0], values[1], values[2], values[3]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128SingleToString: Vector128.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.UInt16.cs new file mode 100644 index 0000000..122f15e --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.UInt16.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringUInt16() + { + int size = Unsafe.SizeOf>() / sizeof(UInt16); + UInt16[] values = new UInt16[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetUInt16(); + } + + Vector128 vector = Vector128.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128UInt16ToString: Vector128.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.UInt32.cs new file mode 100644 index 0000000..5f8f9f6 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.UInt32.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringUInt32() + { + int size = Unsafe.SizeOf>() / sizeof(UInt32); + UInt32[] values = new UInt32[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetUInt32(); + } + + Vector128 vector = Vector128.Create(values[0], values[1], values[2], values[3]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128UInt32ToString: Vector128.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.UInt64.cs new file mode 100644 index 0000000..1925356 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/ToString.UInt64.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringUInt64() + { + int size = Unsafe.SizeOf>() / sizeof(UInt64); + UInt64[] values = new UInt64[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetUInt64(); + } + + Vector128 vector = Vector128.Create(values[0], values[1]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector128UInt64ToString: Vector128.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_r.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_r.csproj index 7d92e92..ee13514 100644 --- a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_r.csproj +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_r.csproj @@ -85,6 +85,16 @@ + + + + + + + + + + diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_ro.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_ro.csproj index 1e52497..fe13f4e 100644 --- a/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_ro.csproj +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector128_1/Vector128_1_ro.csproj @@ -84,6 +84,16 @@ + + + + + + + + + + diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Program.Vector256_1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Program.Vector256_1.cs index 10918b0..5d28a4f 100644 --- a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Program.Vector256_1.cs +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Program.Vector256_1.cs @@ -89,6 +89,16 @@ namespace JIT.HardwareIntrinsics.General ["ToScalar.UInt16"] = ToScalarUInt16, ["ToScalar.UInt32"] = ToScalarUInt32, ["ToScalar.UInt64"] = ToScalarUInt64, + ["ToString.Byte"] = ToStringByte, + ["ToString.SByte"] = ToStringSByte, + ["ToString.Int16"] = ToStringInt16, + ["ToString.UInt16"] = ToStringUInt16, + ["ToString.Int32"] = ToStringInt32, + ["ToString.UInt32"] = ToStringUInt32, + ["ToString.Single"] = ToStringSingle, + ["ToString.Double"] = ToStringDouble, + ["ToString.Int64"] = ToStringInt64, + ["ToString.UInt64"] = ToStringUInt64, }; } } diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Byte.cs new file mode 100644 index 0000000..d586a37 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Byte.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringByte() + { + int size = Unsafe.SizeOf>() / sizeof(Byte); + Byte[] values = new Byte[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetByte(); + } + + Vector256 vector = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256ByteToString: Vector256.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Double.cs new file mode 100644 index 0000000..e348cc8 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Double.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringDouble() + { + int size = Unsafe.SizeOf>() / sizeof(Double); + Double[] values = new Double[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetDouble(); + } + + Vector256 vector = Vector256.Create(values[0], values[1], values[2], values[3]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256DoubleToString: Vector256.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Int16.cs new file mode 100644 index 0000000..81cff5f --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Int16.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringInt16() + { + int size = Unsafe.SizeOf>() / sizeof(Int16); + Int16[] values = new Int16[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetInt16(); + } + + Vector256 vector = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256Int16ToString: Vector256.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Int32.cs new file mode 100644 index 0000000..44023d2 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Int32.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringInt32() + { + int size = Unsafe.SizeOf>() / sizeof(Int32); + Int32[] values = new Int32[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetInt32(); + } + + Vector256 vector = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256Int32ToString: Vector256.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Int64.cs new file mode 100644 index 0000000..228da71 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Int64.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringInt64() + { + int size = Unsafe.SizeOf>() / sizeof(Int64); + Int64[] values = new Int64[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetInt64(); + } + + Vector256 vector = Vector256.Create(values[0], values[1], values[2], values[3]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256Int64ToString: Vector256.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.SByte.cs new file mode 100644 index 0000000..5a1cdc2 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.SByte.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringSByte() + { + int size = Unsafe.SizeOf>() / sizeof(SByte); + SByte[] values = new SByte[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetSByte(); + } + + Vector256 vector = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15], values[16], values[17], values[18], values[19], values[20], values[21], values[22], values[23], values[24], values[25], values[26], values[27], values[28], values[29], values[30], values[31]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256SByteToString: Vector256.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Single.cs new file mode 100644 index 0000000..cff279d --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.Single.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringSingle() + { + int size = Unsafe.SizeOf>() / sizeof(Single); + Single[] values = new Single[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetSingle(); + } + + Vector256 vector = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256SingleToString: Vector256.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.UInt16.cs new file mode 100644 index 0000000..629a26d --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.UInt16.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringUInt16() + { + int size = Unsafe.SizeOf>() / sizeof(UInt16); + UInt16[] values = new UInt16[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetUInt16(); + } + + Vector256 vector = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8], values[9], values[10], values[11], values[12], values[13], values[14], values[15]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256UInt16ToString: Vector256.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.UInt32.cs new file mode 100644 index 0000000..5de793c --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.UInt32.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringUInt32() + { + int size = Unsafe.SizeOf>() / sizeof(UInt32); + UInt32[] values = new UInt32[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetUInt32(); + } + + Vector256 vector = Vector256.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256UInt32ToString: Vector256.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.UInt64.cs new file mode 100644 index 0000000..cb75310 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/ToString.UInt64.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringUInt64() + { + int size = Unsafe.SizeOf>() / sizeof(UInt64); + UInt64[] values = new UInt64[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetUInt64(); + } + + Vector256 vector = Vector256.Create(values[0], values[1], values[2], values[3]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector256UInt64ToString: Vector256.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_r.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_r.csproj index b559e4a..1c2464c 100644 --- a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_r.csproj +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_r.csproj @@ -94,6 +94,16 @@ + + + + + + + + + + diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_ro.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_ro.csproj index da7f86b..b0494d1 100644 --- a/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_ro.csproj +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector256_1/Vector256_1_ro.csproj @@ -94,6 +94,16 @@ + + + + + + + + + + diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Program.Vector64_1.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Program.Vector64_1.cs index fc58fc8..3d51ad4 100644 --- a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Program.Vector64_1.cs +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Program.Vector64_1.cs @@ -69,6 +69,16 @@ namespace JIT.HardwareIntrinsics.General ["ToVector128.UInt16"] = ToVector128UInt16, ["ToVector128.UInt32"] = ToVector128UInt32, ["ToVector128.UInt64"] = ToVector128UInt64, + ["ToString.Byte"] = ToStringByte, + ["ToString.SByte"] = ToStringSByte, + ["ToString.Int16"] = ToStringInt16, + ["ToString.UInt16"] = ToStringUInt16, + ["ToString.Int32"] = ToStringInt32, + ["ToString.UInt32"] = ToStringUInt32, + ["ToString.Single"] = ToStringSingle, + ["ToString.Double"] = ToStringDouble, + ["ToString.Int64"] = ToStringInt64, + ["ToString.UInt64"] = ToStringUInt64, }; } } diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Byte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Byte.cs new file mode 100644 index 0000000..c5c049e --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Byte.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringByte() + { + int size = Unsafe.SizeOf>() / sizeof(Byte); + Byte[] values = new Byte[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetByte(); + } + + Vector64 vector = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector64ByteToString: Vector64.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Double.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Double.cs new file mode 100644 index 0000000..24cc68b --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Double.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringDouble() + { + int size = Unsafe.SizeOf>() / sizeof(Double); + Double[] values = new Double[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetDouble(); + } + + Vector64 vector = Vector64.Create(values[0]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector64DoubleToString: Vector64.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Int16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Int16.cs new file mode 100644 index 0000000..5d61e89 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Int16.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringInt16() + { + int size = Unsafe.SizeOf>() / sizeof(Int16); + Int16[] values = new Int16[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetInt16(); + } + + Vector64 vector = Vector64.Create(values[0], values[1], values[2], values[3]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector64Int16ToString: Vector64.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Int32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Int32.cs new file mode 100644 index 0000000..4228ec1 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Int32.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringInt32() + { + int size = Unsafe.SizeOf>() / sizeof(Int32); + Int32[] values = new Int32[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetInt32(); + } + + Vector64 vector = Vector64.Create(values[0], values[1]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector64Int32ToString: Vector64.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Int64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Int64.cs new file mode 100644 index 0000000..382d9af --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Int64.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringInt64() + { + int size = Unsafe.SizeOf>() / sizeof(Int64); + Int64[] values = new Int64[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetInt64(); + } + + Vector64 vector = Vector64.Create(values[0]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector64Int64ToString: Vector64.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.SByte.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.SByte.cs new file mode 100644 index 0000000..066fe07 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.SByte.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringSByte() + { + int size = Unsafe.SizeOf>() / sizeof(SByte); + SByte[] values = new SByte[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetSByte(); + } + + Vector64 vector = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector64SByteToString: Vector64.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Single.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Single.cs new file mode 100644 index 0000000..e7a907a --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.Single.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringSingle() + { + int size = Unsafe.SizeOf>() / sizeof(Single); + Single[] values = new Single[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetSingle(); + } + + Vector64 vector = Vector64.Create(values[0], values[1]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector64SingleToString: Vector64.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.UInt16.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.UInt16.cs new file mode 100644 index 0000000..6c4b200 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.UInt16.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringUInt16() + { + int size = Unsafe.SizeOf>() / sizeof(UInt16); + UInt16[] values = new UInt16[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetUInt16(); + } + + Vector64 vector = Vector64.Create(values[0], values[1], values[2], values[3]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector64UInt16ToString: Vector64.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.UInt32.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.UInt32.cs new file mode 100644 index 0000000..5d88d76 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.UInt32.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringUInt32() + { + int size = Unsafe.SizeOf>() / sizeof(UInt32); + UInt32[] values = new UInt32[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetUInt32(); + } + + Vector64 vector = Vector64.Create(values[0], values[1]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector64UInt32ToString: Vector64.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.UInt64.cs new file mode 100644 index 0000000..a010010 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/ToString.UInt64.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/****************************************************************************** + * This file is auto-generated from a template file by the GenerateTests.csx * + * script in tests\src\JIT\HardwareIntrinsics\General\Shared. 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.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics; + +namespace JIT.HardwareIntrinsics.General +{ + public static partial class Program + { + private unsafe static void ToStringUInt64() + { + int size = Unsafe.SizeOf>() / sizeof(UInt64); + UInt64[] values = new UInt64[size]; + + for (int i = 0; i < size; i++) + { + values[i] = TestLibrary.Generator.GetUInt64(); + } + + Vector64 vector = Vector64.Create(values[0]); + string actual = vector.ToString(); + + string expected = '<' + string.Join(", ", values.Select(x => x.ToString("G", System.Globalization.CultureInfo.InvariantCulture))) + '>'; + + bool succeeded = string.Equals(expected, actual, StringComparison.Ordinal); + + if (!succeeded) + { + TestLibrary.TestFramework.LogInformation($"Vector64UInt64ToString: Vector64.ToString() returned an unexpected result."); + TestLibrary.TestFramework.LogInformation($"Expected: {expected}"); + TestLibrary.TestFramework.LogInformation($"Actual: {actual}"); + TestLibrary.TestFramework.LogInformation(string.Empty); + + throw new Exception("One or more scenarios did not complete as expected."); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_r.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_r.csproj index ead2a80..5e57e23 100644 --- a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_r.csproj +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_r.csproj @@ -64,6 +64,16 @@ + + + + + + + + + + diff --git a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_ro.csproj b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_ro.csproj index 2c1555a..5ee926f 100644 --- a/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_ro.csproj +++ b/tests/src/JIT/HardwareIntrinsics/General/Vector64_1/Vector64_1_ro.csproj @@ -64,6 +64,16 @@ + + + + + + + + + + -- 2.7.4