Moving the Sse Compare*OrderedScalar and Compare*UnorderedScalar tests to use a template.
authorTanner Gooding <tagoo@outlook.com>
Wed, 31 Jan 2018 05:18:45 +0000 (21:18 -0800)
committerTanner Gooding <tagoo@outlook.com>
Thu, 1 Feb 2018 16:33:24 +0000 (08:33 -0800)
54 files changed:
tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest.template [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest_DataTable.cs [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar.Single.cs [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar.cs [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar_r.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar_ro.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar.Single.cs [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar.cs [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar_r.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar_ro.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar.Single.cs [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar.cs [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar_r.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar_ro.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar.Single.cs [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar.cs [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar_r.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar_ro.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar.Single.cs [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar.cs [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar_r.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar_ro.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar.Single.cs [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar.cs [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar_r.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar_ro.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar.Single.cs [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar.cs [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar_r.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar_ro.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar.Single.cs [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar.cs [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar_r.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar_ro.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar.Single.cs [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar.cs [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar_r.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar_ro.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar.Single.cs [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar.cs [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar_r.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar_ro.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar.Single.cs [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar.cs [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar_r.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar_ro.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar.Single.cs [new file with mode: 0644]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar.cs [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar_r.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar_ro.csproj [deleted file]
tests/src/JIT/HardwareIntrinsics/X86/Sse/Program.Sse.cs
tests/src/JIT/HardwareIntrinsics/X86/Sse/Sse_r.csproj
tests/src/JIT/HardwareIntrinsics/X86/Sse/Sse_ro.csproj

diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest.template
new file mode 100644 (file)
index 0000000..a8ea21c
--- /dev/null
@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx  *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make    *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file.                                             *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{{
+    public static partial class Program
+    {{
+        private static void {1}{2}()
+        {{
+            var test = new BooleanComparisonOpTest__{1}{2}();
+
+            if (test.IsSupported)
+            {{
+                // Validates basic functionality works
+                test.RunBasicScenario();
+
+                // Validates calling via reflection works
+                test.RunReflectionScenario();
+
+                // Validates passing a static member works
+                test.RunClsVarScenario();
+
+                // Validates passing a local works
+                test.RunLclVarScenario();
+
+                // Validates passing the field of a local works
+                test.RunLclFldScenario();
+
+                // Validates passing an instance member works
+                test.RunFldScenario();
+            }}
+            else
+            {{
+                // Validates we throw on unsupported hardware
+                test.RunUnsupportedScenario();
+            }}
+
+            if (!test.Succeeded)
+            {{
+                throw new Exception("One or more scenarios did not complete as expected.");
+            }}
+        }}
+    }}
+
+    public sealed unsafe class BooleanComparisonOpTest__{1}{2}
+    {{
+        private const int VectorSize = {4};
+        private const int ElementCount = VectorSize / sizeof({2});
+
+        private static {2}[] _data1 = new {2}[ElementCount];
+        private static {2}[] _data2 = new {2}[ElementCount];
+
+        private static {3}<{2}> _clsVar1;
+        private static {3}<{2}> _clsVar2;
+
+        private {3}<{2}> _fld1;
+        private {3}<{2}> _fld2;
+
+        private BooleanComparisonOpTest__DataTable<{2}> _dataTable;
+
+        static BooleanComparisonOpTest__{1}{2}()
+        {{
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) {{ _data1[i] = {5}; _data2[i] = {5}; }}
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<{3}<{2}>, byte>(ref _clsVar1), ref Unsafe.As<{2}, byte>(ref _data2[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<{3}<{2}>, byte>(ref _clsVar2), ref Unsafe.As<{2}, byte>(ref _data1[0]), VectorSize);
+        }}
+
+        public BooleanComparisonOpTest__{1}{2}()
+        {{
+            Succeeded = true;
+
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) {{ _data1[i] = {5}; _data2[i] = {5}; }}
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<{3}<{2}>, byte>(ref _fld1), ref Unsafe.As<{2}, byte>(ref _data1[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<{3}<{2}>, byte>(ref _fld2), ref Unsafe.As<{2}, byte>(ref _data2[0]), VectorSize);
+
+            for (var i = 0; i < ElementCount; i++) {{ _data1[i] = {5}; _data2[i] = {5}; }}
+            _dataTable = new BooleanComparisonOpTest__DataTable<{2}>(_data1, _data2);
+        }}
+
+        public bool IsSupported => {0}.IsSupported;
+
+        public bool Succeeded {{ get; set; }}
+
+        public void RunBasicScenario()
+        {{
+            var result = {0}.{1}(
+                Unsafe.Read<{3}<{2}>>(_dataTable.inArray1Ptr),
+                Unsafe.Read<{3}<{2}>>(_dataTable.inArray2Ptr)
+            );
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, result);
+        }}
+
+        public void RunReflectionScenario()
+        {{
+            var result = typeof({0}).GetMethod(nameof({0}.{1}), new Type[] {{ typeof({3}<{2}>), typeof({3}<{2}>) }})
+                                     .Invoke(null, new object[] {{
+                                        Unsafe.Read<{3}<{2}>>(_dataTable.inArray1Ptr),
+                                        Unsafe.Read<{3}<{2}>>(_dataTable.inArray2Ptr)
+                                     }});
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, (bool)(result));
+        }}
+
+        public void RunClsVarScenario()
+        {{
+            var result = {0}.{1}(
+                _clsVar1,
+                _clsVar2
+            );
+
+            ValidateResult(_clsVar1, _clsVar2, result);
+        }}
+
+        public void RunLclVarScenario()
+        {{
+            var left = Unsafe.Read<{3}<{2}>>(_dataTable.inArray1Ptr);
+            var right = Unsafe.Read<{3}<{2}>>(_dataTable.inArray2Ptr);
+            var result = {0}.{1}(left, right);
+
+            ValidateResult(left, right, result);
+        }}
+
+        public void RunLclFldScenario()
+        {{
+            var test = new BooleanComparisonOpTest__{1}{2}();
+            var result = {0}.{1}(test._fld1, test._fld2);
+
+            ValidateResult(test._fld1, test._fld2, result);
+        }}
+
+        public void RunFldScenario()
+        {{
+            var result = {0}.{1}(_fld1, _fld2);
+
+            ValidateResult(_fld1, _fld2, result);
+        }}
+
+        public void RunUnsupportedScenario()
+        {{
+            Succeeded = false;
+
+            try
+            {{
+                RunBasicScenario();
+            }}
+            catch (PlatformNotSupportedException)
+            {{
+                Succeeded = true;
+            }}
+        }}
+
+        private void ValidateResult({3}<{2}> left, {3}<{2}> right, bool result, [CallerMemberName] string method = "")
+        {{
+            {2}[] inArray1 = new {2}[ElementCount];
+            {2}[] inArray2 = new {2}[ElementCount];
+
+            Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
+            Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+
+            ValidateResult(inArray1, inArray2, result, method);
+        }}
+
+        private void ValidateResult({2}[] left, {2}[] right, bool result, [CallerMemberName] string method = "")
+        {{
+            if ({6})
+            {{
+                Succeeded = false;
+
+                Console.WriteLine($"{{nameof({0})}}.{{nameof({0}.{1})}}<{2}>: {{method}} failed:");
+                Console.WriteLine($"    left: ({{string.Join(", ", left)}})");
+                Console.WriteLine($"   right: ({{string.Join(", ", right)}})");
+                Console.WriteLine($"  result: ({{string.Join(", ", result)}})");
+                Console.WriteLine();
+            }}
+        }}
+    }}
+}}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest_DataTable.cs b/tests/src/JIT/HardwareIntrinsics/X86/Shared/BooleanCmpOpTest_DataTable.cs
new file mode 100644 (file)
index 0000000..56f07fb
--- /dev/null
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+    public unsafe struct BooleanComparisonOpTest__DataTable<T> : IDisposable where T : struct
+    {
+        private GCHandle inHandle1;
+        private GCHandle inHandle2;
+
+        public T[] inArray1;
+        public T[] inArray2;
+
+        public BooleanComparisonOpTest__DataTable(T[] inArray1, T[] inArray2)
+        {
+            this.inArray1 = inArray1;
+            this.inArray2 = inArray2;
+
+            this.inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
+            this.inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned);
+        }
+
+        public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
+        public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer();
+
+        public void Dispose()
+        {
+            inHandle1.Free();
+            inHandle2.Free();
+        }
+    }
+}
index 463a89f..c5850cb 100644 (file)
@@ -20,47 +20,59 @@ using System.IO;
 
 private static readonly (string templateFileName, string[] templateData)[] SseInputs = new []
 {
-    // TemplateName                             Isa,    Method,                              BaseType, VectorType,  VectorSize, NextValue,                      ValidateFirstResult,                                                                               ValidateRemainingResults
-    ("SimpleBinOpTest.template", new string[] { "Sse", "Add",                                "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] + right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i] + right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "AddScalar",                          "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] + right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "And",                                "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", "(BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "AndNot",                             "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(~BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", "(~BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareEqual",                       "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] == right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] == right[i]) ? -1 : 0)"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareEqualScalar",                 "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] == right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareGreaterThan",                 "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] > right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] > right[i]) ? -1 : 0)"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareGreaterThanScalar",           "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] > right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareGreaterThanOrEqual",          "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] >= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] >= right[i]) ? -1 : 0)"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareGreaterThanOrEqualScalar",    "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] >= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareLessThan",                    "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] < right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] < right[i]) ? -1 : 0)"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareLessThanScalar",              "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] < right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareLessThanOrEqual",             "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] <= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] <= right[i]) ? -1 : 0)"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareLessThanOrEqualScalar",       "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] <= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareNotEqual",                    "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] != right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] != right[i]) ? -1 : 0)"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareNotEqualScalar",              "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] != right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareNotGreaterThan",              "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] > right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] > right[i]) ? -1 : 0)"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareNotGreaterThanScalar",        "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] > right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareNotGreaterThanOrEqual",       "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] >= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] >= right[i]) ? -1 : 0)"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareNotGreaterThanOrEqualScalar", "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] >= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareNotLessThan",                 "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] < right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] < right[i]) ? -1 : 0)"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareNotLessThanScalar",           "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] < right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareNotLessThanOrEqual",          "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] <= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] <= right[i]) ? -1 : 0)"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareNotLessThanOrEqualScalar",    "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] <= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareOrdered",                     "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((!float.IsNaN(left[0]) && !float.IsNaN(right[0])) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((!float.IsNaN(left[i]) && !float.IsNaN(right[i])) ? -1 : 0)"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareOrderedScalar",               "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((!float.IsNaN(left[0]) && !float.IsNaN(right[0])) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareUnordered",                   "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((float.IsNaN(left[0]) || float.IsNaN(right[0])) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((float.IsNaN(left[i]) || float.IsNaN(right[i])) ? -1 : 0)"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "CompareUnorderedScalar",             "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((float.IsNaN(left[0]) || float.IsNaN(right[0])) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "Divide",                             "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] / right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i] / right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "DivideScalar",                       "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] / right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "Max",                                "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(Math.Max(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(Math.Max(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "MaxScalar",                          "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(Math.Max(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "Min",                                "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(Math.Min(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(Math.Min(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "MinScalar",                          "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(Math.Min(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "Multiply",                           "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] * right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i] * right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "MultiplyScalar",                     "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] * right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "Or",                                 "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(BitConverter.SingleToInt32Bits(left[0]) | BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", "(BitConverter.SingleToInt32Bits(left[0]) | BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "Subtract",                           "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] - right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i] - right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "SubtractScalar",                     "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] - right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
-    ("SimpleBinOpTest.template", new string[] { "Sse", "Xor",                                "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(BitConverter.SingleToInt32Bits(left[0]) ^ BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", "(BitConverter.SingleToInt32Bits(left[0]) ^ BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
+    // TemplateName                              Isa,   Method,                                     BaseType, VectorType,  VectorSize, NextValue,                      ValidateFirstResult,                                                                               ValidateRemainingResults
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "Add",                                      "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] + right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i] + right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "AddScalar",                                "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] + right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "And",                                      "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", "(BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "AndNot",                                   "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(~BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", "(~BitConverter.SingleToInt32Bits(left[0]) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareEqual",                             "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] == right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] == right[i]) ? -1 : 0)"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareEqualScalar",                       "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] == right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("BooleanCmpOpTest.template", new string[] { "Sse", "CompareEqualOrderedScalar",                "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(left[0] == right[0]) != result"}),
+    ("BooleanCmpOpTest.template", new string[] { "Sse", "CompareEqualUnorderedScalar",              "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(left[0] == right[0]) != result"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareGreaterThan",                       "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] > right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] > right[i]) ? -1 : 0)"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareGreaterThanScalar",                 "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] > right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("BooleanCmpOpTest.template", new string[] { "Sse", "CompareGreaterThanOrderedScalar",          "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(left[0] > right[0]) != result"}),
+    ("BooleanCmpOpTest.template", new string[] { "Sse", "CompareGreaterThanUnorderedScalar",        "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(left[0] > right[0]) != result"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareGreaterThanOrEqual",                "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] >= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] >= right[i]) ? -1 : 0)"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareGreaterThanOrEqualScalar",          "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] >= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("BooleanCmpOpTest.template", new string[] { "Sse", "CompareGreaterThanOrEqualOrderedScalar",   "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(left[0] >= right[0]) != result"}),
+    ("BooleanCmpOpTest.template", new string[] { "Sse", "CompareGreaterThanOrEqualUnorderedScalar", "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(left[0] >= right[0]) != result"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareLessThan",                          "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] < right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] < right[i]) ? -1 : 0)"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareLessThanScalar",                    "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] < right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("BooleanCmpOpTest.template", new string[] { "Sse", "CompareLessThanOrderedScalar",             "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(left[0] < right[0]) != result"}),
+    ("BooleanCmpOpTest.template", new string[] { "Sse", "CompareLessThanUnorderedScalar",           "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(left[0] < right[0]) != result"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareLessThanOrEqual",                   "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] <= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] <= right[i]) ? -1 : 0)"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareLessThanOrEqualScalar",             "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] <= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("BooleanCmpOpTest.template", new string[] { "Sse", "CompareLessThanOrEqualOrderedScalar",      "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(left[0] <= right[0]) != result"}),
+    ("BooleanCmpOpTest.template", new string[] { "Sse", "CompareLessThanOrEqualUnorderedScalar",    "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(left[0] <= right[0]) != result"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareNotEqual",                          "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] != right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((left[i] != right[i]) ? -1 : 0)"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareNotEqualScalar",                    "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((left[0] != right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("BooleanCmpOpTest.template", new string[] { "Sse", "CompareNotEqualOrderedScalar",             "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(left[0] != right[0]) != result"}),
+    ("BooleanCmpOpTest.template", new string[] { "Sse", "CompareNotEqualUnorderedScalar",           "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(left[0] != right[0]) != result"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareNotGreaterThan",                    "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] > right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] > right[i]) ? -1 : 0)"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareNotGreaterThanScalar",              "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] > right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareNotGreaterThanOrEqual",             "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] >= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] >= right[i]) ? -1 : 0)"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareNotGreaterThanOrEqualScalar",       "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] >= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareNotLessThan",                       "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] < right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] < right[i]) ? -1 : 0)"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareNotLessThanScalar",                 "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] < right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareNotLessThanOrEqual",                "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] <= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != (!(left[i] <= right[i]) ? -1 : 0)"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareNotLessThanOrEqualScalar",          "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != (!(left[0] <= right[0]) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareOrdered",                           "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((!float.IsNaN(left[0]) && !float.IsNaN(right[0])) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((!float.IsNaN(left[i]) && !float.IsNaN(right[i])) ? -1 : 0)"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareOrderedScalar",                     "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((!float.IsNaN(left[0]) && !float.IsNaN(right[0])) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareUnordered",                         "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((float.IsNaN(left[0]) || float.IsNaN(right[0])) ? -1 : 0)", "BitConverter.SingleToInt32Bits(result[i]) != ((float.IsNaN(left[i]) || float.IsNaN(right[i])) ? -1 : 0)"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "CompareUnorderedScalar",                   "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(result[0]) != ((float.IsNaN(left[0]) || float.IsNaN(right[0])) ? -1 : 0)", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "Divide",                                   "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] / right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i] / right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "DivideScalar",                             "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] / right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "Max",                                      "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(Math.Max(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(Math.Max(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "MaxScalar",                                "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(Math.Max(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "Min",                                      "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(Math.Min(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(Math.Min(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "MinScalar",                                "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(Math.Min(left[0], right[0])) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "Multiply",                                 "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] * right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i] * right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "MultiplyScalar",                           "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] * right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "Or",                                       "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(BitConverter.SingleToInt32Bits(left[0]) | BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", "(BitConverter.SingleToInt32Bits(left[0]) | BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "Subtract",                                 "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] - right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i] - right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "SubtractScalar",                           "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "BitConverter.SingleToInt32Bits(left[0] - right[0]) != BitConverter.SingleToInt32Bits(result[0])", "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+    ("SimpleBinOpTest.template",  new string[] { "Sse", "Xor",                                      "Single", "Vector128", "16",       "(float)(random.NextDouble())",  "(BitConverter.SingleToInt32Bits(left[0]) ^ BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", "(BitConverter.SingleToInt32Bits(left[0]) ^ BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
 };
 
 private static readonly (string templateFileName, string[] templateData)[] Sse2Inputs = new []
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar.Single.cs
new file mode 100644 (file)
index 0000000..19e2e02
--- /dev/null
@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx  *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make    *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file.                                             *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+    public static partial class Program
+    {
+        private static void CompareEqualOrderedScalarSingle()
+        {
+            var test = new BooleanComparisonOpTest__CompareEqualOrderedScalarSingle();
+
+            if (test.IsSupported)
+            {
+                // Validates basic functionality works
+                test.RunBasicScenario();
+
+                // Validates calling via reflection works
+                test.RunReflectionScenario();
+
+                // Validates passing a static member works
+                test.RunClsVarScenario();
+
+                // Validates passing a local works
+                test.RunLclVarScenario();
+
+                // Validates passing the field of a local works
+                test.RunLclFldScenario();
+
+                // Validates passing an instance member works
+                test.RunFldScenario();
+            }
+            else
+            {
+                // Validates we throw on unsupported hardware
+                test.RunUnsupportedScenario();
+            }
+
+            if (!test.Succeeded)
+            {
+                throw new Exception("One or more scenarios did not complete as expected.");
+            }
+        }
+    }
+
+    public sealed unsafe class BooleanComparisonOpTest__CompareEqualOrderedScalarSingle
+    {
+        private const int VectorSize = 16;
+        private const int ElementCount = VectorSize / sizeof(Single);
+
+        private static Single[] _data1 = new Single[ElementCount];
+        private static Single[] _data2 = new Single[ElementCount];
+
+        private static Vector128<Single> _clsVar1;
+        private static Vector128<Single> _clsVar2;
+
+        private Vector128<Single> _fld1;
+        private Vector128<Single> _fld2;
+
+        private BooleanComparisonOpTest__DataTable<Single> _dataTable;
+
+        static BooleanComparisonOpTest__CompareEqualOrderedScalarSingle()
+        {
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+        }
+
+        public BooleanComparisonOpTest__CompareEqualOrderedScalarSingle()
+        {
+            Succeeded = true;
+
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            _dataTable = new BooleanComparisonOpTest__DataTable<Single>(_data1, _data2);
+        }
+
+        public bool IsSupported => Sse.IsSupported;
+
+        public bool Succeeded { get; set; }
+
+        public void RunBasicScenario()
+        {
+            var result = Sse.CompareEqualOrderedScalar(
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+            );
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, result);
+        }
+
+        public void RunReflectionScenario()
+        {
+            var result = typeof(Sse).GetMethod(nameof(Sse.CompareEqualOrderedScalar), new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) })
+                                     .Invoke(null, new object[] {
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+                                     });
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, (bool)(result));
+        }
+
+        public void RunClsVarScenario()
+        {
+            var result = Sse.CompareEqualOrderedScalar(
+                _clsVar1,
+                _clsVar2
+            );
+
+            ValidateResult(_clsVar1, _clsVar2, result);
+        }
+
+        public void RunLclVarScenario()
+        {
+            var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+            var right = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr);
+            var result = Sse.CompareEqualOrderedScalar(left, right);
+
+            ValidateResult(left, right, result);
+        }
+
+        public void RunLclFldScenario()
+        {
+            var test = new BooleanComparisonOpTest__CompareEqualOrderedScalarSingle();
+            var result = Sse.CompareEqualOrderedScalar(test._fld1, test._fld2);
+
+            ValidateResult(test._fld1, test._fld2, result);
+        }
+
+        public void RunFldScenario()
+        {
+            var result = Sse.CompareEqualOrderedScalar(_fld1, _fld2);
+
+            ValidateResult(_fld1, _fld2, result);
+        }
+
+        public void RunUnsupportedScenario()
+        {
+            Succeeded = false;
+
+            try
+            {
+                RunBasicScenario();
+            }
+            catch (PlatformNotSupportedException)
+            {
+                Succeeded = true;
+            }
+        }
+
+        private void ValidateResult(Vector128<Single> left, Vector128<Single> right, bool result, [CallerMemberName] string method = "")
+        {
+            Single[] inArray1 = new Single[ElementCount];
+            Single[] inArray2 = new Single[ElementCount];
+
+            Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
+            Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+
+            ValidateResult(inArray1, inArray2, result, method);
+        }
+
+        private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "")
+        {
+            if ((left[0] == right[0]) != result)
+            {
+                Succeeded = false;
+
+                Console.WriteLine($"{nameof(Sse)}.{nameof(Sse.CompareEqualOrderedScalar)}<Single>: {method} failed:");
+                Console.WriteLine($"    left: ({string.Join(", ", left)})");
+                Console.WriteLine($"   right: ({string.Join(", ", right)})");
+                Console.WriteLine($"  result: ({string.Join(", ", result)})");
+                Console.WriteLine();
+            }
+        }
+    }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar.cs
deleted file mode 100644 (file)
index 5fd6a58..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
-    class Program
-    {
-        const int Pass = 100;
-        const int Fail = 0;
-
-        static unsafe int Main(string[] args)
-        {
-            int testResult = Pass;
-
-            if (Sse.IsSupported)
-            {
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 1, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (!Sse.CompareEqualOrderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareEqualOrderedScalar failed positive test");
-                        testResult = Fail;
-                    }
-                }
-
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 22, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (Sse.CompareEqualOrderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareEqualOrderedScalar failed negative test");
-                        testResult = Fail;
-                    }
-                }
-            }
-
-
-            return testResult;
-        }
-
-        public unsafe struct TestTable<T> : IDisposable where T : struct
-        {
-            public T[] inArray1;
-            public T[] inArray2;
-
-            public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
-            public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer();
-
-            GCHandle inHandle1;
-            GCHandle inHandle2;
-            public TestTable(T[] a, T[] b)
-            {
-                this.inArray1 = a;
-                this.inArray2 = b;
-
-                inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
-                inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned);
-            }
-
-            public void Dispose()
-            {
-                inHandle1.Free();
-                inHandle2.Free();
-            }
-        }
-
-    }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar_r.csproj
deleted file mode 100644 (file)
index 2bec781..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize></Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareEqualOrderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualOrderedScalar_ro.csproj
deleted file mode 100644 (file)
index 5cdcb8e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize>True</Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareEqualOrderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar.Single.cs
new file mode 100644 (file)
index 0000000..4e95e71
--- /dev/null
@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx  *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make    *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file.                                             *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+    public static partial class Program
+    {
+        private static void CompareEqualUnorderedScalarSingle()
+        {
+            var test = new BooleanComparisonOpTest__CompareEqualUnorderedScalarSingle();
+
+            if (test.IsSupported)
+            {
+                // Validates basic functionality works
+                test.RunBasicScenario();
+
+                // Validates calling via reflection works
+                test.RunReflectionScenario();
+
+                // Validates passing a static member works
+                test.RunClsVarScenario();
+
+                // Validates passing a local works
+                test.RunLclVarScenario();
+
+                // Validates passing the field of a local works
+                test.RunLclFldScenario();
+
+                // Validates passing an instance member works
+                test.RunFldScenario();
+            }
+            else
+            {
+                // Validates we throw on unsupported hardware
+                test.RunUnsupportedScenario();
+            }
+
+            if (!test.Succeeded)
+            {
+                throw new Exception("One or more scenarios did not complete as expected.");
+            }
+        }
+    }
+
+    public sealed unsafe class BooleanComparisonOpTest__CompareEqualUnorderedScalarSingle
+    {
+        private const int VectorSize = 16;
+        private const int ElementCount = VectorSize / sizeof(Single);
+
+        private static Single[] _data1 = new Single[ElementCount];
+        private static Single[] _data2 = new Single[ElementCount];
+
+        private static Vector128<Single> _clsVar1;
+        private static Vector128<Single> _clsVar2;
+
+        private Vector128<Single> _fld1;
+        private Vector128<Single> _fld2;
+
+        private BooleanComparisonOpTest__DataTable<Single> _dataTable;
+
+        static BooleanComparisonOpTest__CompareEqualUnorderedScalarSingle()
+        {
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+        }
+
+        public BooleanComparisonOpTest__CompareEqualUnorderedScalarSingle()
+        {
+            Succeeded = true;
+
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            _dataTable = new BooleanComparisonOpTest__DataTable<Single>(_data1, _data2);
+        }
+
+        public bool IsSupported => Sse.IsSupported;
+
+        public bool Succeeded { get; set; }
+
+        public void RunBasicScenario()
+        {
+            var result = Sse.CompareEqualUnorderedScalar(
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+            );
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, result);
+        }
+
+        public void RunReflectionScenario()
+        {
+            var result = typeof(Sse).GetMethod(nameof(Sse.CompareEqualUnorderedScalar), new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) })
+                                     .Invoke(null, new object[] {
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+                                     });
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, (bool)(result));
+        }
+
+        public void RunClsVarScenario()
+        {
+            var result = Sse.CompareEqualUnorderedScalar(
+                _clsVar1,
+                _clsVar2
+            );
+
+            ValidateResult(_clsVar1, _clsVar2, result);
+        }
+
+        public void RunLclVarScenario()
+        {
+            var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+            var right = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr);
+            var result = Sse.CompareEqualUnorderedScalar(left, right);
+
+            ValidateResult(left, right, result);
+        }
+
+        public void RunLclFldScenario()
+        {
+            var test = new BooleanComparisonOpTest__CompareEqualUnorderedScalarSingle();
+            var result = Sse.CompareEqualUnorderedScalar(test._fld1, test._fld2);
+
+            ValidateResult(test._fld1, test._fld2, result);
+        }
+
+        public void RunFldScenario()
+        {
+            var result = Sse.CompareEqualUnorderedScalar(_fld1, _fld2);
+
+            ValidateResult(_fld1, _fld2, result);
+        }
+
+        public void RunUnsupportedScenario()
+        {
+            Succeeded = false;
+
+            try
+            {
+                RunBasicScenario();
+            }
+            catch (PlatformNotSupportedException)
+            {
+                Succeeded = true;
+            }
+        }
+
+        private void ValidateResult(Vector128<Single> left, Vector128<Single> right, bool result, [CallerMemberName] string method = "")
+        {
+            Single[] inArray1 = new Single[ElementCount];
+            Single[] inArray2 = new Single[ElementCount];
+
+            Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
+            Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+
+            ValidateResult(inArray1, inArray2, result, method);
+        }
+
+        private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "")
+        {
+            if ((left[0] == right[0]) != result)
+            {
+                Succeeded = false;
+
+                Console.WriteLine($"{nameof(Sse)}.{nameof(Sse.CompareEqualUnorderedScalar)}<Single>: {method} failed:");
+                Console.WriteLine($"    left: ({string.Join(", ", left)})");
+                Console.WriteLine($"   right: ({string.Join(", ", right)})");
+                Console.WriteLine($"  result: ({string.Join(", ", result)})");
+                Console.WriteLine();
+            }
+        }
+    }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar.cs
deleted file mode 100644 (file)
index eb68c6c..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
-    class Program
-    {
-        const int Pass = 100;
-        const int Fail = 0;
-
-        static unsafe int Main(string[] args)
-        {
-            int testResult = Pass;
-
-            if (Sse.IsSupported)
-            {
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 1, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (!Sse.CompareEqualUnorderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareEqualUnorderedScalar failed positive test");
-                        testResult = Fail;
-                    }
-                }
-
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 22, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (Sse.CompareEqualUnorderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareEqualUnorderedScalar failed negative test");
-                        testResult = Fail;
-                    }
-                }
-            }
-
-
-            return testResult;
-        }
-
-        public unsafe struct TestTable<T> : IDisposable where T : struct
-        {
-            public T[] inArray1;
-            public T[] inArray2;
-
-            public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
-            public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer();
-
-            GCHandle inHandle1;
-            GCHandle inHandle2;
-            public TestTable(T[] a, T[] b)
-            {
-                this.inArray1 = a;
-                this.inArray2 = b;
-
-                inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
-                inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned);
-            }
-
-            public void Dispose()
-            {
-                inHandle1.Free();
-                inHandle2.Free();
-            }
-        }
-
-    }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar_r.csproj
deleted file mode 100644 (file)
index ddc86db..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize></Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareEqualUnorderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareEqualUnorderedScalar_ro.csproj
deleted file mode 100644 (file)
index aac8f24..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize>True</Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareEqualUnorderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar.Single.cs
new file mode 100644 (file)
index 0000000..9c8b6e4
--- /dev/null
@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx  *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make    *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file.                                             *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+    public static partial class Program
+    {
+        private static void CompareGreaterThanOrEqualOrderedScalarSingle()
+        {
+            var test = new BooleanComparisonOpTest__CompareGreaterThanOrEqualOrderedScalarSingle();
+
+            if (test.IsSupported)
+            {
+                // Validates basic functionality works
+                test.RunBasicScenario();
+
+                // Validates calling via reflection works
+                test.RunReflectionScenario();
+
+                // Validates passing a static member works
+                test.RunClsVarScenario();
+
+                // Validates passing a local works
+                test.RunLclVarScenario();
+
+                // Validates passing the field of a local works
+                test.RunLclFldScenario();
+
+                // Validates passing an instance member works
+                test.RunFldScenario();
+            }
+            else
+            {
+                // Validates we throw on unsupported hardware
+                test.RunUnsupportedScenario();
+            }
+
+            if (!test.Succeeded)
+            {
+                throw new Exception("One or more scenarios did not complete as expected.");
+            }
+        }
+    }
+
+    public sealed unsafe class BooleanComparisonOpTest__CompareGreaterThanOrEqualOrderedScalarSingle
+    {
+        private const int VectorSize = 16;
+        private const int ElementCount = VectorSize / sizeof(Single);
+
+        private static Single[] _data1 = new Single[ElementCount];
+        private static Single[] _data2 = new Single[ElementCount];
+
+        private static Vector128<Single> _clsVar1;
+        private static Vector128<Single> _clsVar2;
+
+        private Vector128<Single> _fld1;
+        private Vector128<Single> _fld2;
+
+        private BooleanComparisonOpTest__DataTable<Single> _dataTable;
+
+        static BooleanComparisonOpTest__CompareGreaterThanOrEqualOrderedScalarSingle()
+        {
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+        }
+
+        public BooleanComparisonOpTest__CompareGreaterThanOrEqualOrderedScalarSingle()
+        {
+            Succeeded = true;
+
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            _dataTable = new BooleanComparisonOpTest__DataTable<Single>(_data1, _data2);
+        }
+
+        public bool IsSupported => Sse.IsSupported;
+
+        public bool Succeeded { get; set; }
+
+        public void RunBasicScenario()
+        {
+            var result = Sse.CompareGreaterThanOrEqualOrderedScalar(
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+            );
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, result);
+        }
+
+        public void RunReflectionScenario()
+        {
+            var result = typeof(Sse).GetMethod(nameof(Sse.CompareGreaterThanOrEqualOrderedScalar), new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) })
+                                     .Invoke(null, new object[] {
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+                                     });
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, (bool)(result));
+        }
+
+        public void RunClsVarScenario()
+        {
+            var result = Sse.CompareGreaterThanOrEqualOrderedScalar(
+                _clsVar1,
+                _clsVar2
+            );
+
+            ValidateResult(_clsVar1, _clsVar2, result);
+        }
+
+        public void RunLclVarScenario()
+        {
+            var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+            var right = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr);
+            var result = Sse.CompareGreaterThanOrEqualOrderedScalar(left, right);
+
+            ValidateResult(left, right, result);
+        }
+
+        public void RunLclFldScenario()
+        {
+            var test = new BooleanComparisonOpTest__CompareGreaterThanOrEqualOrderedScalarSingle();
+            var result = Sse.CompareGreaterThanOrEqualOrderedScalar(test._fld1, test._fld2);
+
+            ValidateResult(test._fld1, test._fld2, result);
+        }
+
+        public void RunFldScenario()
+        {
+            var result = Sse.CompareGreaterThanOrEqualOrderedScalar(_fld1, _fld2);
+
+            ValidateResult(_fld1, _fld2, result);
+        }
+
+        public void RunUnsupportedScenario()
+        {
+            Succeeded = false;
+
+            try
+            {
+                RunBasicScenario();
+            }
+            catch (PlatformNotSupportedException)
+            {
+                Succeeded = true;
+            }
+        }
+
+        private void ValidateResult(Vector128<Single> left, Vector128<Single> right, bool result, [CallerMemberName] string method = "")
+        {
+            Single[] inArray1 = new Single[ElementCount];
+            Single[] inArray2 = new Single[ElementCount];
+
+            Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
+            Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+
+            ValidateResult(inArray1, inArray2, result, method);
+        }
+
+        private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "")
+        {
+            if ((left[0] >= right[0]) != result)
+            {
+                Succeeded = false;
+
+                Console.WriteLine($"{nameof(Sse)}.{nameof(Sse.CompareGreaterThanOrEqualOrderedScalar)}<Single>: {method} failed:");
+                Console.WriteLine($"    left: ({string.Join(", ", left)})");
+                Console.WriteLine($"   right: ({string.Join(", ", right)})");
+                Console.WriteLine($"  result: ({string.Join(", ", result)})");
+                Console.WriteLine();
+            }
+        }
+    }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar.cs
deleted file mode 100644 (file)
index a3b85fc..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
-    class Program
-    {
-        const int Pass = 100;
-        const int Fail = 0;
-
-        static unsafe int Main(string[] args)
-        {
-            int testResult = Pass;
-
-            if (Sse.IsSupported)
-            {
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 22, -5, 100, 0 }, new float[4] { 1, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (!Sse.CompareGreaterThanOrEqualOrderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareGreaterThanOrEqualOrderedScalar failed positive test");
-                        testResult = Fail;
-                    }
-                }
-
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 22, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (Sse.CompareGreaterThanOrEqualOrderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareGreaterThanOrEqualOrderedScalar failed negative test");
-                        testResult = Fail;
-                    }
-                }
-            }
-
-
-            return testResult;
-        }
-
-        public unsafe struct TestTable<T> : IDisposable where T : struct
-        {
-            public T[] inArray1;
-            public T[] inArray2;
-
-            public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
-            public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer();
-
-            GCHandle inHandle1;
-            GCHandle inHandle2;
-            public TestTable(T[] a, T[] b)
-            {
-                this.inArray1 = a;
-                this.inArray2 = b;
-
-                inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
-                inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned);
-            }
-
-            public void Dispose()
-            {
-                inHandle1.Free();
-                inHandle2.Free();
-            }
-        }
-
-    }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar_r.csproj
deleted file mode 100644 (file)
index e139476..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize></Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareGreaterThanOrEqualOrderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualOrderedScalar_ro.csproj
deleted file mode 100644 (file)
index 082bb91..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize>True</Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareGreaterThanOrEqualOrderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar.Single.cs
new file mode 100644 (file)
index 0000000..c1c4a7f
--- /dev/null
@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx  *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make    *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file.                                             *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+    public static partial class Program
+    {
+        private static void CompareGreaterThanOrEqualUnorderedScalarSingle()
+        {
+            var test = new BooleanComparisonOpTest__CompareGreaterThanOrEqualUnorderedScalarSingle();
+
+            if (test.IsSupported)
+            {
+                // Validates basic functionality works
+                test.RunBasicScenario();
+
+                // Validates calling via reflection works
+                test.RunReflectionScenario();
+
+                // Validates passing a static member works
+                test.RunClsVarScenario();
+
+                // Validates passing a local works
+                test.RunLclVarScenario();
+
+                // Validates passing the field of a local works
+                test.RunLclFldScenario();
+
+                // Validates passing an instance member works
+                test.RunFldScenario();
+            }
+            else
+            {
+                // Validates we throw on unsupported hardware
+                test.RunUnsupportedScenario();
+            }
+
+            if (!test.Succeeded)
+            {
+                throw new Exception("One or more scenarios did not complete as expected.");
+            }
+        }
+    }
+
+    public sealed unsafe class BooleanComparisonOpTest__CompareGreaterThanOrEqualUnorderedScalarSingle
+    {
+        private const int VectorSize = 16;
+        private const int ElementCount = VectorSize / sizeof(Single);
+
+        private static Single[] _data1 = new Single[ElementCount];
+        private static Single[] _data2 = new Single[ElementCount];
+
+        private static Vector128<Single> _clsVar1;
+        private static Vector128<Single> _clsVar2;
+
+        private Vector128<Single> _fld1;
+        private Vector128<Single> _fld2;
+
+        private BooleanComparisonOpTest__DataTable<Single> _dataTable;
+
+        static BooleanComparisonOpTest__CompareGreaterThanOrEqualUnorderedScalarSingle()
+        {
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+        }
+
+        public BooleanComparisonOpTest__CompareGreaterThanOrEqualUnorderedScalarSingle()
+        {
+            Succeeded = true;
+
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            _dataTable = new BooleanComparisonOpTest__DataTable<Single>(_data1, _data2);
+        }
+
+        public bool IsSupported => Sse.IsSupported;
+
+        public bool Succeeded { get; set; }
+
+        public void RunBasicScenario()
+        {
+            var result = Sse.CompareGreaterThanOrEqualUnorderedScalar(
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+            );
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, result);
+        }
+
+        public void RunReflectionScenario()
+        {
+            var result = typeof(Sse).GetMethod(nameof(Sse.CompareGreaterThanOrEqualUnorderedScalar), new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) })
+                                     .Invoke(null, new object[] {
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+                                     });
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, (bool)(result));
+        }
+
+        public void RunClsVarScenario()
+        {
+            var result = Sse.CompareGreaterThanOrEqualUnorderedScalar(
+                _clsVar1,
+                _clsVar2
+            );
+
+            ValidateResult(_clsVar1, _clsVar2, result);
+        }
+
+        public void RunLclVarScenario()
+        {
+            var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+            var right = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr);
+            var result = Sse.CompareGreaterThanOrEqualUnorderedScalar(left, right);
+
+            ValidateResult(left, right, result);
+        }
+
+        public void RunLclFldScenario()
+        {
+            var test = new BooleanComparisonOpTest__CompareGreaterThanOrEqualUnorderedScalarSingle();
+            var result = Sse.CompareGreaterThanOrEqualUnorderedScalar(test._fld1, test._fld2);
+
+            ValidateResult(test._fld1, test._fld2, result);
+        }
+
+        public void RunFldScenario()
+        {
+            var result = Sse.CompareGreaterThanOrEqualUnorderedScalar(_fld1, _fld2);
+
+            ValidateResult(_fld1, _fld2, result);
+        }
+
+        public void RunUnsupportedScenario()
+        {
+            Succeeded = false;
+
+            try
+            {
+                RunBasicScenario();
+            }
+            catch (PlatformNotSupportedException)
+            {
+                Succeeded = true;
+            }
+        }
+
+        private void ValidateResult(Vector128<Single> left, Vector128<Single> right, bool result, [CallerMemberName] string method = "")
+        {
+            Single[] inArray1 = new Single[ElementCount];
+            Single[] inArray2 = new Single[ElementCount];
+
+            Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
+            Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+
+            ValidateResult(inArray1, inArray2, result, method);
+        }
+
+        private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "")
+        {
+            if ((left[0] >= right[0]) != result)
+            {
+                Succeeded = false;
+
+                Console.WriteLine($"{nameof(Sse)}.{nameof(Sse.CompareGreaterThanOrEqualUnorderedScalar)}<Single>: {method} failed:");
+                Console.WriteLine($"    left: ({string.Join(", ", left)})");
+                Console.WriteLine($"   right: ({string.Join(", ", right)})");
+                Console.WriteLine($"  result: ({string.Join(", ", result)})");
+                Console.WriteLine();
+            }
+        }
+    }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar.cs
deleted file mode 100644 (file)
index b7a6e90..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
-    class Program
-    {
-        const int Pass = 100;
-        const int Fail = 0;
-
-        static unsafe int Main(string[] args)
-        {
-            int testResult = Pass;
-
-            if (Sse.IsSupported)
-            {
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 22, -5, 100, 0 }, new float[4] { 1, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (!Sse.CompareGreaterThanOrEqualUnorderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareGreaterThanOrEqualUnorderedScalar failed positive test");
-                        testResult = Fail;
-                    }
-                }
-
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 22, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (Sse.CompareGreaterThanOrEqualUnorderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareGreaterThanOrEqualUnorderedScalar failed negative test");
-                        testResult = Fail;
-                    }
-                }
-            }
-
-
-            return testResult;
-        }
-
-        public unsafe struct TestTable<T> : IDisposable where T : struct
-        {
-            public T[] inArray1;
-            public T[] inArray2;
-
-            public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
-            public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer();
-
-            GCHandle inHandle1;
-            GCHandle inHandle2;
-            public TestTable(T[] a, T[] b)
-            {
-                this.inArray1 = a;
-                this.inArray2 = b;
-
-                inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
-                inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned);
-            }
-
-            public void Dispose()
-            {
-                inHandle1.Free();
-                inHandle2.Free();
-            }
-        }
-
-    }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar_r.csproj
deleted file mode 100644 (file)
index b6bf9d8..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize></Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareGreaterThanOrEqualUnorderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrEqualUnorderedScalar_ro.csproj
deleted file mode 100644 (file)
index 5516f55..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize>True</Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareGreaterThanOrEqualUnorderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar.Single.cs
new file mode 100644 (file)
index 0000000..51dd48c
--- /dev/null
@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx  *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make    *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file.                                             *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+    public static partial class Program
+    {
+        private static void CompareGreaterThanOrderedScalarSingle()
+        {
+            var test = new BooleanComparisonOpTest__CompareGreaterThanOrderedScalarSingle();
+
+            if (test.IsSupported)
+            {
+                // Validates basic functionality works
+                test.RunBasicScenario();
+
+                // Validates calling via reflection works
+                test.RunReflectionScenario();
+
+                // Validates passing a static member works
+                test.RunClsVarScenario();
+
+                // Validates passing a local works
+                test.RunLclVarScenario();
+
+                // Validates passing the field of a local works
+                test.RunLclFldScenario();
+
+                // Validates passing an instance member works
+                test.RunFldScenario();
+            }
+            else
+            {
+                // Validates we throw on unsupported hardware
+                test.RunUnsupportedScenario();
+            }
+
+            if (!test.Succeeded)
+            {
+                throw new Exception("One or more scenarios did not complete as expected.");
+            }
+        }
+    }
+
+    public sealed unsafe class BooleanComparisonOpTest__CompareGreaterThanOrderedScalarSingle
+    {
+        private const int VectorSize = 16;
+        private const int ElementCount = VectorSize / sizeof(Single);
+
+        private static Single[] _data1 = new Single[ElementCount];
+        private static Single[] _data2 = new Single[ElementCount];
+
+        private static Vector128<Single> _clsVar1;
+        private static Vector128<Single> _clsVar2;
+
+        private Vector128<Single> _fld1;
+        private Vector128<Single> _fld2;
+
+        private BooleanComparisonOpTest__DataTable<Single> _dataTable;
+
+        static BooleanComparisonOpTest__CompareGreaterThanOrderedScalarSingle()
+        {
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+        }
+
+        public BooleanComparisonOpTest__CompareGreaterThanOrderedScalarSingle()
+        {
+            Succeeded = true;
+
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            _dataTable = new BooleanComparisonOpTest__DataTable<Single>(_data1, _data2);
+        }
+
+        public bool IsSupported => Sse.IsSupported;
+
+        public bool Succeeded { get; set; }
+
+        public void RunBasicScenario()
+        {
+            var result = Sse.CompareGreaterThanOrderedScalar(
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+            );
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, result);
+        }
+
+        public void RunReflectionScenario()
+        {
+            var result = typeof(Sse).GetMethod(nameof(Sse.CompareGreaterThanOrderedScalar), new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) })
+                                     .Invoke(null, new object[] {
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+                                     });
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, (bool)(result));
+        }
+
+        public void RunClsVarScenario()
+        {
+            var result = Sse.CompareGreaterThanOrderedScalar(
+                _clsVar1,
+                _clsVar2
+            );
+
+            ValidateResult(_clsVar1, _clsVar2, result);
+        }
+
+        public void RunLclVarScenario()
+        {
+            var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+            var right = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr);
+            var result = Sse.CompareGreaterThanOrderedScalar(left, right);
+
+            ValidateResult(left, right, result);
+        }
+
+        public void RunLclFldScenario()
+        {
+            var test = new BooleanComparisonOpTest__CompareGreaterThanOrderedScalarSingle();
+            var result = Sse.CompareGreaterThanOrderedScalar(test._fld1, test._fld2);
+
+            ValidateResult(test._fld1, test._fld2, result);
+        }
+
+        public void RunFldScenario()
+        {
+            var result = Sse.CompareGreaterThanOrderedScalar(_fld1, _fld2);
+
+            ValidateResult(_fld1, _fld2, result);
+        }
+
+        public void RunUnsupportedScenario()
+        {
+            Succeeded = false;
+
+            try
+            {
+                RunBasicScenario();
+            }
+            catch (PlatformNotSupportedException)
+            {
+                Succeeded = true;
+            }
+        }
+
+        private void ValidateResult(Vector128<Single> left, Vector128<Single> right, bool result, [CallerMemberName] string method = "")
+        {
+            Single[] inArray1 = new Single[ElementCount];
+            Single[] inArray2 = new Single[ElementCount];
+
+            Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
+            Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+
+            ValidateResult(inArray1, inArray2, result, method);
+        }
+
+        private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "")
+        {
+            if ((left[0] > right[0]) != result)
+            {
+                Succeeded = false;
+
+                Console.WriteLine($"{nameof(Sse)}.{nameof(Sse.CompareGreaterThanOrderedScalar)}<Single>: {method} failed:");
+                Console.WriteLine($"    left: ({string.Join(", ", left)})");
+                Console.WriteLine($"   right: ({string.Join(", ", right)})");
+                Console.WriteLine($"  result: ({string.Join(", ", result)})");
+                Console.WriteLine();
+            }
+        }
+    }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar.cs
deleted file mode 100644 (file)
index 84254af..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
-    class Program
-    {
-        const int Pass = 100;
-        const int Fail = 0;
-
-        static unsafe int Main(string[] args)
-        {
-            int testResult = Pass;
-
-            if (Sse.IsSupported)
-            {
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 22, -5, 100, 0 }, new float[4] { 1, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (!Sse.CompareGreaterThanOrderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareGreaterThanOrderedScalar failed positive test");
-                        testResult = Fail;
-                    }
-                }
-
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 22, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (Sse.CompareGreaterThanOrderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareGreaterThanOrderedScalar failed negative test");
-                        testResult = Fail;
-                    }
-                }
-            }
-
-
-            return testResult;
-        }
-
-        public unsafe struct TestTable<T> : IDisposable where T : struct
-        {
-            public T[] inArray1;
-            public T[] inArray2;
-
-            public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
-            public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer();
-
-            GCHandle inHandle1;
-            GCHandle inHandle2;
-            public TestTable(T[] a, T[] b)
-            {
-                this.inArray1 = a;
-                this.inArray2 = b;
-
-                inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
-                inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned);
-            }
-
-            public void Dispose()
-            {
-                inHandle1.Free();
-                inHandle2.Free();
-            }
-        }
-
-    }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar_r.csproj
deleted file mode 100644 (file)
index 7f2e72e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize></Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareGreaterThanOrderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanOrderedScalar_ro.csproj
deleted file mode 100644 (file)
index 93ebf93..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize>True</Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareGreaterThanOrderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar.Single.cs
new file mode 100644 (file)
index 0000000..9a0d11e
--- /dev/null
@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx  *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make    *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file.                                             *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+    public static partial class Program
+    {
+        private static void CompareGreaterThanUnorderedScalarSingle()
+        {
+            var test = new BooleanComparisonOpTest__CompareGreaterThanUnorderedScalarSingle();
+
+            if (test.IsSupported)
+            {
+                // Validates basic functionality works
+                test.RunBasicScenario();
+
+                // Validates calling via reflection works
+                test.RunReflectionScenario();
+
+                // Validates passing a static member works
+                test.RunClsVarScenario();
+
+                // Validates passing a local works
+                test.RunLclVarScenario();
+
+                // Validates passing the field of a local works
+                test.RunLclFldScenario();
+
+                // Validates passing an instance member works
+                test.RunFldScenario();
+            }
+            else
+            {
+                // Validates we throw on unsupported hardware
+                test.RunUnsupportedScenario();
+            }
+
+            if (!test.Succeeded)
+            {
+                throw new Exception("One or more scenarios did not complete as expected.");
+            }
+        }
+    }
+
+    public sealed unsafe class BooleanComparisonOpTest__CompareGreaterThanUnorderedScalarSingle
+    {
+        private const int VectorSize = 16;
+        private const int ElementCount = VectorSize / sizeof(Single);
+
+        private static Single[] _data1 = new Single[ElementCount];
+        private static Single[] _data2 = new Single[ElementCount];
+
+        private static Vector128<Single> _clsVar1;
+        private static Vector128<Single> _clsVar2;
+
+        private Vector128<Single> _fld1;
+        private Vector128<Single> _fld2;
+
+        private BooleanComparisonOpTest__DataTable<Single> _dataTable;
+
+        static BooleanComparisonOpTest__CompareGreaterThanUnorderedScalarSingle()
+        {
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+        }
+
+        public BooleanComparisonOpTest__CompareGreaterThanUnorderedScalarSingle()
+        {
+            Succeeded = true;
+
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            _dataTable = new BooleanComparisonOpTest__DataTable<Single>(_data1, _data2);
+        }
+
+        public bool IsSupported => Sse.IsSupported;
+
+        public bool Succeeded { get; set; }
+
+        public void RunBasicScenario()
+        {
+            var result = Sse.CompareGreaterThanUnorderedScalar(
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+            );
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, result);
+        }
+
+        public void RunReflectionScenario()
+        {
+            var result = typeof(Sse).GetMethod(nameof(Sse.CompareGreaterThanUnorderedScalar), new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) })
+                                     .Invoke(null, new object[] {
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+                                     });
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, (bool)(result));
+        }
+
+        public void RunClsVarScenario()
+        {
+            var result = Sse.CompareGreaterThanUnorderedScalar(
+                _clsVar1,
+                _clsVar2
+            );
+
+            ValidateResult(_clsVar1, _clsVar2, result);
+        }
+
+        public void RunLclVarScenario()
+        {
+            var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+            var right = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr);
+            var result = Sse.CompareGreaterThanUnorderedScalar(left, right);
+
+            ValidateResult(left, right, result);
+        }
+
+        public void RunLclFldScenario()
+        {
+            var test = new BooleanComparisonOpTest__CompareGreaterThanUnorderedScalarSingle();
+            var result = Sse.CompareGreaterThanUnorderedScalar(test._fld1, test._fld2);
+
+            ValidateResult(test._fld1, test._fld2, result);
+        }
+
+        public void RunFldScenario()
+        {
+            var result = Sse.CompareGreaterThanUnorderedScalar(_fld1, _fld2);
+
+            ValidateResult(_fld1, _fld2, result);
+        }
+
+        public void RunUnsupportedScenario()
+        {
+            Succeeded = false;
+
+            try
+            {
+                RunBasicScenario();
+            }
+            catch (PlatformNotSupportedException)
+            {
+                Succeeded = true;
+            }
+        }
+
+        private void ValidateResult(Vector128<Single> left, Vector128<Single> right, bool result, [CallerMemberName] string method = "")
+        {
+            Single[] inArray1 = new Single[ElementCount];
+            Single[] inArray2 = new Single[ElementCount];
+
+            Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
+            Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+
+            ValidateResult(inArray1, inArray2, result, method);
+        }
+
+        private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "")
+        {
+            if ((left[0] > right[0]) != result)
+            {
+                Succeeded = false;
+
+                Console.WriteLine($"{nameof(Sse)}.{nameof(Sse.CompareGreaterThanUnorderedScalar)}<Single>: {method} failed:");
+                Console.WriteLine($"    left: ({string.Join(", ", left)})");
+                Console.WriteLine($"   right: ({string.Join(", ", right)})");
+                Console.WriteLine($"  result: ({string.Join(", ", result)})");
+                Console.WriteLine();
+            }
+        }
+    }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar.cs
deleted file mode 100644 (file)
index 8a0a804..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
-    class Program
-    {
-        const int Pass = 100;
-        const int Fail = 0;
-
-        static unsafe int Main(string[] args)
-        {
-            int testResult = Pass;
-
-            if (Sse.IsSupported)
-            {
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 22, -5, 100, 0 }, new float[4] { 1, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (!Sse.CompareGreaterThanUnorderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareGreaterThanUnorderedScalar failed positive test");
-                        testResult = Fail;
-                    }
-                }
-
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 22, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (Sse.CompareGreaterThanUnorderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareGreaterThanUnorderedScalar failed negative test");
-                        testResult = Fail;
-                    }
-                }
-            }
-
-
-            return testResult;
-        }
-
-        public unsafe struct TestTable<T> : IDisposable where T : struct
-        {
-            public T[] inArray1;
-            public T[] inArray2;
-
-            public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
-            public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer();
-
-            GCHandle inHandle1;
-            GCHandle inHandle2;
-            public TestTable(T[] a, T[] b)
-            {
-                this.inArray1 = a;
-                this.inArray2 = b;
-
-                inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
-                inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned);
-            }
-
-            public void Dispose()
-            {
-                inHandle1.Free();
-                inHandle2.Free();
-            }
-        }
-
-    }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar_r.csproj
deleted file mode 100644 (file)
index 6992a0d..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize></Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareGreaterThanUnorderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareGreaterThanUnorderedScalar_ro.csproj
deleted file mode 100644 (file)
index c15d7d9..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize>True</Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareGreaterThanUnorderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar.Single.cs
new file mode 100644 (file)
index 0000000..bb22aa7
--- /dev/null
@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx  *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make    *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file.                                             *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+    public static partial class Program
+    {
+        private static void CompareLessThanOrEqualOrderedScalarSingle()
+        {
+            var test = new BooleanComparisonOpTest__CompareLessThanOrEqualOrderedScalarSingle();
+
+            if (test.IsSupported)
+            {
+                // Validates basic functionality works
+                test.RunBasicScenario();
+
+                // Validates calling via reflection works
+                test.RunReflectionScenario();
+
+                // Validates passing a static member works
+                test.RunClsVarScenario();
+
+                // Validates passing a local works
+                test.RunLclVarScenario();
+
+                // Validates passing the field of a local works
+                test.RunLclFldScenario();
+
+                // Validates passing an instance member works
+                test.RunFldScenario();
+            }
+            else
+            {
+                // Validates we throw on unsupported hardware
+                test.RunUnsupportedScenario();
+            }
+
+            if (!test.Succeeded)
+            {
+                throw new Exception("One or more scenarios did not complete as expected.");
+            }
+        }
+    }
+
+    public sealed unsafe class BooleanComparisonOpTest__CompareLessThanOrEqualOrderedScalarSingle
+    {
+        private const int VectorSize = 16;
+        private const int ElementCount = VectorSize / sizeof(Single);
+
+        private static Single[] _data1 = new Single[ElementCount];
+        private static Single[] _data2 = new Single[ElementCount];
+
+        private static Vector128<Single> _clsVar1;
+        private static Vector128<Single> _clsVar2;
+
+        private Vector128<Single> _fld1;
+        private Vector128<Single> _fld2;
+
+        private BooleanComparisonOpTest__DataTable<Single> _dataTable;
+
+        static BooleanComparisonOpTest__CompareLessThanOrEqualOrderedScalarSingle()
+        {
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+        }
+
+        public BooleanComparisonOpTest__CompareLessThanOrEqualOrderedScalarSingle()
+        {
+            Succeeded = true;
+
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            _dataTable = new BooleanComparisonOpTest__DataTable<Single>(_data1, _data2);
+        }
+
+        public bool IsSupported => Sse.IsSupported;
+
+        public bool Succeeded { get; set; }
+
+        public void RunBasicScenario()
+        {
+            var result = Sse.CompareLessThanOrEqualOrderedScalar(
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+            );
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, result);
+        }
+
+        public void RunReflectionScenario()
+        {
+            var result = typeof(Sse).GetMethod(nameof(Sse.CompareLessThanOrEqualOrderedScalar), new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) })
+                                     .Invoke(null, new object[] {
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+                                     });
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, (bool)(result));
+        }
+
+        public void RunClsVarScenario()
+        {
+            var result = Sse.CompareLessThanOrEqualOrderedScalar(
+                _clsVar1,
+                _clsVar2
+            );
+
+            ValidateResult(_clsVar1, _clsVar2, result);
+        }
+
+        public void RunLclVarScenario()
+        {
+            var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+            var right = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr);
+            var result = Sse.CompareLessThanOrEqualOrderedScalar(left, right);
+
+            ValidateResult(left, right, result);
+        }
+
+        public void RunLclFldScenario()
+        {
+            var test = new BooleanComparisonOpTest__CompareLessThanOrEqualOrderedScalarSingle();
+            var result = Sse.CompareLessThanOrEqualOrderedScalar(test._fld1, test._fld2);
+
+            ValidateResult(test._fld1, test._fld2, result);
+        }
+
+        public void RunFldScenario()
+        {
+            var result = Sse.CompareLessThanOrEqualOrderedScalar(_fld1, _fld2);
+
+            ValidateResult(_fld1, _fld2, result);
+        }
+
+        public void RunUnsupportedScenario()
+        {
+            Succeeded = false;
+
+            try
+            {
+                RunBasicScenario();
+            }
+            catch (PlatformNotSupportedException)
+            {
+                Succeeded = true;
+            }
+        }
+
+        private void ValidateResult(Vector128<Single> left, Vector128<Single> right, bool result, [CallerMemberName] string method = "")
+        {
+            Single[] inArray1 = new Single[ElementCount];
+            Single[] inArray2 = new Single[ElementCount];
+
+            Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
+            Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+
+            ValidateResult(inArray1, inArray2, result, method);
+        }
+
+        private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "")
+        {
+            if ((left[0] <= right[0]) != result)
+            {
+                Succeeded = false;
+
+                Console.WriteLine($"{nameof(Sse)}.{nameof(Sse.CompareLessThanOrEqualOrderedScalar)}<Single>: {method} failed:");
+                Console.WriteLine($"    left: ({string.Join(", ", left)})");
+                Console.WriteLine($"   right: ({string.Join(", ", right)})");
+                Console.WriteLine($"  result: ({string.Join(", ", result)})");
+                Console.WriteLine();
+            }
+        }
+    }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar.cs
deleted file mode 100644 (file)
index 1a2bb74..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
-    class Program
-    {
-        const int Pass = 100;
-        const int Fail = 0;
-
-        static unsafe int Main(string[] args)
-        {
-            int testResult = Pass;
-
-            if (Sse.IsSupported)
-            {
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 22, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (!Sse.CompareLessThanOrEqualOrderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareLessThanOrEqualOrderedScalar failed positive test");
-                        testResult = Fail;
-                    }
-                }
-
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 22, -5, 100, 0 }, new float[4] { 1, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (Sse.CompareLessThanOrEqualOrderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareLessThanOrEqualOrderedScalar failed negative test");
-                        testResult = Fail;
-                    }
-                }
-            }
-
-
-            return testResult;
-        }
-
-        public unsafe struct TestTable<T> : IDisposable where T : struct
-        {
-            public T[] inArray1;
-            public T[] inArray2;
-
-            public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
-            public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer();
-
-            GCHandle inHandle1;
-            GCHandle inHandle2;
-            public TestTable(T[] a, T[] b)
-            {
-                this.inArray1 = a;
-                this.inArray2 = b;
-
-                inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
-                inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned);
-            }
-
-            public void Dispose()
-            {
-                inHandle1.Free();
-                inHandle2.Free();
-            }
-        }
-
-    }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar_r.csproj
deleted file mode 100644 (file)
index 76681b4..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize></Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareLessThanOrEqualOrderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualOrderedScalar_ro.csproj
deleted file mode 100644 (file)
index 6269bc6..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize>True</Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareLessThanOrEqualOrderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar.Single.cs
new file mode 100644 (file)
index 0000000..35d6708
--- /dev/null
@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx  *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make    *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file.                                             *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+    public static partial class Program
+    {
+        private static void CompareLessThanOrEqualUnorderedScalarSingle()
+        {
+            var test = new BooleanComparisonOpTest__CompareLessThanOrEqualUnorderedScalarSingle();
+
+            if (test.IsSupported)
+            {
+                // Validates basic functionality works
+                test.RunBasicScenario();
+
+                // Validates calling via reflection works
+                test.RunReflectionScenario();
+
+                // Validates passing a static member works
+                test.RunClsVarScenario();
+
+                // Validates passing a local works
+                test.RunLclVarScenario();
+
+                // Validates passing the field of a local works
+                test.RunLclFldScenario();
+
+                // Validates passing an instance member works
+                test.RunFldScenario();
+            }
+            else
+            {
+                // Validates we throw on unsupported hardware
+                test.RunUnsupportedScenario();
+            }
+
+            if (!test.Succeeded)
+            {
+                throw new Exception("One or more scenarios did not complete as expected.");
+            }
+        }
+    }
+
+    public sealed unsafe class BooleanComparisonOpTest__CompareLessThanOrEqualUnorderedScalarSingle
+    {
+        private const int VectorSize = 16;
+        private const int ElementCount = VectorSize / sizeof(Single);
+
+        private static Single[] _data1 = new Single[ElementCount];
+        private static Single[] _data2 = new Single[ElementCount];
+
+        private static Vector128<Single> _clsVar1;
+        private static Vector128<Single> _clsVar2;
+
+        private Vector128<Single> _fld1;
+        private Vector128<Single> _fld2;
+
+        private BooleanComparisonOpTest__DataTable<Single> _dataTable;
+
+        static BooleanComparisonOpTest__CompareLessThanOrEqualUnorderedScalarSingle()
+        {
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+        }
+
+        public BooleanComparisonOpTest__CompareLessThanOrEqualUnorderedScalarSingle()
+        {
+            Succeeded = true;
+
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            _dataTable = new BooleanComparisonOpTest__DataTable<Single>(_data1, _data2);
+        }
+
+        public bool IsSupported => Sse.IsSupported;
+
+        public bool Succeeded { get; set; }
+
+        public void RunBasicScenario()
+        {
+            var result = Sse.CompareLessThanOrEqualUnorderedScalar(
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+            );
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, result);
+        }
+
+        public void RunReflectionScenario()
+        {
+            var result = typeof(Sse).GetMethod(nameof(Sse.CompareLessThanOrEqualUnorderedScalar), new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) })
+                                     .Invoke(null, new object[] {
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+                                     });
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, (bool)(result));
+        }
+
+        public void RunClsVarScenario()
+        {
+            var result = Sse.CompareLessThanOrEqualUnorderedScalar(
+                _clsVar1,
+                _clsVar2
+            );
+
+            ValidateResult(_clsVar1, _clsVar2, result);
+        }
+
+        public void RunLclVarScenario()
+        {
+            var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+            var right = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr);
+            var result = Sse.CompareLessThanOrEqualUnorderedScalar(left, right);
+
+            ValidateResult(left, right, result);
+        }
+
+        public void RunLclFldScenario()
+        {
+            var test = new BooleanComparisonOpTest__CompareLessThanOrEqualUnorderedScalarSingle();
+            var result = Sse.CompareLessThanOrEqualUnorderedScalar(test._fld1, test._fld2);
+
+            ValidateResult(test._fld1, test._fld2, result);
+        }
+
+        public void RunFldScenario()
+        {
+            var result = Sse.CompareLessThanOrEqualUnorderedScalar(_fld1, _fld2);
+
+            ValidateResult(_fld1, _fld2, result);
+        }
+
+        public void RunUnsupportedScenario()
+        {
+            Succeeded = false;
+
+            try
+            {
+                RunBasicScenario();
+            }
+            catch (PlatformNotSupportedException)
+            {
+                Succeeded = true;
+            }
+        }
+
+        private void ValidateResult(Vector128<Single> left, Vector128<Single> right, bool result, [CallerMemberName] string method = "")
+        {
+            Single[] inArray1 = new Single[ElementCount];
+            Single[] inArray2 = new Single[ElementCount];
+
+            Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
+            Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+
+            ValidateResult(inArray1, inArray2, result, method);
+        }
+
+        private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "")
+        {
+            if ((left[0] <= right[0]) != result)
+            {
+                Succeeded = false;
+
+                Console.WriteLine($"{nameof(Sse)}.{nameof(Sse.CompareLessThanOrEqualUnorderedScalar)}<Single>: {method} failed:");
+                Console.WriteLine($"    left: ({string.Join(", ", left)})");
+                Console.WriteLine($"   right: ({string.Join(", ", right)})");
+                Console.WriteLine($"  result: ({string.Join(", ", result)})");
+                Console.WriteLine();
+            }
+        }
+    }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar.cs
deleted file mode 100644 (file)
index 22b201c..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
-    class Program
-    {
-        const int Pass = 100;
-        const int Fail = 0;
-
-        static unsafe int Main(string[] args)
-        {
-            int testResult = Pass;
-
-            if (Sse.IsSupported)
-            {
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 22, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (!Sse.CompareLessThanOrEqualUnorderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareLessThanOrEqualUnorderedScalar failed positive test");
-                        testResult = Fail;
-                    }
-                }
-
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 22, -5, 100, 0 }, new float[4] { 1, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (Sse.CompareLessThanOrEqualUnorderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareLessThanOrEqualUnorderedScalar failed negative test");
-                        testResult = Fail;
-                    }
-                }
-            }
-
-
-            return testResult;
-        }
-
-        public unsafe struct TestTable<T> : IDisposable where T : struct
-        {
-            public T[] inArray1;
-            public T[] inArray2;
-
-            public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
-            public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer();
-
-            GCHandle inHandle1;
-            GCHandle inHandle2;
-            public TestTable(T[] a, T[] b)
-            {
-                this.inArray1 = a;
-                this.inArray2 = b;
-
-                inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
-                inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned);
-            }
-
-            public void Dispose()
-            {
-                inHandle1.Free();
-                inHandle2.Free();
-            }
-        }
-
-    }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar_r.csproj
deleted file mode 100644 (file)
index 3a8952e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize></Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareLessThanOrEqualUnorderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrEqualUnorderedScalar_ro.csproj
deleted file mode 100644 (file)
index eda9e1d..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize>True</Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareLessThanOrEqualUnorderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar.Single.cs
new file mode 100644 (file)
index 0000000..9abafd9
--- /dev/null
@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx  *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make    *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file.                                             *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+    public static partial class Program
+    {
+        private static void CompareLessThanOrderedScalarSingle()
+        {
+            var test = new BooleanComparisonOpTest__CompareLessThanOrderedScalarSingle();
+
+            if (test.IsSupported)
+            {
+                // Validates basic functionality works
+                test.RunBasicScenario();
+
+                // Validates calling via reflection works
+                test.RunReflectionScenario();
+
+                // Validates passing a static member works
+                test.RunClsVarScenario();
+
+                // Validates passing a local works
+                test.RunLclVarScenario();
+
+                // Validates passing the field of a local works
+                test.RunLclFldScenario();
+
+                // Validates passing an instance member works
+                test.RunFldScenario();
+            }
+            else
+            {
+                // Validates we throw on unsupported hardware
+                test.RunUnsupportedScenario();
+            }
+
+            if (!test.Succeeded)
+            {
+                throw new Exception("One or more scenarios did not complete as expected.");
+            }
+        }
+    }
+
+    public sealed unsafe class BooleanComparisonOpTest__CompareLessThanOrderedScalarSingle
+    {
+        private const int VectorSize = 16;
+        private const int ElementCount = VectorSize / sizeof(Single);
+
+        private static Single[] _data1 = new Single[ElementCount];
+        private static Single[] _data2 = new Single[ElementCount];
+
+        private static Vector128<Single> _clsVar1;
+        private static Vector128<Single> _clsVar2;
+
+        private Vector128<Single> _fld1;
+        private Vector128<Single> _fld2;
+
+        private BooleanComparisonOpTest__DataTable<Single> _dataTable;
+
+        static BooleanComparisonOpTest__CompareLessThanOrderedScalarSingle()
+        {
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+        }
+
+        public BooleanComparisonOpTest__CompareLessThanOrderedScalarSingle()
+        {
+            Succeeded = true;
+
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            _dataTable = new BooleanComparisonOpTest__DataTable<Single>(_data1, _data2);
+        }
+
+        public bool IsSupported => Sse.IsSupported;
+
+        public bool Succeeded { get; set; }
+
+        public void RunBasicScenario()
+        {
+            var result = Sse.CompareLessThanOrderedScalar(
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+            );
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, result);
+        }
+
+        public void RunReflectionScenario()
+        {
+            var result = typeof(Sse).GetMethod(nameof(Sse.CompareLessThanOrderedScalar), new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) })
+                                     .Invoke(null, new object[] {
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+                                     });
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, (bool)(result));
+        }
+
+        public void RunClsVarScenario()
+        {
+            var result = Sse.CompareLessThanOrderedScalar(
+                _clsVar1,
+                _clsVar2
+            );
+
+            ValidateResult(_clsVar1, _clsVar2, result);
+        }
+
+        public void RunLclVarScenario()
+        {
+            var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+            var right = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr);
+            var result = Sse.CompareLessThanOrderedScalar(left, right);
+
+            ValidateResult(left, right, result);
+        }
+
+        public void RunLclFldScenario()
+        {
+            var test = new BooleanComparisonOpTest__CompareLessThanOrderedScalarSingle();
+            var result = Sse.CompareLessThanOrderedScalar(test._fld1, test._fld2);
+
+            ValidateResult(test._fld1, test._fld2, result);
+        }
+
+        public void RunFldScenario()
+        {
+            var result = Sse.CompareLessThanOrderedScalar(_fld1, _fld2);
+
+            ValidateResult(_fld1, _fld2, result);
+        }
+
+        public void RunUnsupportedScenario()
+        {
+            Succeeded = false;
+
+            try
+            {
+                RunBasicScenario();
+            }
+            catch (PlatformNotSupportedException)
+            {
+                Succeeded = true;
+            }
+        }
+
+        private void ValidateResult(Vector128<Single> left, Vector128<Single> right, bool result, [CallerMemberName] string method = "")
+        {
+            Single[] inArray1 = new Single[ElementCount];
+            Single[] inArray2 = new Single[ElementCount];
+
+            Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
+            Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+
+            ValidateResult(inArray1, inArray2, result, method);
+        }
+
+        private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "")
+        {
+            if ((left[0] < right[0]) != result)
+            {
+                Succeeded = false;
+
+                Console.WriteLine($"{nameof(Sse)}.{nameof(Sse.CompareLessThanOrderedScalar)}<Single>: {method} failed:");
+                Console.WriteLine($"    left: ({string.Join(", ", left)})");
+                Console.WriteLine($"   right: ({string.Join(", ", right)})");
+                Console.WriteLine($"  result: ({string.Join(", ", result)})");
+                Console.WriteLine();
+            }
+        }
+    }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar.cs
deleted file mode 100644 (file)
index 2f0c15e..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
-    class Program
-    {
-        const int Pass = 100;
-        const int Fail = 0;
-
-        static unsafe int Main(string[] args)
-        {
-            int testResult = Pass;
-
-            if (Sse.IsSupported)
-            {
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 22, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (!Sse.CompareLessThanOrderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareLessThanOrderedScalar failed positive test");
-                        testResult = Fail;
-                    }
-                }
-
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 22, -5, 100, 0 }, new float[4] { 1, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (Sse.CompareLessThanOrderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareLessThanOrderedScalar failed negative test");
-                        testResult = Fail;
-                    }
-                }
-            }
-
-
-            return testResult;
-        }
-
-        public unsafe struct TestTable<T> : IDisposable where T : struct
-        {
-            public T[] inArray1;
-            public T[] inArray2;
-
-            public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
-            public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer();
-
-            GCHandle inHandle1;
-            GCHandle inHandle2;
-            public TestTable(T[] a, T[] b)
-            {
-                this.inArray1 = a;
-                this.inArray2 = b;
-
-                inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
-                inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned);
-            }
-
-            public void Dispose()
-            {
-                inHandle1.Free();
-                inHandle2.Free();
-            }
-        }
-
-    }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar_r.csproj
deleted file mode 100644 (file)
index 422c95e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize></Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareLessThanOrderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanOrderedScalar_ro.csproj
deleted file mode 100644 (file)
index 2f12ac5..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize>True</Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareLessThanOrderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar.Single.cs
new file mode 100644 (file)
index 0000000..a1d5fef
--- /dev/null
@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx  *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make    *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file.                                             *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+    public static partial class Program
+    {
+        private static void CompareLessThanUnorderedScalarSingle()
+        {
+            var test = new BooleanComparisonOpTest__CompareLessThanUnorderedScalarSingle();
+
+            if (test.IsSupported)
+            {
+                // Validates basic functionality works
+                test.RunBasicScenario();
+
+                // Validates calling via reflection works
+                test.RunReflectionScenario();
+
+                // Validates passing a static member works
+                test.RunClsVarScenario();
+
+                // Validates passing a local works
+                test.RunLclVarScenario();
+
+                // Validates passing the field of a local works
+                test.RunLclFldScenario();
+
+                // Validates passing an instance member works
+                test.RunFldScenario();
+            }
+            else
+            {
+                // Validates we throw on unsupported hardware
+                test.RunUnsupportedScenario();
+            }
+
+            if (!test.Succeeded)
+            {
+                throw new Exception("One or more scenarios did not complete as expected.");
+            }
+        }
+    }
+
+    public sealed unsafe class BooleanComparisonOpTest__CompareLessThanUnorderedScalarSingle
+    {
+        private const int VectorSize = 16;
+        private const int ElementCount = VectorSize / sizeof(Single);
+
+        private static Single[] _data1 = new Single[ElementCount];
+        private static Single[] _data2 = new Single[ElementCount];
+
+        private static Vector128<Single> _clsVar1;
+        private static Vector128<Single> _clsVar2;
+
+        private Vector128<Single> _fld1;
+        private Vector128<Single> _fld2;
+
+        private BooleanComparisonOpTest__DataTable<Single> _dataTable;
+
+        static BooleanComparisonOpTest__CompareLessThanUnorderedScalarSingle()
+        {
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+        }
+
+        public BooleanComparisonOpTest__CompareLessThanUnorderedScalarSingle()
+        {
+            Succeeded = true;
+
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            _dataTable = new BooleanComparisonOpTest__DataTable<Single>(_data1, _data2);
+        }
+
+        public bool IsSupported => Sse.IsSupported;
+
+        public bool Succeeded { get; set; }
+
+        public void RunBasicScenario()
+        {
+            var result = Sse.CompareLessThanUnorderedScalar(
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+            );
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, result);
+        }
+
+        public void RunReflectionScenario()
+        {
+            var result = typeof(Sse).GetMethod(nameof(Sse.CompareLessThanUnorderedScalar), new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) })
+                                     .Invoke(null, new object[] {
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+                                     });
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, (bool)(result));
+        }
+
+        public void RunClsVarScenario()
+        {
+            var result = Sse.CompareLessThanUnorderedScalar(
+                _clsVar1,
+                _clsVar2
+            );
+
+            ValidateResult(_clsVar1, _clsVar2, result);
+        }
+
+        public void RunLclVarScenario()
+        {
+            var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+            var right = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr);
+            var result = Sse.CompareLessThanUnorderedScalar(left, right);
+
+            ValidateResult(left, right, result);
+        }
+
+        public void RunLclFldScenario()
+        {
+            var test = new BooleanComparisonOpTest__CompareLessThanUnorderedScalarSingle();
+            var result = Sse.CompareLessThanUnorderedScalar(test._fld1, test._fld2);
+
+            ValidateResult(test._fld1, test._fld2, result);
+        }
+
+        public void RunFldScenario()
+        {
+            var result = Sse.CompareLessThanUnorderedScalar(_fld1, _fld2);
+
+            ValidateResult(_fld1, _fld2, result);
+        }
+
+        public void RunUnsupportedScenario()
+        {
+            Succeeded = false;
+
+            try
+            {
+                RunBasicScenario();
+            }
+            catch (PlatformNotSupportedException)
+            {
+                Succeeded = true;
+            }
+        }
+
+        private void ValidateResult(Vector128<Single> left, Vector128<Single> right, bool result, [CallerMemberName] string method = "")
+        {
+            Single[] inArray1 = new Single[ElementCount];
+            Single[] inArray2 = new Single[ElementCount];
+
+            Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
+            Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+
+            ValidateResult(inArray1, inArray2, result, method);
+        }
+
+        private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "")
+        {
+            if ((left[0] < right[0]) != result)
+            {
+                Succeeded = false;
+
+                Console.WriteLine($"{nameof(Sse)}.{nameof(Sse.CompareLessThanUnorderedScalar)}<Single>: {method} failed:");
+                Console.WriteLine($"    left: ({string.Join(", ", left)})");
+                Console.WriteLine($"   right: ({string.Join(", ", right)})");
+                Console.WriteLine($"  result: ({string.Join(", ", result)})");
+                Console.WriteLine();
+            }
+        }
+    }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar.cs
deleted file mode 100644 (file)
index 3f64d00..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
-    class Program
-    {
-        const int Pass = 100;
-        const int Fail = 0;
-
-        static unsafe int Main(string[] args)
-        {
-            int testResult = Pass;
-
-            if (Sse.IsSupported)
-            {
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 22, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (!Sse.CompareLessThanUnorderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareLessThanUnorderedScalar failed positive test");
-                        testResult = Fail;
-                    }
-                }
-
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 22, -5, 100, 0 }, new float[4] { 1, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (Sse.CompareLessThanUnorderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareLessThanUnorderedScalar failed negative test");
-                        testResult = Fail;
-                    }
-                }
-            }
-
-
-            return testResult;
-        }
-
-        public unsafe struct TestTable<T> : IDisposable where T : struct
-        {
-            public T[] inArray1;
-            public T[] inArray2;
-
-            public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
-            public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer();
-
-            GCHandle inHandle1;
-            GCHandle inHandle2;
-            public TestTable(T[] a, T[] b)
-            {
-                this.inArray1 = a;
-                this.inArray2 = b;
-
-                inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
-                inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned);
-            }
-
-            public void Dispose()
-            {
-                inHandle1.Free();
-                inHandle2.Free();
-            }
-        }
-
-    }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar_r.csproj
deleted file mode 100644 (file)
index ba058ba..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize></Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareLessThanUnorderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareLessThanUnorderedScalar_ro.csproj
deleted file mode 100644 (file)
index 9fbe2eb..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize>True</Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareLessThanUnorderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar.Single.cs
new file mode 100644 (file)
index 0000000..4e0f2ad
--- /dev/null
@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx  *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make    *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file.                                             *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+    public static partial class Program
+    {
+        private static void CompareNotEqualOrderedScalarSingle()
+        {
+            var test = new BooleanComparisonOpTest__CompareNotEqualOrderedScalarSingle();
+
+            if (test.IsSupported)
+            {
+                // Validates basic functionality works
+                test.RunBasicScenario();
+
+                // Validates calling via reflection works
+                test.RunReflectionScenario();
+
+                // Validates passing a static member works
+                test.RunClsVarScenario();
+
+                // Validates passing a local works
+                test.RunLclVarScenario();
+
+                // Validates passing the field of a local works
+                test.RunLclFldScenario();
+
+                // Validates passing an instance member works
+                test.RunFldScenario();
+            }
+            else
+            {
+                // Validates we throw on unsupported hardware
+                test.RunUnsupportedScenario();
+            }
+
+            if (!test.Succeeded)
+            {
+                throw new Exception("One or more scenarios did not complete as expected.");
+            }
+        }
+    }
+
+    public sealed unsafe class BooleanComparisonOpTest__CompareNotEqualOrderedScalarSingle
+    {
+        private const int VectorSize = 16;
+        private const int ElementCount = VectorSize / sizeof(Single);
+
+        private static Single[] _data1 = new Single[ElementCount];
+        private static Single[] _data2 = new Single[ElementCount];
+
+        private static Vector128<Single> _clsVar1;
+        private static Vector128<Single> _clsVar2;
+
+        private Vector128<Single> _fld1;
+        private Vector128<Single> _fld2;
+
+        private BooleanComparisonOpTest__DataTable<Single> _dataTable;
+
+        static BooleanComparisonOpTest__CompareNotEqualOrderedScalarSingle()
+        {
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+        }
+
+        public BooleanComparisonOpTest__CompareNotEqualOrderedScalarSingle()
+        {
+            Succeeded = true;
+
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            _dataTable = new BooleanComparisonOpTest__DataTable<Single>(_data1, _data2);
+        }
+
+        public bool IsSupported => Sse.IsSupported;
+
+        public bool Succeeded { get; set; }
+
+        public void RunBasicScenario()
+        {
+            var result = Sse.CompareNotEqualOrderedScalar(
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+            );
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, result);
+        }
+
+        public void RunReflectionScenario()
+        {
+            var result = typeof(Sse).GetMethod(nameof(Sse.CompareNotEqualOrderedScalar), new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) })
+                                     .Invoke(null, new object[] {
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+                                     });
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, (bool)(result));
+        }
+
+        public void RunClsVarScenario()
+        {
+            var result = Sse.CompareNotEqualOrderedScalar(
+                _clsVar1,
+                _clsVar2
+            );
+
+            ValidateResult(_clsVar1, _clsVar2, result);
+        }
+
+        public void RunLclVarScenario()
+        {
+            var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+            var right = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr);
+            var result = Sse.CompareNotEqualOrderedScalar(left, right);
+
+            ValidateResult(left, right, result);
+        }
+
+        public void RunLclFldScenario()
+        {
+            var test = new BooleanComparisonOpTest__CompareNotEqualOrderedScalarSingle();
+            var result = Sse.CompareNotEqualOrderedScalar(test._fld1, test._fld2);
+
+            ValidateResult(test._fld1, test._fld2, result);
+        }
+
+        public void RunFldScenario()
+        {
+            var result = Sse.CompareNotEqualOrderedScalar(_fld1, _fld2);
+
+            ValidateResult(_fld1, _fld2, result);
+        }
+
+        public void RunUnsupportedScenario()
+        {
+            Succeeded = false;
+
+            try
+            {
+                RunBasicScenario();
+            }
+            catch (PlatformNotSupportedException)
+            {
+                Succeeded = true;
+            }
+        }
+
+        private void ValidateResult(Vector128<Single> left, Vector128<Single> right, bool result, [CallerMemberName] string method = "")
+        {
+            Single[] inArray1 = new Single[ElementCount];
+            Single[] inArray2 = new Single[ElementCount];
+
+            Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
+            Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+
+            ValidateResult(inArray1, inArray2, result, method);
+        }
+
+        private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "")
+        {
+            if ((left[0] != right[0]) != result)
+            {
+                Succeeded = false;
+
+                Console.WriteLine($"{nameof(Sse)}.{nameof(Sse.CompareNotEqualOrderedScalar)}<Single>: {method} failed:");
+                Console.WriteLine($"    left: ({string.Join(", ", left)})");
+                Console.WriteLine($"   right: ({string.Join(", ", right)})");
+                Console.WriteLine($"  result: ({string.Join(", ", result)})");
+                Console.WriteLine();
+            }
+        }
+    }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar.cs
deleted file mode 100644 (file)
index f4cab7f..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
-    class Program
-    {
-        const int Pass = 100;
-        const int Fail = 0;
-
-        static unsafe int Main(string[] args)
-        {
-            int testResult = Pass;
-
-            if (Sse.IsSupported)
-            {
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 22, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (!Sse.CompareNotEqualOrderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareNotEqualOrderedScalar failed positive test");
-                        testResult = Fail;
-                    }
-                }
-
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 1, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (Sse.CompareNotEqualOrderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareNotEqualOrderedScalar failed negative test");
-                        testResult = Fail;
-                    }
-                }
-            }
-
-
-            return testResult;
-        }
-
-        public unsafe struct TestTable<T> : IDisposable where T : struct
-        {
-            public T[] inArray1;
-            public T[] inArray2;
-
-            public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
-            public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer();
-
-            GCHandle inHandle1;
-            GCHandle inHandle2;
-            public TestTable(T[] a, T[] b)
-            {
-                this.inArray1 = a;
-                this.inArray2 = b;
-
-                inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
-                inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned);
-            }
-
-            public void Dispose()
-            {
-                inHandle1.Free();
-                inHandle2.Free();
-            }
-        }
-
-    }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar_r.csproj
deleted file mode 100644 (file)
index 15e11df..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize></Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareNotEqualOrderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualOrderedScalar_ro.csproj
deleted file mode 100644 (file)
index 2b200a4..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize>True</Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareNotEqualOrderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar.Single.cs
new file mode 100644 (file)
index 0000000..36b04b4
--- /dev/null
@@ -0,0 +1,196 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/******************************************************************************
+ * This file is auto-generated from a template file by the GenerateTests.csx  *
+ * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make    *
+ * changes, please update the corresponding template and run according to the *
+ * directions listed in the file.                                             *
+ ******************************************************************************/
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+    public static partial class Program
+    {
+        private static void CompareNotEqualUnorderedScalarSingle()
+        {
+            var test = new BooleanComparisonOpTest__CompareNotEqualUnorderedScalarSingle();
+
+            if (test.IsSupported)
+            {
+                // Validates basic functionality works
+                test.RunBasicScenario();
+
+                // Validates calling via reflection works
+                test.RunReflectionScenario();
+
+                // Validates passing a static member works
+                test.RunClsVarScenario();
+
+                // Validates passing a local works
+                test.RunLclVarScenario();
+
+                // Validates passing the field of a local works
+                test.RunLclFldScenario();
+
+                // Validates passing an instance member works
+                test.RunFldScenario();
+            }
+            else
+            {
+                // Validates we throw on unsupported hardware
+                test.RunUnsupportedScenario();
+            }
+
+            if (!test.Succeeded)
+            {
+                throw new Exception("One or more scenarios did not complete as expected.");
+            }
+        }
+    }
+
+    public sealed unsafe class BooleanComparisonOpTest__CompareNotEqualUnorderedScalarSingle
+    {
+        private const int VectorSize = 16;
+        private const int ElementCount = VectorSize / sizeof(Single);
+
+        private static Single[] _data1 = new Single[ElementCount];
+        private static Single[] _data2 = new Single[ElementCount];
+
+        private static Vector128<Single> _clsVar1;
+        private static Vector128<Single> _clsVar2;
+
+        private Vector128<Single> _fld1;
+        private Vector128<Single> _fld2;
+
+        private BooleanComparisonOpTest__DataTable<Single> _dataTable;
+
+        static BooleanComparisonOpTest__CompareNotEqualUnorderedScalarSingle()
+        {
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+        }
+
+        public BooleanComparisonOpTest__CompareNotEqualUnorderedScalarSingle()
+        {
+            Succeeded = true;
+
+            var random = new Random();
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), VectorSize);
+            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), VectorSize);
+
+            for (var i = 0; i < ElementCount; i++) { _data1[i] = (float)(random.NextDouble()); _data2[i] = (float)(random.NextDouble()); }
+            _dataTable = new BooleanComparisonOpTest__DataTable<Single>(_data1, _data2);
+        }
+
+        public bool IsSupported => Sse.IsSupported;
+
+        public bool Succeeded { get; set; }
+
+        public void RunBasicScenario()
+        {
+            var result = Sse.CompareNotEqualUnorderedScalar(
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+            );
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, result);
+        }
+
+        public void RunReflectionScenario()
+        {
+            var result = typeof(Sse).GetMethod(nameof(Sse.CompareNotEqualUnorderedScalar), new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) })
+                                     .Invoke(null, new object[] {
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+                                        Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr)
+                                     });
+
+            ValidateResult(_dataTable.inArray1, _dataTable.inArray2, (bool)(result));
+        }
+
+        public void RunClsVarScenario()
+        {
+            var result = Sse.CompareNotEqualUnorderedScalar(
+                _clsVar1,
+                _clsVar2
+            );
+
+            ValidateResult(_clsVar1, _clsVar2, result);
+        }
+
+        public void RunLclVarScenario()
+        {
+            var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+            var right = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr);
+            var result = Sse.CompareNotEqualUnorderedScalar(left, right);
+
+            ValidateResult(left, right, result);
+        }
+
+        public void RunLclFldScenario()
+        {
+            var test = new BooleanComparisonOpTest__CompareNotEqualUnorderedScalarSingle();
+            var result = Sse.CompareNotEqualUnorderedScalar(test._fld1, test._fld2);
+
+            ValidateResult(test._fld1, test._fld2, result);
+        }
+
+        public void RunFldScenario()
+        {
+            var result = Sse.CompareNotEqualUnorderedScalar(_fld1, _fld2);
+
+            ValidateResult(_fld1, _fld2, result);
+        }
+
+        public void RunUnsupportedScenario()
+        {
+            Succeeded = false;
+
+            try
+            {
+                RunBasicScenario();
+            }
+            catch (PlatformNotSupportedException)
+            {
+                Succeeded = true;
+            }
+        }
+
+        private void ValidateResult(Vector128<Single> left, Vector128<Single> right, bool result, [CallerMemberName] string method = "")
+        {
+            Single[] inArray1 = new Single[ElementCount];
+            Single[] inArray2 = new Single[ElementCount];
+
+            Unsafe.Write(Unsafe.AsPointer(ref inArray1[0]), left);
+            Unsafe.Write(Unsafe.AsPointer(ref inArray2[0]), right);
+
+            ValidateResult(inArray1, inArray2, result, method);
+        }
+
+        private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "")
+        {
+            if ((left[0] != right[0]) != result)
+            {
+                Succeeded = false;
+
+                Console.WriteLine($"{nameof(Sse)}.{nameof(Sse.CompareNotEqualUnorderedScalar)}<Single>: {method} failed:");
+                Console.WriteLine($"    left: ({string.Join(", ", left)})");
+                Console.WriteLine($"   right: ({string.Join(", ", right)})");
+                Console.WriteLine($"  result: ({string.Join(", ", result)})");
+                Console.WriteLine();
+            }
+        }
+    }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar.cs
deleted file mode 100644 (file)
index 5eccf19..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
-    class Program
-    {
-        const int Pass = 100;
-        const int Fail = 0;
-
-        static unsafe int Main(string[] args)
-        {
-            int testResult = Pass;
-
-            if (Sse.IsSupported)
-            {
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 22, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (!Sse.CompareNotEqualUnorderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareNotEqualUnorderedScalar failed positive test");
-                        testResult = Fail;
-                    }
-                }
-
-                using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4] { 1, -1, -50, 3 }))
-                {
-                    var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArray1Ptr);
-                    var vf2 = Unsafe.Read<Vector128<float>>(floatTable.inArray2Ptr);
-
-                    if (Sse.CompareNotEqualUnorderedScalar(vf1, vf2))
-                    {
-                        Console.WriteLine("SSE CompareNotEqualUnorderedScalar failed negative test");
-                        testResult = Fail;
-                    }
-                }
-            }
-
-
-            return testResult;
-        }
-
-        public unsafe struct TestTable<T> : IDisposable where T : struct
-        {
-            public T[] inArray1;
-            public T[] inArray2;
-
-            public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer();
-            public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer();
-
-            GCHandle inHandle1;
-            GCHandle inHandle2;
-            public TestTable(T[] a, T[] b)
-            {
-                this.inArray1 = a;
-                this.inArray2 = b;
-
-                inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned);
-                inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned);
-            }
-
-            public void Dispose()
-            {
-                inHandle1.Free();
-                inHandle2.Free();
-            }
-        }
-
-    }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar_r.csproj
deleted file mode 100644 (file)
index e6e04f9..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize></Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareNotEqualUnorderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/CompareNotEqualUnorderedScalar_ro.csproj
deleted file mode 100644 (file)
index 9c9c2e1..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
-  <PropertyGroup>
-    <DebugType>None</DebugType>
-    <Optimize>True</Optimize>
-  </PropertyGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="CompareNotEqualUnorderedScalar.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
index 6413e24..0358610 100644 (file)
@@ -18,16 +18,28 @@ namespace JIT.HardwareIntrinsics.X86
                 ["AndNot.Single"] = AndNotSingle,
                 ["CompareEqual.Single"] = CompareEqualSingle,
                 ["CompareEqualScalar.Single"] = CompareEqualScalarSingle,
