From 691c7a0b0f1941a6186f4dbc1a04ccbc98d74c33 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Sat, 3 Feb 2018 10:06:54 -0800 Subject: [PATCH] Adding tests for the SSE2 LoadVector128, LoadAlignedVector128, and LoadScalarVector128 intrinsics. --- .../X86/Sse2/LoadAlignedVector128.cs | 237 +++++++++++++++++++++ .../X86/Sse2/LoadAlignedVector128_r.csproj | 34 +++ .../X86/Sse2/LoadAlignedVector128_ro.csproj | 34 +++ .../X86/Sse2/LoadScalarVector128.cs | 153 +++++++++++++ .../X86/Sse2/LoadScalarVector128_r.csproj | 34 +++ .../X86/Sse2/LoadScalarVector128_ro.csproj | 34 +++ .../HardwareIntrinsics/X86/Sse2/LoadVector128.cs | 219 +++++++++++++++++++ .../X86/Sse2/LoadVector128_r.csproj | 34 +++ .../X86/Sse2/LoadVector128_ro.csproj | 34 +++ 9 files changed, 813 insertions(+) create mode 100644 tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadAlignedVector128.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadAlignedVector128_r.csproj create mode 100644 tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadAlignedVector128_ro.csproj create mode 100644 tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadScalarVector128.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadScalarVector128_r.csproj create mode 100644 tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadScalarVector128_ro.csproj create mode 100644 tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadVector128.cs create mode 100644 tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadVector128_r.csproj create mode 100644 tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadVector128_ro.csproj diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadAlignedVector128.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadAlignedVector128.cs new file mode 100644 index 0000000..252bd06 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadAlignedVector128.cs @@ -0,0 +1,237 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics.X86; +using System.Runtime.Intrinsics; + +namespace IntelHardwareIntrinsicTest +{ + class Program + { + const int Pass = 100; + const int Fail = 0; + + static unsafe int Main(string[] args) + { + int testResult = Pass; + + if (Sse2.IsSupported) + { + using (TestTable doubleTable = new TestTable(new double[2] { 1, -5 }, new double[2])) + { + var vf = Sse2.LoadAlignedVector128((double*)(doubleTable.inArrayPtr)); + Unsafe.Write(doubleTable.outArrayPtr, vf); + + if (!doubleTable.CheckResult((x, y) => BitConverter.DoubleToInt64Bits(x) == BitConverter.DoubleToInt64Bits(y))) + { + Console.WriteLine("Sse2 LoadAlignedVector128 failed on double:"); + foreach (var item in doubleTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable intTable = new TestTable(new int[4] { 1, -5, 100, 0 }, new int[4])) + { + var vf = Sse2.LoadAlignedVector128((int*)(intTable.inArrayPtr)); + Unsafe.Write(intTable.outArrayPtr, vf); + + if (!intTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadAlignedVector128 failed on int:"); + foreach (var item in intTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable longTable = new TestTable(new long[2] { 1, -5 }, new long[2])) + { + var vf = Sse2.LoadAlignedVector128((long*)(longTable.inArrayPtr)); + Unsafe.Write(longTable.outArrayPtr, vf); + + if (!longTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadAlignedVector128 failed on long:"); + foreach (var item in longTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable uintTable = new TestTable(new uint[4] { 1, 5, 100, 0 }, new uint[4])) + { + var vf = Sse2.LoadAlignedVector128((uint*)(uintTable.inArrayPtr)); + Unsafe.Write(uintTable.outArrayPtr, vf); + + if (!uintTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadAlignedVector128 failed on uint:"); + foreach (var item in uintTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable ulongTable = new TestTable(new ulong[2] { 1, 5 }, new ulong[2])) + { + var vf = Sse2.LoadAlignedVector128((ulong*)(ulongTable.inArrayPtr)); + Unsafe.Write(ulongTable.outArrayPtr, vf); + + if (!ulongTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadAlignedVector128 failed on ulong:"); + foreach (var item in ulongTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable shortTable = new TestTable(new short[8] { 1, -5, 100, 0, 1, -5, 100, 0 }, new short[8])) + { + var vf = Sse2.LoadAlignedVector128((short*)(shortTable.inArrayPtr)); + Unsafe.Write(shortTable.outArrayPtr, vf); + + if (!shortTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadAlignedVector128 failed on short:"); + foreach (var item in shortTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable ushortTable = new TestTable(new ushort[8] { 1, 5, 100, 0, 1, 5, 100, 0 }, new ushort[8])) + { + var vf = Sse2.LoadAlignedVector128((ushort*)(ushortTable.inArrayPtr)); + Unsafe.Write(ushortTable.outArrayPtr, vf); + + if (!ushortTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadAlignedVector128 failed on ushort:"); + foreach (var item in ushortTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable sbyteTable = new TestTable(new sbyte[16] { 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0 }, new sbyte[16])) + { + var vf = Sse2.LoadAlignedVector128((sbyte*)(sbyteTable.inArrayPtr)); + Unsafe.Write(sbyteTable.outArrayPtr, vf); + + if (!sbyteTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadAlignedVector128 failed on sbyte:"); + foreach (var item in sbyteTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable byteTable = new TestTable(new byte[16] { 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0 }, new byte[16])) + { + var vf = Sse2.LoadAlignedVector128((byte*)(byteTable.inArrayPtr)); + Unsafe.Write(byteTable.outArrayPtr, vf); + + if (!byteTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadAlignedVector128 failed on byte:"); + foreach (var item in byteTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + } + + return testResult; + } + + public unsafe struct TestTable : IDisposable where T : struct + { + private byte[] inArray; + public T[] outArray; + + private GCHandle inHandle; + private GCHandle outHandle; + + private byte simdSize; + + public TestTable(T[] a, T[] b) + { + this.inArray = new byte[32]; + this.outArray = b; + + this.inHandle = GCHandle.Alloc(this.inArray, GCHandleType.Pinned); + this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); + + this.simdSize = 16; + + Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef(inArrayPtr), ref Unsafe.As(ref a[0]), this.simdSize); + } + + public void* inArrayPtr => Align((byte*)(inHandle.AddrOfPinnedObject().ToPointer()), simdSize); + public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer(); + + public bool CheckResult(Func check) + { + for (int i = 0; i < outArray.Length; i++) + { + if (!check(Unsafe.Add(ref Unsafe.AsRef(inArrayPtr), i), outArray[i])) + { + return false; + } + } + return true; + } + + public void Dispose() + { + inHandle.Free(); + outHandle.Free(); + } + + private static unsafe void* Align(byte* buffer, byte expectedAlignment) + { + // Compute how bad the misalignment is, which is at most (expectedAlignment - 1). + // Then subtract that from the expectedAlignment and add it to the original address + // to compute the aligned address. + + var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment); + return (void*)(buffer + misalignment); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadAlignedVector128_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadAlignedVector128_r.csproj new file mode 100644 index 0000000..6bc1c76 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadAlignedVector128_r.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + true + + + + + + + False + + + + None + + + + + + + + + + + diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadAlignedVector128_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadAlignedVector128_ro.csproj new file mode 100644 index 0000000..ecd4938 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadAlignedVector128_ro.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + true + + + + + + + False + + + + None + True + + + + + + + + + + diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadScalarVector128.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadScalarVector128.cs new file mode 100644 index 0000000..6ea970f --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadScalarVector128.cs @@ -0,0 +1,153 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics.X86; +using System.Runtime.Intrinsics; + +namespace IntelHardwareIntrinsicTest +{ + class Program + { + const int Pass = 100; + const int Fail = 0; + + static unsafe int Main(string[] args) + { + int testResult = Pass; + + if (Sse2.IsSupported) + { + using (TestTable doubleTable = new TestTable(new double[2] { 1, -5 }, new double[2])) + { + var vf = Sse2.LoadScalarVector128((double*)(doubleTable.inArrayPtr)); + Unsafe.Write(doubleTable.outArrayPtr, vf); + + if (!doubleTable.CheckResult((x, y) => BitConverter.DoubleToInt64Bits(x[0]) == BitConverter.DoubleToInt64Bits(y[0]) + && BitConverter.DoubleToInt64Bits(y[1]) == 0)) + { + Console.WriteLine("Sse2 LoadScalarVector128 failed on double:"); + foreach (var item in doubleTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable intTable = new TestTable(new int[4] { 1, -5, 100, 0 }, new int[4])) + { + var vf = Sse2.LoadScalarVector128((int*)(intTable.inArrayPtr)); + Unsafe.Write(intTable.outArrayPtr, vf); + + if (!intTable.CheckResult((x, y) => x[0] == y[0] + && y[1] == 0 + && y[2] == 0 + && y[3] == 0)) + { + Console.WriteLine("Sse2 LoadScalarVector128 failed on int:"); + foreach (var item in intTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable longTable = new TestTable(new long[2] { 1, -5 }, new long[2])) + { + var vf = Sse2.LoadScalarVector128((long*)(longTable.inArrayPtr)); + Unsafe.Write(longTable.outArrayPtr, vf); + + if (!longTable.CheckResult((x, y) => x[0] == y[0] + && y[1] == 0)) + { + Console.WriteLine("Sse2 LoadScalarVector128 failed on long:"); + foreach (var item in longTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable uintTable = new TestTable(new uint[4] { 1, 5, 100, 0 }, new uint[4])) + { + var vf = Sse2.LoadScalarVector128((uint*)(uintTable.inArrayPtr)); + Unsafe.Write(uintTable.outArrayPtr, vf); + + if (!uintTable.CheckResult((x, y) => x[0] == y[0] + && y[1] == 0 + && y[2] == 0 + && y[3] == 0)) + { + Console.WriteLine("Sse2 LoadScalarVector128 failed on uint:"); + foreach (var item in uintTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable ulongTable = new TestTable(new ulong[2] { 1, 5 }, new ulong[2])) + { + var vf = Sse2.LoadScalarVector128((ulong*)(ulongTable.inArrayPtr)); + Unsafe.Write(ulongTable.outArrayPtr, vf); + + if (!ulongTable.CheckResult((x, y) => x[0] == y[0] + && y[1] == 0)) + { + Console.WriteLine("Sse2 LoadScalarVector128 failed on ulong:"); + foreach (var item in ulongTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + } + + return testResult; + } + + public unsafe struct TestTable : IDisposable where T : struct + { + public T[] inArray; + public T[] outArray; + + public void* inArrayPtr => inHandle.AddrOfPinnedObject().ToPointer(); + public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer(); + + GCHandle inHandle; + GCHandle outHandle; + public TestTable(T[] a, T[] b) + { + this.inArray = a; + this.outArray = b; + + inHandle = GCHandle.Alloc(inArray, GCHandleType.Pinned); + outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned); + } + public bool CheckResult(Func check) + { + return check(inArray, outArray); + } + + public void Dispose() + { + inHandle.Free(); + outHandle.Free(); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadScalarVector128_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadScalarVector128_r.csproj new file mode 100644 index 0000000..33960ea --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadScalarVector128_r.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + true + + + + + + + False + + + + None + + + + + + + + + + + diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadScalarVector128_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadScalarVector128_ro.csproj new file mode 100644 index 0000000..627e154 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadScalarVector128_ro.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + true + + + + + + + False + + + + None + True + + + + + + + + + + diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadVector128.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadVector128.cs new file mode 100644 index 0000000..283acea --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadVector128.cs @@ -0,0 +1,219 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics.X86; +using System.Runtime.Intrinsics; + +namespace IntelHardwareIntrinsicTest +{ + class Program + { + const int Pass = 100; + const int Fail = 0; + + static unsafe int Main(string[] args) + { + int testResult = Pass; + + if (Sse2.IsSupported) + { + using (TestTable doubleTable = new TestTable(new double[2] { 1, -5 }, new double[2])) + { + var vf = Sse2.LoadVector128((double*)(doubleTable.inArrayPtr)); + Unsafe.Write(doubleTable.outArrayPtr, vf); + + if (!doubleTable.CheckResult((x, y) => BitConverter.DoubleToInt64Bits(x) == BitConverter.DoubleToInt64Bits(y))) + { + Console.WriteLine("Sse2 LoadVector128 failed on double:"); + foreach (var item in doubleTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable intTable = new TestTable(new int[4] { 1, -5, 100, 0 }, new int[4])) + { + var vf = Sse2.LoadVector128((int*)(intTable.inArrayPtr)); + Unsafe.Write(intTable.outArrayPtr, vf); + + if (!intTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadVector128 failed on int:"); + foreach (var item in intTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable longTable = new TestTable(new long[2] { 1, -5 }, new long[2])) + { + var vf = Sse2.LoadVector128((long*)(longTable.inArrayPtr)); + Unsafe.Write(longTable.outArrayPtr, vf); + + if (!longTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadVector128 failed on long:"); + foreach (var item in longTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable uintTable = new TestTable(new uint[4] { 1, 5, 100, 0 }, new uint[4])) + { + var vf = Sse2.LoadVector128((uint*)(uintTable.inArrayPtr)); + Unsafe.Write(uintTable.outArrayPtr, vf); + + if (!uintTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadVector128 failed on uint:"); + foreach (var item in uintTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable ulongTable = new TestTable(new ulong[2] { 1, 5 }, new ulong[2])) + { + var vf = Sse2.LoadVector128((ulong*)(ulongTable.inArrayPtr)); + Unsafe.Write(ulongTable.outArrayPtr, vf); + + if (!ulongTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadVector128 failed on ulong:"); + foreach (var item in ulongTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable shortTable = new TestTable(new short[8] { 1, -5, 100, 0, 1, -5, 100, 0 }, new short[8])) + { + var vf = Sse2.LoadVector128((short*)(shortTable.inArrayPtr)); + Unsafe.Write(shortTable.outArrayPtr, vf); + + if (!shortTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadVector128 failed on short:"); + foreach (var item in shortTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable ushortTable = new TestTable(new ushort[8] { 1, 5, 100, 0, 1, 5, 100, 0 }, new ushort[8])) + { + var vf = Sse2.LoadVector128((ushort*)(ushortTable.inArrayPtr)); + Unsafe.Write(ushortTable.outArrayPtr, vf); + + if (!ushortTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadVector128 failed on ushort:"); + foreach (var item in ushortTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable sbyteTable = new TestTable(new sbyte[16] { 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0 }, new sbyte[16])) + { + var vf = Sse2.LoadVector128((sbyte*)(sbyteTable.inArrayPtr)); + Unsafe.Write(sbyteTable.outArrayPtr, vf); + + if (!sbyteTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadVector128 failed on sbyte:"); + foreach (var item in sbyteTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + + using (TestTable byteTable = new TestTable(new byte[16] { 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0 }, new byte[16])) + { + var vf = Sse2.LoadVector128((byte*)(byteTable.inArrayPtr)); + Unsafe.Write(byteTable.outArrayPtr, vf); + + if (!byteTable.CheckResult((x, y) => x == y)) + { + Console.WriteLine("Sse2 LoadVector128 failed on byte:"); + foreach (var item in byteTable.outArray) + { + Console.Write(item + ", "); + } + Console.WriteLine(); + testResult = Fail; + } + } + } + + return testResult; + } + + public unsafe struct TestTable : IDisposable where T : struct + { + public T[] inArray; + public T[] outArray; + + public void* inArrayPtr => inHandle.AddrOfPinnedObject().ToPointer(); + public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer(); + + GCHandle inHandle; + GCHandle outHandle; + public TestTable(T[] a, T[] b) + { + this.inArray = a; + this.outArray = b; + + inHandle = GCHandle.Alloc(inArray, GCHandleType.Pinned); + outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned); + } + public bool CheckResult(Func check) + { + for (int i = 0; i < inArray.Length; i++) + { + if (!check(inArray[i], outArray[i])) + { + return false; + } + } + return true; + } + + public void Dispose() + { + inHandle.Free(); + outHandle.Free(); + } + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadVector128_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadVector128_r.csproj new file mode 100644 index 0000000..110bee0 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadVector128_r.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + true + + + + + + + False + + + + None + + + + + + + + + + + diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadVector128_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadVector128_ro.csproj new file mode 100644 index 0000000..072534c --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/LoadVector128_ro.csproj @@ -0,0 +1,34 @@ + + + + + Debug + AnyCPU + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + true + + + + + + + False + + + + None + True + + + + + + + + + + -- 2.7.4