--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the 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();
+ }}
+ }}
+ }}
+}}
--- /dev/null
+// Licensed to the .NET Foundation under one or more 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();
+ }
+ }
+}
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 []
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the 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();
+ }
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more 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();
- }
- }
-
- }
-}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the 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();
+ }
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more 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();
- }
- }
-
- }
-}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the 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();
+ }
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more 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();
- }
- }
-
- }
-}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the 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();
+ }
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more 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();
- }
- }
-
- }
-}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the 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();
+ }
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more 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();
- }
- }
-
- }
-}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the 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();
+ }
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more 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();
- }
- }
-
- }
-}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the 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();
+ }
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more 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();
- }
- }
-
- }
-}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the 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();
+ }
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more 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();
- }
- }
-
- }
-}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the 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();
+ }
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more 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();
- }
- }
-
- }
-}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the 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();
+ }
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more 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();
- }
- }
-
- }
-}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the 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();
+ }
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more 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();
- }
- }
-
- }
-}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the 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();
+ }
+ }
+ }
+}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more 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();
- }
- }
-
- }
-}
+++ /dev/null
-<?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>
+++ /dev/null
-<?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>
["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,
<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" />
<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>
<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" />
<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>