+                ["CompareEqualOrderedScalar.Single"] = CompareEqualOrderedScalarSingle,
+                ["CompareEqualUnorderedScalar.Single"] = CompareEqualUnorderedScalarSingle,
                 ["CompareGreaterThan.Single"] = CompareGreaterThanSingle,
                 ["CompareGreaterThanScalar.Single"] = CompareGreaterThanScalarSingle,
+                ["CompareGreaterThanOrderedScalar.Single"] = CompareGreaterThanOrderedScalarSingle,
+                ["CompareGreaterThanUnorderedScalar.Single"] = CompareGreaterThanUnorderedScalarSingle,
                 ["CompareGreaterThanOrEqual.Single"] = CompareGreaterThanOrEqualSingle,
                 ["CompareGreaterThanOrEqualScalar.Single"] = CompareGreaterThanOrEqualScalarSingle,
+                ["CompareGreaterThanOrEqualOrderedScalar.Single"] = CompareGreaterThanOrEqualOrderedScalarSingle,
+                ["CompareGreaterThanOrEqualUnorderedScalar.Single"] = CompareGreaterThanOrEqualUnorderedScalarSingle,
                 ["CompareLessThan.Single"] = CompareLessThanSingle,
                 ["CompareLessThanScalar.Single"] = CompareLessThanScalarSingle,
+                ["CompareLessThanOrderedScalar.Single"] = CompareLessThanOrderedScalarSingle,
+                ["CompareLessThanUnorderedScalar.Single"] = CompareLessThanUnorderedScalarSingle,
                 ["CompareLessThanOrEqual.Single"] = CompareLessThanOrEqualSingle,
                 ["CompareLessThanOrEqualScalar.Single"] = CompareLessThanOrEqualScalarSingle,
+                ["CompareLessThanOrEqualOrderedScalar.Single"] = CompareLessThanOrEqualOrderedScalarSingle,
+                ["CompareLessThanOrEqualUnorderedScalar.Single"] = CompareLessThanOrEqualUnorderedScalarSingle,
                 ["CompareNotEqual.Single"] = CompareNotEqualSingle,
                 ["CompareNotEqualScalar.Single"] = CompareNotEqualScalarSingle,
+                ["CompareNotEqualOrderedScalar.Single"] = CompareNotEqualOrderedScalarSingle,
+                ["CompareNotEqualUnorderedScalar.Single"] = CompareNotEqualUnorderedScalarSingle,
                 ["CompareNotGreaterThan.Single"] = CompareNotGreaterThanSingle,
                 ["CompareNotGreaterThanScalar.Single"] = CompareNotGreaterThanScalarSingle,
                 ["CompareNotGreaterThanOrEqual.Single"] = CompareNotGreaterThanOrEqualSingle,
index e647479..ee3966d 100644 (file)
     <Compile Include="AndNot.Single.cs" />
     <Compile Include="CompareEqual.Single.cs" />
     <Compile Include="CompareEqualScalar.Single.cs" />
+    <Compile Include="CompareEqualOrderedScalar.Single.cs" />
+    <Compile Include="CompareEqualUnorderedScalar.Single.cs" />
     <Compile Include="CompareGreaterThan.Single.cs" />
     <Compile Include="CompareGreaterThanScalar.Single.cs" />
+    <Compile Include="CompareGreaterThanOrderedScalar.Single.cs" />
+    <Compile Include="CompareGreaterThanUnorderedScalar.Single.cs" />
     <Compile Include="CompareGreaterThanOrEqual.Single.cs" />
     <Compile Include="CompareGreaterThanOrEqualScalar.Single.cs" />
+    <Compile Include="CompareGreaterThanOrEqualOrderedScalar.Single.cs" />
+    <Compile Include="CompareGreaterThanOrEqualUnorderedScalar.Single.cs" />
     <Compile Include="CompareLessThan.Single.cs" />
     <Compile Include="CompareLessThanScalar.Single.cs" />
+    <Compile Include="CompareLessThanOrderedScalar.Single.cs" />
+    <Compile Include="CompareLessThanUnorderedScalar.Single.cs" />
     <Compile Include="CompareLessThanOrEqual.Single.cs" />
     <Compile Include="CompareLessThanOrEqualScalar.Single.cs" />
+    <Compile Include="CompareLessThanOrEqualOrderedScalar.Single.cs" />
+    <Compile Include="CompareLessThanOrEqualUnorderedScalar.Single.cs" />
     <Compile Include="CompareNotEqual.Single.cs" />
     <Compile Include="CompareNotEqualScalar.Single.cs" />
+    <Compile Include="CompareNotEqualOrderedScalar.Single.cs" />
+    <Compile Include="CompareNotEqualUnorderedScalar.Single.cs" />
     <Compile Include="CompareNotGreaterThan.Single.cs" />
     <Compile Include="CompareNotGreaterThanScalar.Single.cs" />
     <Compile Include="CompareNotGreaterThanOrEqual.Single.cs" />
@@ -68,6 +80,7 @@
     <Compile Include="SubtractScalar.Single.cs" />
     <Compile Include="Xor.Single.cs" />
     <Compile Include="Program.Sse.cs" />
+    <Compile Include="..\Shared\BooleanCmpOpTest_DataTable.cs" />
     <Compile Include="..\Shared\Program.cs" />
     <Compile Include="..\Shared\SimpleBinOpTest_DataTable.cs" />
   </ItemGroup>
index e7feb26..9465576 100644 (file)
     <Compile Include="AndNot.Single.cs" />
     <Compile Include="CompareEqual.Single.cs" />
     <Compile Include="CompareEqualScalar.Single.cs" />
+    <Compile Include="CompareEqualOrderedScalar.Single.cs" />
+    <Compile Include="CompareEqualUnorderedScalar.Single.cs" />
     <Compile Include="CompareGreaterThan.Single.cs" />
     <Compile Include="CompareGreaterThanScalar.Single.cs" />
+    <Compile Include="CompareGreaterThanOrderedScalar.Single.cs" />
+    <Compile Include="CompareGreaterThanUnorderedScalar.Single.cs" />
     <Compile Include="CompareGreaterThanOrEqual.Single.cs" />
     <Compile Include="CompareGreaterThanOrEqualScalar.Single.cs" />
+    <Compile Include="CompareGreaterThanOrEqualOrderedScalar.Single.cs" />
+    <Compile Include="CompareGreaterThanOrEqualUnorderedScalar.Single.cs" />
     <Compile Include="CompareLessThan.Single.cs" />
     <Compile Include="CompareLessThanScalar.Single.cs" />
+    <Compile Include="CompareLessThanOrderedScalar.Single.cs" />
+    <Compile Include="CompareLessThanUnorderedScalar.Single.cs" />
     <Compile Include="CompareLessThanOrEqual.Single.cs" />
     <Compile Include="CompareLessThanOrEqualScalar.Single.cs" />
+    <Compile Include="CompareLessThanOrEqualOrderedScalar.Single.cs" />
+    <Compile Include="CompareLessThanOrEqualUnorderedScalar.Single.cs" />
     <Compile Include="CompareNotEqual.Single.cs" />
     <Compile Include="CompareNotEqualScalar.Single.cs" />
+    <Compile Include="CompareNotEqualOrderedScalar.Single.cs" />
+    <Compile Include="CompareNotEqualUnorderedScalar.Single.cs" />
     <Compile Include="CompareNotGreaterThan.Single.cs" />
     <Compile Include="CompareNotGreaterThanScalar.Single.cs" />
     <Compile Include="CompareNotGreaterThanOrEqual.Single.cs" />
@@ -68,6 +80,7 @@
     <Compile Include="SubtractScalar.Single.cs" />
     <Compile Include="Xor.Single.cs" />
     <Compile Include="Program.Sse.cs" />
+    <Compile Include="..\Shared\BooleanCmpOpTest_DataTable.cs" />
     <Compile Include="..\Shared\Program.cs" />
     <Compile Include="..\Shared\SimpleBinOpTest_DataTable.cs" />
   </ItemGroup>