summaryrefslogtreecommitdiff
path: root/tests/src/JIT/HardwareIntrinsics
diff options
context:
space:
mode:
authorFei Peng <fei.peng@intel.com>2018-11-28 16:25:48 -0800
committerFei Peng <fei.peng@intel.com>2018-11-30 18:46:22 -0800
commit3bc3c61522c3a6c5663d5b4f9f535c4b3bc22a78 (patch)
tree39c20d2bca52fe7e8f84edca6c7b404f9177aa48 /tests/src/JIT/HardwareIntrinsics
parent4742ebfbae24b37d0690d494756a60b53b022fb6 (diff)
downloadcoreclr-3bc3c61522c3a6c5663d5b4f9f535c4b3bc22a78.tar.gz
coreclr-3bc3c61522c3a6c5663d5b4f9f535c4b3bc22a78.tar.bz2
coreclr-3bc3c61522c3a6c5663d5b4f9f535c4b3bc22a78.zip
Migrate 64-bit-only intrinsic tests to new APIs
Diffstat (limited to 'tests/src/JIT/HardwareIntrinsics')
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/AndNot.UInt64.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Bmi1/AndNot.UInt64.cs)20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/Bmi1.X64_r.csproj40
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/Bmi1.X64_ro.csproj40
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/ExtractLowestSetBit.UInt64.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Bmi1/ExtractLowestSetBit.UInt64.cs)20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/GetMaskUpToLowestSetBit.UInt64.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Bmi1/GetMaskUpToLowestSetBit.UInt64.cs)20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/Program.Bmi1.X64.cs23
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/ResetLowestSetBit.UInt64.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Bmi1/ResetLowestSetBit.UInt64.cs)20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/TrailingZeroCount.UInt64.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Bmi1/TrailingZeroCount.UInt64.cs)20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Bmi1_r.csproj5
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Bmi1_ro.csproj5
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Program.Bmi1.cs5
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/Bmi2.X64_r.csproj37
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/Bmi2.X64_ro.csproj37
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/ParallelBitDeposit.UInt64.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Bmi2/ParallelBitDeposit.UInt64.cs)20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/ParallelBitExtract.UInt64.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Bmi2/ParallelBitExtract.UInt64.cs)20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/Program.Bmi2.X64.cs20
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Bmi2_r.csproj2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Bmi2_ro.csproj2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Program.Bmi2.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Lzcnt.X64/Lzcnt.X64.cs92
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Lzcnt.X64/Lzcnt.X64_r.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64WithTruncation_r.csproj)3
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Lzcnt.X64/Lzcnt.X64_ro.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64WithTruncation_ro.csproj)3
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Lzcnt/Lzcnt.cs62
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Popcnt.X64/Popcnt.X64.cs96
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Popcnt.X64/Popcnt.X64_r.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertScalarToVector128Single_r.csproj)3
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Popcnt.X64/Popcnt.X64_ro.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertScalarToVector128Single_ro.csproj)3
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Popcnt/Popcnt.cs61
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx69
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/SimdScalarUnOpConvTest.template2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpConvTest.template395
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpConvTest_DataTable.cs63
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpConvTest.template2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/ConvertScalarToVector128Single.Single.cs395
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/ConvertToInt64.Vector128Single.cs350
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/ConvertToInt64WithTruncation.Vector128Single.cs350
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/Program.Sse.X64.cs21
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/Sse.X64_r.csproj40
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/Sse.X64_ro.csproj40
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertScalarToVector128Single.Single.cs395
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64.cs73
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64WithTruncation.cs73
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/Program.Sse.cs1
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/Sse_r.csproj2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/Sse_ro.csproj2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128Double.Double.cs395
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128Int64.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertScalarToVector128Single.cs)34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128Int64_r.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Int64_r.csproj)0
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128Int64_ro.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Int64_ro.csproj)0
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128UInt64.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128UInt64.cs)57
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128UInt64_r.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128UInt64_r.csproj)0
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128UInt64_ro.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128UInt64_ro.csproj)0
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertToInt64.Vector128Double.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64.Vector128Double.cs)32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertToInt64.Vector128Int64.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64.Vector128Int64.cs)32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertToInt64WithTruncation.Vector128Double.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64WithTruncation.Int64.cs)67
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertToUInt64.Vector128UInt64.cs350
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/Program.Sse2.X64.cs23
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/Sse2.X64_r.csproj42
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/Sse2.X64_ro.csproj42
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/StoreNonTemporal.cs120
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/StoreNonTemporal_r.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64_r.csproj)4
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/StoreNonTemporal_ro.csproj (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64_ro.csproj)4
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Double.Double.cs395
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Double.cs35
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Int64.cs98
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32.Vector128Double.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32.Vector128Int32.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32WithTruncation.Vector128Double.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64WithTruncation.Vector128Double.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToUInt32.Vector128UInt32.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToUInt64.Vector128UInt64.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Double.Vector128Int32.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Double.Vector128Single.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32.Vector128Double.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32.Vector128Single.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32WithTruncation.Vector128Double.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32WithTruncation.Vector128Single.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Single.Vector128Double.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Single.Vector128Int32.cs2
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Program.Sse2.cs5
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_r.csproj6
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_ro.csproj6
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal.cs93
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Extract.Int64.1.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.1.cs)32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Extract.Int64.129.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.129.cs)32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Extract.UInt64.1.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.1.cs)32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Extract.UInt64.129.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.129.cs)32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Insert.Int64.1.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.1.cs)32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Insert.Int64.129.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.129.cs)32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Insert.UInt64.1.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.1.cs)32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Insert.UInt64.129.cs (renamed from tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.129.cs)32
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Program.Sse41.X64.cs26
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Sse41.X64_r.csproj46
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Sse41.X64_ro.csproj46
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Program.Sse41.cs8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Sse41_r.csproj8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse41/Sse41_ro.csproj8
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32.cs106
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32_r.csproj33
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32_ro.csproj33
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse42/Crc32.cs68
100 files changed, 4495 insertions, 965 deletions
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/AndNot.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/AndNot.UInt64.cs
index fe895d2753..6563b59aa1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/AndNot.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/AndNot.UInt64.cs
@@ -81,7 +81,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(ScalarBinaryOpTest__AndNotUInt64 testClass)
{
- var result = Bmi1.AndNot(_fld1, _fld2);
+ var result = Bmi1.X64.AndNot(_fld1, _fld2);
testClass.ValidateResult(_fld1, _fld2, result);
}
}
@@ -112,7 +112,7 @@ namespace JIT.HardwareIntrinsics.X86
_data2 = TestLibrary.Generator.GetUInt64();
}
- public bool IsSupported => Bmi1.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
+ public bool IsSupported => Bmi1.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -120,7 +120,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Bmi1.AndNot(
+ var result = Bmi1.X64.AndNot(
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data1)),
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data2))
);
@@ -132,7 +132,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Bmi1).GetMethod(nameof(Bmi1.AndNot), new Type[] { typeof(UInt64), typeof(UInt64) })
+ var result = typeof(Bmi1.X64).GetMethod(nameof(Bmi1.X64.AndNot), new Type[] { typeof(UInt64), typeof(UInt64) })
.Invoke(null, new object[] {
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data1)),
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data2))
@@ -145,7 +145,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Bmi1.AndNot(
+ var result = Bmi1.X64.AndNot(
_clsVar1,
_clsVar2
);
@@ -159,7 +159,7 @@ namespace JIT.HardwareIntrinsics.X86
var data1 = Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data1));
var data2 = Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data2));
- var result = Bmi1.AndNot(data1, data2);
+ var result = Bmi1.X64.AndNot(data1, data2);
ValidateResult(data1, data2, result);
}
@@ -169,7 +169,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ScalarBinaryOpTest__AndNotUInt64();
- var result = Bmi1.AndNot(test._fld1, test._fld2);
+ var result = Bmi1.X64.AndNot(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
@@ -178,7 +178,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Bmi1.AndNot(_fld1, _fld2);
+ var result = Bmi1.X64.AndNot(_fld1, _fld2);
ValidateResult(_fld1, _fld2, result);
}
@@ -187,7 +187,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Bmi1.AndNot(test._fld1, test._fld2);
+ var result = Bmi1.X64.AndNot(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
@@ -229,7 +229,7 @@ namespace JIT.HardwareIntrinsics.X86
if (isUnexpectedResult)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Bmi1)}.{nameof(Bmi1.AndNot)}<UInt64>(UInt64, UInt64): AndNot failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Bmi1.X64)}.{nameof(Bmi1.X64.AndNot)}<UInt64>(UInt64, UInt64): AndNot failed:");
TestLibrary.TestFramework.LogInformation($" left: {left}");
TestLibrary.TestFramework.LogInformation($" right: {right}");
TestLibrary.TestFramework.LogInformation($" result: {result}");
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/Bmi1.X64_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/Bmi1.X64_r.csproj
new file mode 100644
index 0000000000..9e70b4ed56
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/Bmi1.X64_r.csproj
@@ -0,0 +1,40 @@
+<?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>Embedded</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AndNot.UInt64.cs" />
+ <Compile Include="ExtractLowestSetBit.UInt64.cs" />
+ <Compile Include="GetMaskUpToLowestSetBit.UInt64.cs" />
+ <Compile Include="ResetLowestSetBit.UInt64.cs" />
+ <Compile Include="TrailingZeroCount.UInt64.cs" />
+ <Compile Include="Program.Bmi1.X64.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/Bmi1.X64_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/Bmi1.X64_ro.csproj
new file mode 100644
index 0000000000..464299846a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/Bmi1.X64_ro.csproj
@@ -0,0 +1,40 @@
+<?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>Embedded</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AndNot.UInt64.cs" />
+ <Compile Include="ExtractLowestSetBit.UInt64.cs" />
+ <Compile Include="GetMaskUpToLowestSetBit.UInt64.cs" />
+ <Compile Include="ResetLowestSetBit.UInt64.cs" />
+ <Compile Include="TrailingZeroCount.UInt64.cs" />
+ <Compile Include="Program.Bmi1.X64.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/ExtractLowestSetBit.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/ExtractLowestSetBit.UInt64.cs
index 47b4c25005..31769897bd 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/ExtractLowestSetBit.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/ExtractLowestSetBit.UInt64.cs
@@ -78,7 +78,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(ScalarUnaryOpTest__ExtractLowestSetBitUInt64 testClass)
{
- var result = Bmi1.ExtractLowestSetBit(_fld);
+ var result = Bmi1.X64.ExtractLowestSetBit(_fld);
testClass.ValidateResult(_fld, result);
}
}
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
_data = TestLibrary.Generator.GetUInt64();
}
- public bool IsSupported => Bmi1.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
+ public bool IsSupported => Bmi1.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -111,7 +111,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Bmi1.ExtractLowestSetBit(
+ var result = Bmi1.X64.ExtractLowestSetBit(
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data))
);
@@ -122,7 +122,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Bmi1).GetMethod(nameof(Bmi1.ExtractLowestSetBit), new Type[] { typeof(UInt64) })
+ var result = typeof(Bmi1.X64).GetMethod(nameof(Bmi1.X64.ExtractLowestSetBit), new Type[] { typeof(UInt64) })
.Invoke(null, new object[] {
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data))
});
@@ -134,7 +134,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Bmi1.ExtractLowestSetBit(
+ var result = Bmi1.X64.ExtractLowestSetBit(
_clsVar
);
@@ -146,7 +146,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var data = Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data));
- var result = Bmi1.ExtractLowestSetBit(data);
+ var result = Bmi1.X64.ExtractLowestSetBit(data);
ValidateResult(data, result);
}
@@ -156,7 +156,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ScalarUnaryOpTest__ExtractLowestSetBitUInt64();
- var result = Bmi1.ExtractLowestSetBit(test._fld);
+ var result = Bmi1.X64.ExtractLowestSetBit(test._fld);
ValidateResult(test._fld, result);
}
@@ -165,7 +165,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Bmi1.ExtractLowestSetBit(_fld);
+ var result = Bmi1.X64.ExtractLowestSetBit(_fld);
ValidateResult(_fld, result);
}
@@ -174,7 +174,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Bmi1.ExtractLowestSetBit(test._fld);
+ var result = Bmi1.X64.ExtractLowestSetBit(test._fld);
ValidateResult(test._fld, result);
}
@@ -216,7 +216,7 @@ namespace JIT.HardwareIntrinsics.X86
if (isUnexpectedResult)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Bmi1)}.{nameof(Bmi1.ExtractLowestSetBit)}<UInt64>(UInt64): ExtractLowestSetBit failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Bmi1.X64)}.{nameof(Bmi1.X64.ExtractLowestSetBit)}<UInt64>(UInt64): ExtractLowestSetBit failed:");
TestLibrary.TestFramework.LogInformation($" data: {data}");
TestLibrary.TestFramework.LogInformation($" result: {result}");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/GetMaskUpToLowestSetBit.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/GetMaskUpToLowestSetBit.UInt64.cs
index 6954c61e2c..69ba19d7e6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/GetMaskUpToLowestSetBit.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/GetMaskUpToLowestSetBit.UInt64.cs
@@ -78,7 +78,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(ScalarUnaryOpTest__GetMaskUpToLowestSetBitUInt64 testClass)
{
- var result = Bmi1.GetMaskUpToLowestSetBit(_fld);
+ var result = Bmi1.X64.GetMaskUpToLowestSetBit(_fld);
testClass.ValidateResult(_fld, result);
}
}
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
_data = TestLibrary.Generator.GetUInt64();
}
- public bool IsSupported => Bmi1.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
+ public bool IsSupported => Bmi1.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -111,7 +111,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Bmi1.GetMaskUpToLowestSetBit(
+ var result = Bmi1.X64.GetMaskUpToLowestSetBit(
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data))
);
@@ -122,7 +122,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Bmi1).GetMethod(nameof(Bmi1.GetMaskUpToLowestSetBit), new Type[] { typeof(UInt64) })
+ var result = typeof(Bmi1.X64).GetMethod(nameof(Bmi1.X64.GetMaskUpToLowestSetBit), new Type[] { typeof(UInt64) })
.Invoke(null, new object[] {
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data))
});
@@ -134,7 +134,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Bmi1.GetMaskUpToLowestSetBit(
+ var result = Bmi1.X64.GetMaskUpToLowestSetBit(
_clsVar
);
@@ -146,7 +146,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var data = Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data));
- var result = Bmi1.GetMaskUpToLowestSetBit(data);
+ var result = Bmi1.X64.GetMaskUpToLowestSetBit(data);
ValidateResult(data, result);
}
@@ -156,7 +156,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ScalarUnaryOpTest__GetMaskUpToLowestSetBitUInt64();
- var result = Bmi1.GetMaskUpToLowestSetBit(test._fld);
+ var result = Bmi1.X64.GetMaskUpToLowestSetBit(test._fld);
ValidateResult(test._fld, result);
}
@@ -165,7 +165,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Bmi1.GetMaskUpToLowestSetBit(_fld);
+ var result = Bmi1.X64.GetMaskUpToLowestSetBit(_fld);
ValidateResult(_fld, result);
}
@@ -174,7 +174,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Bmi1.GetMaskUpToLowestSetBit(test._fld);
+ var result = Bmi1.X64.GetMaskUpToLowestSetBit(test._fld);
ValidateResult(test._fld, result);
}
@@ -216,7 +216,7 @@ namespace JIT.HardwareIntrinsics.X86
if (isUnexpectedResult)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Bmi1)}.{nameof(Bmi1.GetMaskUpToLowestSetBit)}<UInt64>(UInt64): GetMaskUpToLowestSetBit failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Bmi1.X64)}.{nameof(Bmi1.X64.GetMaskUpToLowestSetBit)}<UInt64>(UInt64): GetMaskUpToLowestSetBit failed:");
TestLibrary.TestFramework.LogInformation($" data: {data}");
TestLibrary.TestFramework.LogInformation($" result: {result}");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/Program.Bmi1.X64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/Program.Bmi1.X64.cs
new file mode 100644
index 0000000000..ce22b997ec
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/Program.Bmi1.X64.cs
@@ -0,0 +1,23 @@
+// 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.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["AndNot.UInt64"] = AndNotUInt64,
+ ["ExtractLowestSetBit.UInt64"] = ExtractLowestSetBitUInt64,
+ ["GetMaskUpToLowestSetBit.UInt64"] = GetMaskUpToLowestSetBitUInt64,
+ ["ResetLowestSetBit.UInt64"] = ResetLowestSetBitUInt64,
+ ["TrailingZeroCount.UInt64"] = TrailingZeroCountUInt64,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/ResetLowestSetBit.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/ResetLowestSetBit.UInt64.cs
index 45ed67dac6..e9e9c84916 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/ResetLowestSetBit.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/ResetLowestSetBit.UInt64.cs
@@ -78,7 +78,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(ScalarUnaryOpTest__ResetLowestSetBitUInt64 testClass)
{
- var result = Bmi1.ResetLowestSetBit(_fld);
+ var result = Bmi1.X64.ResetLowestSetBit(_fld);
testClass.ValidateResult(_fld, result);
}
}
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
_data = TestLibrary.Generator.GetUInt64();
}
- public bool IsSupported => Bmi1.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
+ public bool IsSupported => Bmi1.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -111,7 +111,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Bmi1.ResetLowestSetBit(
+ var result = Bmi1.X64.ResetLowestSetBit(
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data))
);
@@ -122,7 +122,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Bmi1).GetMethod(nameof(Bmi1.ResetLowestSetBit), new Type[] { typeof(UInt64) })
+ var result = typeof(Bmi1.X64).GetMethod(nameof(Bmi1.X64.ResetLowestSetBit), new Type[] { typeof(UInt64) })
.Invoke(null, new object[] {
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data))
});
@@ -134,7 +134,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Bmi1.ResetLowestSetBit(
+ var result = Bmi1.X64.ResetLowestSetBit(
_clsVar
);
@@ -146,7 +146,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var data = Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data));
- var result = Bmi1.ResetLowestSetBit(data);
+ var result = Bmi1.X64.ResetLowestSetBit(data);
ValidateResult(data, result);
}
@@ -156,7 +156,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ScalarUnaryOpTest__ResetLowestSetBitUInt64();
- var result = Bmi1.ResetLowestSetBit(test._fld);
+ var result = Bmi1.X64.ResetLowestSetBit(test._fld);
ValidateResult(test._fld, result);
}
@@ -165,7 +165,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Bmi1.ResetLowestSetBit(_fld);
+ var result = Bmi1.X64.ResetLowestSetBit(_fld);
ValidateResult(_fld, result);
}
@@ -174,7 +174,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Bmi1.ResetLowestSetBit(test._fld);
+ var result = Bmi1.X64.ResetLowestSetBit(test._fld);
ValidateResult(test._fld, result);
}
@@ -216,7 +216,7 @@ namespace JIT.HardwareIntrinsics.X86
if (isUnexpectedResult)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Bmi1)}.{nameof(Bmi1.ResetLowestSetBit)}<UInt64>(UInt64): ResetLowestSetBit failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Bmi1.X64)}.{nameof(Bmi1.X64.ResetLowestSetBit)}<UInt64>(UInt64): ResetLowestSetBit failed:");
TestLibrary.TestFramework.LogInformation($" data: {data}");
TestLibrary.TestFramework.LogInformation($" result: {result}");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/TrailingZeroCount.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/TrailingZeroCount.UInt64.cs
index 959174b7e7..610e875483 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/TrailingZeroCount.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1.X64/TrailingZeroCount.UInt64.cs
@@ -78,7 +78,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(ScalarUnaryOpTest__TrailingZeroCountUInt64 testClass)
{
- var result = Bmi1.TrailingZeroCount(_fld);
+ var result = Bmi1.X64.TrailingZeroCount(_fld);
testClass.ValidateResult(_fld, result);
}
}
@@ -103,7 +103,7 @@ namespace JIT.HardwareIntrinsics.X86
_data = TestLibrary.Generator.GetUInt64();
}
- public bool IsSupported => Bmi1.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
+ public bool IsSupported => Bmi1.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -111,7 +111,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Bmi1.TrailingZeroCount(
+ var result = Bmi1.X64.TrailingZeroCount(
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data))
);
@@ -122,7 +122,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Bmi1).GetMethod(nameof(Bmi1.TrailingZeroCount), new Type[] { typeof(UInt64) })
+ var result = typeof(Bmi1.X64).GetMethod(nameof(Bmi1.X64.TrailingZeroCount), new Type[] { typeof(UInt64) })
.Invoke(null, new object[] {
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data))
});
@@ -134,7 +134,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Bmi1.TrailingZeroCount(
+ var result = Bmi1.X64.TrailingZeroCount(
_clsVar
);
@@ -146,7 +146,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var data = Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data));
- var result = Bmi1.TrailingZeroCount(data);
+ var result = Bmi1.X64.TrailingZeroCount(data);
ValidateResult(data, result);
}
@@ -156,7 +156,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ScalarUnaryOpTest__TrailingZeroCountUInt64();
- var result = Bmi1.TrailingZeroCount(test._fld);
+ var result = Bmi1.X64.TrailingZeroCount(test._fld);
ValidateResult(test._fld, result);
}
@@ -165,7 +165,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Bmi1.TrailingZeroCount(_fld);
+ var result = Bmi1.X64.TrailingZeroCount(_fld);
ValidateResult(_fld, result);
}
@@ -174,7 +174,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Bmi1.TrailingZeroCount(test._fld);
+ var result = Bmi1.X64.TrailingZeroCount(test._fld);
ValidateResult(test._fld, result);
}
@@ -216,7 +216,7 @@ namespace JIT.HardwareIntrinsics.X86
if (isUnexpectedResult)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Bmi1)}.{nameof(Bmi1.TrailingZeroCount)}<UInt64>(UInt64): TrailingZeroCount failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Bmi1.X64)}.{nameof(Bmi1.X64.TrailingZeroCount)}<UInt64>(UInt64): TrailingZeroCount failed:");
TestLibrary.TestFramework.LogInformation($" data: {data}");
TestLibrary.TestFramework.LogInformation($" result: {result}");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Bmi1_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Bmi1_r.csproj
index 67a0fb6cfe..4b9346525e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Bmi1_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Bmi1_r.csproj
@@ -28,15 +28,10 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AndNot.UInt32.cs" />
- <Compile Include="AndNot.UInt64.cs" />
<Compile Include="ExtractLowestSetBit.UInt32.cs" />
- <Compile Include="ExtractLowestSetBit.UInt64.cs" />
<Compile Include="GetMaskUpToLowestSetBit.UInt32.cs" />
- <Compile Include="GetMaskUpToLowestSetBit.UInt64.cs" />
<Compile Include="ResetLowestSetBit.UInt32.cs" />
- <Compile Include="ResetLowestSetBit.UInt64.cs" />
<Compile Include="TrailingZeroCount.UInt32.cs" />
- <Compile Include="TrailingZeroCount.UInt64.cs" />
<Compile Include="Program.Bmi1.cs" />
<Compile Include="..\Shared\Program.cs" />
</ItemGroup>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Bmi1_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Bmi1_ro.csproj
index 8a82271841..7286ee01b8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Bmi1_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Bmi1_ro.csproj
@@ -28,15 +28,10 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AndNot.UInt32.cs" />
- <Compile Include="AndNot.UInt64.cs" />
<Compile Include="ExtractLowestSetBit.UInt32.cs" />
- <Compile Include="ExtractLowestSetBit.UInt64.cs" />
<Compile Include="GetMaskUpToLowestSetBit.UInt32.cs" />
- <Compile Include="GetMaskUpToLowestSetBit.UInt64.cs" />
<Compile Include="ResetLowestSetBit.UInt32.cs" />
- <Compile Include="ResetLowestSetBit.UInt64.cs" />
<Compile Include="TrailingZeroCount.UInt32.cs" />
- <Compile Include="TrailingZeroCount.UInt64.cs" />
<Compile Include="Program.Bmi1.cs" />
<Compile Include="..\Shared\Program.cs" />
</ItemGroup>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Program.Bmi1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Program.Bmi1.cs
index 5760453e74..a93c4a5d50 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Program.Bmi1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi1/Program.Bmi1.cs
@@ -13,15 +13,10 @@ namespace JIT.HardwareIntrinsics.X86
{
TestList = new Dictionary<string, Action>() {
["AndNot.UInt32"] = AndNotUInt32,
- ["AndNot.UInt64"] = AndNotUInt64,
["ExtractLowestSetBit.UInt32"] = ExtractLowestSetBitUInt32,
- ["ExtractLowestSetBit.UInt64"] = ExtractLowestSetBitUInt64,
["GetMaskUpToLowestSetBit.UInt32"] = GetMaskUpToLowestSetBitUInt32,
- ["GetMaskUpToLowestSetBit.UInt64"] = GetMaskUpToLowestSetBitUInt64,
["ResetLowestSetBit.UInt32"] = ResetLowestSetBitUInt32,
- ["ResetLowestSetBit.UInt64"] = ResetLowestSetBitUInt64,
["TrailingZeroCount.UInt32"] = TrailingZeroCountUInt32,
- ["TrailingZeroCount.UInt64"] = TrailingZeroCountUInt64,
};
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/Bmi2.X64_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/Bmi2.X64_r.csproj
new file mode 100644
index 0000000000..e620aa1291
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/Bmi2.X64_r.csproj
@@ -0,0 +1,37 @@
+<?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>Embedded</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ParallelBitDeposit.UInt64.cs" />
+ <Compile Include="ParallelBitExtract.UInt64.cs" />
+ <Compile Include="Program.Bmi2.X64.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/Bmi2.X64_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/Bmi2.X64_ro.csproj
new file mode 100644
index 0000000000..0c28c955c9
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/Bmi2.X64_ro.csproj
@@ -0,0 +1,37 @@
+<?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>Embedded</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ParallelBitDeposit.UInt64.cs" />
+ <Compile Include="ParallelBitExtract.UInt64.cs" />
+ <Compile Include="Program.Bmi2.X64.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/ParallelBitDeposit.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/ParallelBitDeposit.UInt64.cs
index 7c0ce245b1..e397c7027c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/ParallelBitDeposit.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/ParallelBitDeposit.UInt64.cs
@@ -81,7 +81,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(ScalarBinaryOpTest__ParallelBitDepositUInt64 testClass)
{
- var result = Bmi2.ParallelBitDeposit(_fld1, _fld2);
+ var result = Bmi2.X64.ParallelBitDeposit(_fld1, _fld2);
testClass.ValidateResult(_fld1, _fld2, result);
}
}
@@ -112,7 +112,7 @@ namespace JIT.HardwareIntrinsics.X86
_data2 = TestLibrary.Generator.GetUInt64();
}
- public bool IsSupported => Bmi2.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
+ public bool IsSupported => Bmi2.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -120,7 +120,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Bmi2.ParallelBitDeposit(
+ var result = Bmi2.X64.ParallelBitDeposit(
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data1)),
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data2))
);
@@ -132,7 +132,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Bmi2).GetMethod(nameof(Bmi2.ParallelBitDeposit), new Type[] { typeof(UInt64), typeof(UInt64) })
+ var result = typeof(Bmi2.X64).GetMethod(nameof(Bmi2.X64.ParallelBitDeposit), new Type[] { typeof(UInt64), typeof(UInt64) })
.Invoke(null, new object[] {
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data1)),
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data2))
@@ -145,7 +145,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Bmi2.ParallelBitDeposit(
+ var result = Bmi2.X64.ParallelBitDeposit(
_clsVar1,
_clsVar2
);
@@ -159,7 +159,7 @@ namespace JIT.HardwareIntrinsics.X86
var data1 = Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data1));
var data2 = Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data2));
- var result = Bmi2.ParallelBitDeposit(data1, data2);
+ var result = Bmi2.X64.ParallelBitDeposit(data1, data2);
ValidateResult(data1, data2, result);
}
@@ -169,7 +169,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ScalarBinaryOpTest__ParallelBitDepositUInt64();
- var result = Bmi2.ParallelBitDeposit(test._fld1, test._fld2);
+ var result = Bmi2.X64.ParallelBitDeposit(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
@@ -178,7 +178,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Bmi2.ParallelBitDeposit(_fld1, _fld2);
+ var result = Bmi2.X64.ParallelBitDeposit(_fld1, _fld2);
ValidateResult(_fld1, _fld2, result);
}
@@ -187,7 +187,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Bmi2.ParallelBitDeposit(test._fld1, test._fld2);
+ var result = Bmi2.X64.ParallelBitDeposit(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
@@ -251,7 +251,7 @@ isUnexpectedResult = (dest != result);
if (isUnexpectedResult)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Bmi2)}.{nameof(Bmi2.ParallelBitDeposit)}<UInt64>(UInt64, UInt64): ParallelBitDeposit failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Bmi2.X64)}.{nameof(Bmi2.X64.ParallelBitDeposit)}<UInt64>(UInt64, UInt64): ParallelBitDeposit failed:");
TestLibrary.TestFramework.LogInformation($" left: {left}");
TestLibrary.TestFramework.LogInformation($" right: {right}");
TestLibrary.TestFramework.LogInformation($" result: {result}");
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/ParallelBitExtract.UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/ParallelBitExtract.UInt64.cs
index ebbf215f92..b2bece68ad 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/ParallelBitExtract.UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/ParallelBitExtract.UInt64.cs
@@ -81,7 +81,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(ScalarBinaryOpTest__ParallelBitExtractUInt64 testClass)
{
- var result = Bmi2.ParallelBitExtract(_fld1, _fld2);
+ var result = Bmi2.X64.ParallelBitExtract(_fld1, _fld2);
testClass.ValidateResult(_fld1, _fld2, result);
}
}
@@ -112,7 +112,7 @@ namespace JIT.HardwareIntrinsics.X86
_data2 = TestLibrary.Generator.GetUInt64();
}
- public bool IsSupported => Bmi2.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
+ public bool IsSupported => Bmi2.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -120,7 +120,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Bmi2.ParallelBitExtract(
+ var result = Bmi2.X64.ParallelBitExtract(
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data1)),
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data2))
);
@@ -132,7 +132,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Bmi2).GetMethod(nameof(Bmi2.ParallelBitExtract), new Type[] { typeof(UInt64), typeof(UInt64) })
+ var result = typeof(Bmi2.X64).GetMethod(nameof(Bmi2.X64.ParallelBitExtract), new Type[] { typeof(UInt64), typeof(UInt64) })
.Invoke(null, new object[] {
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data1)),
Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data2))
@@ -145,7 +145,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Bmi2.ParallelBitExtract(
+ var result = Bmi2.X64.ParallelBitExtract(
_clsVar1,
_clsVar2
);
@@ -159,7 +159,7 @@ namespace JIT.HardwareIntrinsics.X86
var data1 = Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data1));
var data2 = Unsafe.ReadUnaligned<UInt64>(ref Unsafe.As<UInt64, byte>(ref _data2));
- var result = Bmi2.ParallelBitExtract(data1, data2);
+ var result = Bmi2.X64.ParallelBitExtract(data1, data2);
ValidateResult(data1, data2, result);
}
@@ -169,7 +169,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ScalarBinaryOpTest__ParallelBitExtractUInt64();
- var result = Bmi2.ParallelBitExtract(test._fld1, test._fld2);
+ var result = Bmi2.X64.ParallelBitExtract(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
@@ -178,7 +178,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Bmi2.ParallelBitExtract(_fld1, _fld2);
+ var result = Bmi2.X64.ParallelBitExtract(_fld1, _fld2);
ValidateResult(_fld1, _fld2, result);
}
@@ -187,7 +187,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Bmi2.ParallelBitExtract(test._fld1, test._fld2);
+ var result = Bmi2.X64.ParallelBitExtract(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
@@ -251,7 +251,7 @@ isUnexpectedResult = (dest != result);
if (isUnexpectedResult)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Bmi2)}.{nameof(Bmi2.ParallelBitExtract)}<UInt64>(UInt64, UInt64): ParallelBitExtract failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Bmi2.X64)}.{nameof(Bmi2.X64.ParallelBitExtract)}<UInt64>(UInt64, UInt64): ParallelBitExtract failed:");
TestLibrary.TestFramework.LogInformation($" left: {left}");
TestLibrary.TestFramework.LogInformation($" right: {right}");
TestLibrary.TestFramework.LogInformation($" result: {result}");
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/Program.Bmi2.X64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/Program.Bmi2.X64.cs
new file mode 100644
index 0000000000..c0f8646319
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2.X64/Program.Bmi2.X64.cs
@@ -0,0 +1,20 @@
+// 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.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["ParallelBitDeposit.UInt64"] = ParallelBitDepositUInt64,
+ ["ParallelBitExtract.UInt64"] = ParallelBitExtractUInt64,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Bmi2_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Bmi2_r.csproj
index 95f82af8f6..2e2603f1d3 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Bmi2_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Bmi2_r.csproj
@@ -28,9 +28,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ParallelBitDeposit.UInt32.cs" />
- <Compile Include="ParallelBitDeposit.UInt64.cs" />
<Compile Include="ParallelBitExtract.UInt32.cs" />
- <Compile Include="ParallelBitExtract.UInt64.cs" />
<Compile Include="Program.Bmi2.cs" />
<Compile Include="..\Shared\Program.cs" />
</ItemGroup>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Bmi2_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Bmi2_ro.csproj
index 3f316f889b..952909b4b0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Bmi2_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Bmi2_ro.csproj
@@ -28,9 +28,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ParallelBitDeposit.UInt32.cs" />
- <Compile Include="ParallelBitDeposit.UInt64.cs" />
<Compile Include="ParallelBitExtract.UInt32.cs" />
- <Compile Include="ParallelBitExtract.UInt64.cs" />
<Compile Include="Program.Bmi2.cs" />
<Compile Include="..\Shared\Program.cs" />
</ItemGroup>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Program.Bmi2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Program.Bmi2.cs
index 1f65f58aa0..31300b1bd9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Program.Bmi2.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Bmi2/Program.Bmi2.cs
@@ -13,9 +13,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestList = new Dictionary<string, Action>() {
["ParallelBitDeposit.UInt32"] = ParallelBitDepositUInt32,
- ["ParallelBitDeposit.UInt64"] = ParallelBitDepositUInt64,
["ParallelBitExtract.UInt32"] = ParallelBitExtractUInt32,
- ["ParallelBitExtract.UInt64"] = ParallelBitExtractUInt64,
};
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Lzcnt.X64/Lzcnt.X64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Lzcnt.X64/Lzcnt.X64.cs
new file mode 100644
index 0000000000..2ca93459b1
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Lzcnt.X64/Lzcnt.X64.cs
@@ -0,0 +1,92 @@
+// 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.Reflection;
+using System.Runtime.Intrinsics.X86;
+
+namespace IntelHardwareIntrinsicTest
+{
+ class Program
+ {
+ const int Pass = 100;
+ const int Fail = 0;
+
+ static int Main(string[] args)
+ {
+ ulong sl = 0, resl;
+ int testResult = Pass;
+
+ if (Lzcnt.X64.IsSupported)
+ {
+ for (int i = 0; i < longLzcntTable.Length; i++)
+ {
+ sl = longLzcntTable[i].s;
+
+ resl = Lzcnt.X64.LeadingZeroCount(sl);
+ if (resl != longLzcntTable[i].res)
+ {
+ Console.WriteLine("{0}: Inputs: 0x{1,16:x} Expected: 0x{3,16:x} actual: 0x{4,16:x}",
+ i, sl, longLzcntTable[i].res, resl);
+ testResult = Fail;
+ }
+
+ resl = Convert.ToUInt64(typeof(Lzcnt.X64).GetMethod(nameof(Lzcnt.X64.LeadingZeroCount), new Type[] { sl.GetType() }).Invoke(null, new object[] { sl }));
+ if (resl != longLzcntTable[i].res)
+ {
+ Console.WriteLine("{0}: Inputs: 0x{1,16:x} Expected: 0x{3,16:x} actual: 0x{4,16:x} - Reflection",
+ i, sl, longLzcntTable[i].res, resl);
+ testResult = Fail;
+ }
+ }
+ }
+ else
+ {
+ try
+ {
+ resl = Lzcnt.X64.LeadingZeroCount(sl);
+ Console.WriteLine("Intrinsic Lzcnt.X64.LeadingZeroCount is called on non-supported hardware.");
+ Console.WriteLine("Lzcnt.X64.IsSupported " + Lzcnt.X64.IsSupported);
+ testResult = Fail;
+ }
+ catch (PlatformNotSupportedException)
+ {
+ }
+
+ try
+ {
+ resl = Convert.ToUInt64(typeof(Lzcnt.X64).GetMethod(nameof(Lzcnt.X64.LeadingZeroCount), new Type[] { sl.GetType() }).Invoke(null, new object[] { sl }));
+ Console.WriteLine("Intrinsic Lzcnt.X64.LeadingZeroCount is called via reflection on non-supported hardware.");
+ Console.WriteLine("Lzcnt.X64.IsSupported " + Lzcnt.X64.IsSupported);
+ testResult = Fail;
+ }
+ catch (TargetInvocationException e) when (e.InnerException is PlatformNotSupportedException)
+ {
+ }
+ }
+
+ return testResult;
+ }
+
+ public struct LZCNT<T> where T : struct
+ {
+ public T s;
+ public T res;
+ public LZCNT(T a, T r)
+ {
+ this.s = a;
+ this.res = r;
+ }
+ }
+
+ public static LZCNT<ulong>[] longLzcntTable = {
+ new LZCNT<ulong>(0x0000000000000000UL, 64),
+ new LZCNT<ulong>(0x0000000000000001UL, 63),
+ new LZCNT<ulong>(0xffffffffffffffffUL, 0),
+ new LZCNT<ulong>(0xf000000000000000UL, 0),
+ new LZCNT<ulong>(0x00050000000f423fUL, 13)
+ };
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64WithTruncation_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Lzcnt.X64/Lzcnt.X64_r.csproj
index 952a503db4..3029058fd1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64WithTruncation_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Lzcnt.X64/Lzcnt.X64_r.csproj
@@ -9,7 +9,6 @@
<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>
@@ -27,7 +26,7 @@
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
- <Compile Include="ConvertToInt64WithTruncation.cs" />
+ <Compile Include="Lzcnt.X64.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64WithTruncation_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Lzcnt.X64/Lzcnt.X64_ro.csproj
index 6a4f8cd192..699a8ccba2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64WithTruncation_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Lzcnt.X64/Lzcnt.X64_ro.csproj
@@ -9,7 +9,6 @@
<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>
@@ -27,7 +26,7 @@
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
- <Compile Include="ConvertToInt64WithTruncation.cs" />
+ <Compile Include="Lzcnt.X64.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Lzcnt/Lzcnt.cs b/tests/src/JIT/HardwareIntrinsics/X86/Lzcnt/Lzcnt.cs
index 9489233f21..a999a08b2c 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Lzcnt/Lzcnt.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Lzcnt/Lzcnt.cs
@@ -16,62 +16,10 @@ namespace IntelHardwareIntrinsicTest
static int Main(string[] args)
{
- ulong sl = 0, resl;
int testResult = Pass;
- if (!Lzcnt.IsSupported || !Environment.Is64BitProcess)
- {
- try
- {
- resl = Lzcnt.LeadingZeroCount(sl);
- Console.WriteLine("Intrinsic Lzcnt.LeadingZeroCount is called on non-supported hardware.");
- Console.WriteLine("Lzcnt.IsSupported " + Lzcnt.IsSupported);
- Console.WriteLine("Environment.Is64BitProcess " + Environment.Is64BitProcess);
- testResult = Fail;
- }
- catch (PlatformNotSupportedException)
- {
- }
-
- try
- {
- resl = Convert.ToUInt64(typeof(Lzcnt).GetMethod(nameof(Lzcnt.LeadingZeroCount), new Type[] { sl.GetType() }).Invoke(null, new object[] { sl }));
- Console.WriteLine("Intrinsic Lzcnt.LeadingZeroCount is called via reflection on non-supported hardware.");
- Console.WriteLine("Lzcnt.IsSupported " + Lzcnt.IsSupported);
- Console.WriteLine("Environment.Is64BitProcess " + Environment.Is64BitProcess);
- testResult = Fail;
- }
- catch (TargetInvocationException e) when (e.InnerException is PlatformNotSupportedException)
- {
- }
- }
-
-
if (Lzcnt.IsSupported)
{
- if (Environment.Is64BitProcess)
- {
- for (int i = 0; i < longLzcntTable.Length; i++)
- {
- sl = longLzcntTable[i].s;
-
- resl = Lzcnt.LeadingZeroCount(sl);
- if (resl != longLzcntTable[i].res)
- {
- Console.WriteLine("{0}: Inputs: 0x{1,16:x} Expected: 0x{3,16:x} actual: 0x{4,16:x}",
- i, sl, longLzcntTable[i].res, resl);
- testResult = Fail;
- }
-
- resl = Convert.ToUInt64(typeof(Lzcnt).GetMethod(nameof(Lzcnt.LeadingZeroCount), new Type[] { sl.GetType() }).Invoke(null, new object[] { sl }));
- if (resl != longLzcntTable[i].res)
- {
- Console.WriteLine("{0}: Inputs: 0x{1,16:x} Expected: 0x{3,16:x} actual: 0x{4,16:x} - Reflection",
- i, sl, longLzcntTable[i].res, resl);
- testResult = Fail;
- }
- }
- }
uint si, resi;
for (int i = 0; i < intLzcntTable.Length; i++)
@@ -86,7 +34,7 @@ namespace IntelHardwareIntrinsicTest
testResult = Fail;
}
- resl = Convert.ToUInt64(typeof(Lzcnt).GetMethod(nameof(Lzcnt.LeadingZeroCount), new Type[] { si.GetType() }).Invoke(null, new object[] { si }));
+ resi = Convert.ToUInt32(typeof(Lzcnt).GetMethod(nameof(Lzcnt.LeadingZeroCount), new Type[] { si.GetType() }).Invoke(null, new object[] { si }));
if (resi != intLzcntTable[i].res)
{
Console.WriteLine("{0}: Inputs: 0x{1,16:x} Expected: 0x{3,16:x} actual: 0x{4,16:x} - Reflection",
@@ -110,14 +58,6 @@ namespace IntelHardwareIntrinsicTest
}
}
- public static LZCNT<ulong>[] longLzcntTable = {
- new LZCNT<ulong>(0x0000000000000000UL, 64),
- new LZCNT<ulong>(0x0000000000000001UL, 63),
- new LZCNT<ulong>(0xffffffffffffffffUL, 0),
- new LZCNT<ulong>(0xf000000000000000UL, 0),
- new LZCNT<ulong>(0x00050000000f423fUL, 13)
- };
-
public static LZCNT<uint>[] intLzcntTable = {
new LZCNT<uint>(0x00000000U, 32),
new LZCNT<uint>(0x00000001U, 31),
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Popcnt.X64/Popcnt.X64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Popcnt.X64/Popcnt.X64.cs
new file mode 100644
index 0000000000..892bdcc33b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Popcnt.X64/Popcnt.X64.cs
@@ -0,0 +1,96 @@
+// 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.Reflection;
+using System.Runtime.Intrinsics.X86;
+
+namespace IntelHardwareIntrinsicTest
+{
+ class Program
+ {
+ const int Pass = 100;
+ const int Fail = 0;
+
+ static int Main(string[] args)
+ {
+ ulong sl = 0;
+ ulong resl;
+ int testResult = Pass;
+
+ if (Popcnt.X64.IsSupported)
+ {
+ for (int i = 0; i < longPopcntTable.Length; i++)
+ {
+ sl = longPopcntTable[i].s;
+
+ resl = Popcnt.X64.PopCount(sl);
+ if (resl != longPopcntTable[i].res)
+ {
+ Console.WriteLine("{0}: Inputs: 0x{1,16:x} Expected: 0x{3,16:x} actual: 0x{4,16:x}",
+ i, sl, longPopcntTable[i].res, resl);
+ testResult = Fail;
+ }
+
+ resl = Convert.ToUInt64(typeof(Popcnt.X64).GetMethod(nameof(Popcnt.X64.PopCount), new Type[] { sl.GetType() }).Invoke(null, new object[] { sl }));
+ if (resl != longPopcntTable[i].res)
+ {
+ Console.WriteLine("{0}: Inputs: 0x{1,16:x} Expected: 0x{3,16:x} actual: 0x{4,16:x} - Reflection",
+ i, sl, longPopcntTable[i].res, resl);
+ testResult = Fail;
+ }
+ }
+
+ }
+ else
+ {
+ try
+ {
+ resl = Popcnt.X64.PopCount(sl);
+ Console.WriteLine("Intrinsic Popcnt.X64.PopCount is called on non-supported hardware");
+ Console.WriteLine("Popcnt.X64.IsSupported " + Popcnt.X64.IsSupported);
+ Console.WriteLine("Environment.Is64BitProcess " + Environment.Is64BitProcess);
+ testResult = Fail;
+ }
+ catch (PlatformNotSupportedException)
+ {
+ }
+
+ try
+ {
+ resl = Convert.ToUInt64(typeof(Popcnt.X64).GetMethod(nameof(Popcnt.X64.PopCount), new Type[] { sl.GetType() }).Invoke(null, new object[] { sl }));
+ Console.WriteLine("Intrinsic Popcnt.X64.PopCount is called via reflection on non-supported hardware");
+ Console.WriteLine("Popcnt.X64.IsSupported " + Popcnt.X64.IsSupported);
+ Console.WriteLine("Environment.Is64BitProcess " + Environment.Is64BitProcess);
+ testResult = Fail;
+ }
+ catch (TargetInvocationException e) when (e.InnerException is PlatformNotSupportedException)
+ {
+ }
+ }
+
+ return testResult;
+ }
+
+ public struct POPCNT<T, U> where T : struct where U : struct
+ {
+ public T s;
+ public U res;
+ public POPCNT(T a, U r)
+ {
+ this.s = a;
+ this.res = r;
+ }
+ }
+
+ public static POPCNT<ulong,ulong>[] longPopcntTable = {
+ new POPCNT<ulong,ulong>(0x0000000000000000UL, 0UL),
+ new POPCNT<ulong,ulong>(0x0000000000000001UL, 1UL),
+ new POPCNT<ulong,ulong>(0xffffffffffffffffUL, 64UL),
+ new POPCNT<ulong,ulong>(0x8000000000000000UL, 1UL),
+ new POPCNT<ulong,ulong>(0x00050000000f423fUL, 14UL)
+ };
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertScalarToVector128Single_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Popcnt.X64/Popcnt.X64_r.csproj
index dd30303c01..20424b3524 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertScalarToVector128Single_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Popcnt.X64/Popcnt.X64_r.csproj
@@ -9,7 +9,6 @@
<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>
@@ -27,7 +26,7 @@
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
- <Compile Include="ConvertScalarToVector128Single.cs" />
+ <Compile Include="Popcnt.X64.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertScalarToVector128Single_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Popcnt.X64/Popcnt.X64_ro.csproj
index faeace85fa..ab0b93e8dc 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertScalarToVector128Single_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Popcnt.X64/Popcnt.X64_ro.csproj
@@ -9,7 +9,6 @@
<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>
@@ -27,7 +26,7 @@
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
- <Compile Include="ConvertScalarToVector128Single.cs" />
+ <Compile Include="Popcnt.X64.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Popcnt/Popcnt.cs b/tests/src/JIT/HardwareIntrinsics/X86/Popcnt/Popcnt.cs
index e30a8ed453..c7eb575309 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Popcnt/Popcnt.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Popcnt/Popcnt.cs
@@ -16,63 +16,10 @@ namespace IntelHardwareIntrinsicTest
static int Main(string[] args)
{
- ulong sl = 0;
- ulong resl;
int testResult = Pass;
- if (!Popcnt.IsSupported || !Environment.Is64BitProcess)
- {
- try
- {
- resl = Popcnt.PopCount(sl);
- Console.WriteLine("Intrinsic Popcnt.PopCount is called on non-supported hardware");
- Console.WriteLine("Popcnt.IsSupported " + Popcnt.IsSupported);
- Console.WriteLine("Environment.Is64BitProcess " + Environment.Is64BitProcess);
- testResult = Fail;
- }
- catch (PlatformNotSupportedException)
- {
- }
-
- try
- {
- resl = Convert.ToUInt64(typeof(Popcnt).GetMethod(nameof(Popcnt.PopCount), new Type[] { sl.GetType() }).Invoke(null, new object[] { sl }));
- Console.WriteLine("Intrinsic Popcnt.PopCount is called via reflection on non-supported hardware");
- Console.WriteLine("Popcnt.IsSupported " + Popcnt.IsSupported);
- Console.WriteLine("Environment.Is64BitProcess " + Environment.Is64BitProcess);
- testResult = Fail;
- }
- catch (TargetInvocationException e) when (e.InnerException is PlatformNotSupportedException)
- {
- }
- }
-
-
if (Popcnt.IsSupported)
{
- if (Environment.Is64BitProcess)
- {
- for (int i = 0; i < longPopcntTable.Length; i++)
- {
- sl = longPopcntTable[i].s;
-
- resl = Popcnt.PopCount(sl);
- if (resl != longPopcntTable[i].res)
- {
- Console.WriteLine("{0}: Inputs: 0x{1,16:x} Expected: 0x{3,16:x} actual: 0x{4,16:x}",
- i, sl, longPopcntTable[i].res, resl);
- testResult = Fail;
- }
-
- resl = Convert.ToUInt64(typeof(Popcnt).GetMethod(nameof(Popcnt.PopCount), new Type[] { sl.GetType() }).Invoke(null, new object[] { sl }));
- if (resl != longPopcntTable[i].res)
- {
- Console.WriteLine("{0}: Inputs: 0x{1,16:x} Expected: 0x{3,16:x} actual: 0x{4,16:x} - Reflection",
- i, sl, longPopcntTable[i].res, resl);
- testResult = Fail;
- }
- }
- }
uint si;
uint resi;
@@ -112,14 +59,6 @@ namespace IntelHardwareIntrinsicTest
}
}
- public static POPCNT<ulong,ulong>[] longPopcntTable = {
- new POPCNT<ulong,ulong>(0x0000000000000000UL, 0UL),
- new POPCNT<ulong,ulong>(0x0000000000000001UL, 1UL),
- new POPCNT<ulong,ulong>(0xffffffffffffffffUL, 64UL),
- new POPCNT<ulong,ulong>(0x8000000000000000UL, 1UL),
- new POPCNT<ulong,ulong>(0x00050000000f423fUL, 14UL)
- };
-
public static POPCNT<uint,uint>[] intPopcntTable = {
new POPCNT<uint,uint>(0x00000000U, 0U),
new POPCNT<uint,uint>(0x00000001U, 1U),
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx b/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx
index b555a3d686..f13b31e709 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/GenerateTests.csx
@@ -61,6 +61,7 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareOrderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((!float.IsNaN(left[0]) && !float.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareUnordered", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((float.IsNaN(left[0]) || float.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((float.IsNaN(left[i]) || float.IsNaN(right[i])) ? -1 : 0)"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "CompareUnorderedScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != ((float.IsNaN(left[0]) || float.IsNaN(right[0])) ? -1 : 0)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
+ ("SimpleBinOpConvTest.template",new Dictionary<string, string>{["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "ConvertScalarToVector128Single", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "(float)right != result[0]"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Divide", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] / right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i] / right[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "DivideScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(left[0] / right[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(left[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
("LoadUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["Method"] = "LoadVector128", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i])"}),
@@ -77,6 +78,13 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse", ["LoadIsa"] = "Sse", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(left[0]) ^ BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", ["ValidateRemainingResults"] = "(BitConverter.SingleToInt32Bits(left[0]) ^ BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])"}),
};
+private static readonly (string templateFileName, Dictionary<string, string> templateData)[] SseX64Inputs = new []
+{
+ ("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse.X64", ["LoadIsa"] = "Sse", ["Method"] = "ConvertToInt64", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "(long)Math.Round(firstOp[0]) != result"}),
+ ("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse.X64", ["LoadIsa"] = "Sse", ["Method"] = "ConvertToInt64WithTruncation", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "(long) firstOp[0] != result"}),
+ ("SimpleBinOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse.X64", ["LoadIsa"] = "Sse", ["Method"] = "ConvertScalarToVector128Single", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "(float)right != result[0]"}),
+};
+
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Sse2Inputs = new []
{
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Add", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["NextValueOp2"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] + right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] + right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
@@ -164,11 +172,7 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToInt32", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "(int)Math.Round(firstOp[0]) != result"}),
("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToInt32", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "firstOp[0] != result"}),
("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToInt32WithTruncation", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "(int) firstOp[0] != result"}),
- ("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToInt64", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "(long)Math.Round(firstOp[0]) != result"}),
- ("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToInt64", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "firstOp[0] != result"}),
- ("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToInt64WithTruncation", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "(long) firstOp[0] != result"}),
("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToUInt32", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "firstOp[0] != result"}),
- ("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToUInt64", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "firstOp[0] != result"}),
("SimpleUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToVector128Double", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(firstOp[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(firstOp[i])"}),
("SimpleUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToVector128Double", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(firstOp[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i % 2]) != BitConverter.DoubleToInt64Bits(firstOp[i % 2])"}),
("SimpleUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToVector128Int32", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "result[0] != (int)Math.Round(firstOp[0])", ["ValidateRemainingResults"] = "result[i] != ((i < 2) ? (int)Math.Round(firstOp[i]) : 0)"}),
@@ -177,6 +181,7 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("SimpleUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToVector128Int32WithTruncation", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "result[0] != (int)firstOp[0]", ["ValidateRemainingResults"] = "result[i] != (int)firstOp[i]"}),
("SimpleUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToVector128Single", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits((float)firstOp[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != ((i < 2) ? BitConverter.SingleToInt32Bits((float)firstOp[i]) : 0)"}),
("SimpleUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToVector128Single", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits((float)firstOp[0])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits((float)firstOp[i])"}),
+ ("SimpleBinOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertScalarToVector128Double", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "(double)right != result[0]"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Divide", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["NextValueOp2"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] / right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i] / right[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "DivideScalar", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["NextValueOp2"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(left[0] / right[0]) != BitConverter.DoubleToInt64Bits(result[0])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])"}),
("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt16", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt16", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt16()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
@@ -312,6 +317,15 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2", ["LoadIsa"] = "Sse2", ["Method"] = "Xor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "(ulong)(left[0] ^ right[0]) != result[0]", ["ValidateRemainingResults"] = "(ulong)(left[i] ^ right[i]) != result[i]"}),
};
+private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Sse2X64Inputs = new []
+{
+ ("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2.X64", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToInt64", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "(long)Math.Round(firstOp[0]) != result"}),
+ ("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2.X64", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToInt64", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "firstOp[0] != result"}),
+ ("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2.X64", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToUInt64", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "firstOp[0] != result"}),
+ ("SimdScalarUnOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2.X64", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertToInt64WithTruncation", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "(long)firstOp[0] != result"}),
+ ("SimpleBinOpConvTest.template", new Dictionary<string, string> { ["Isa"] = "Sse2.X64", ["LoadIsa"] = "Sse2", ["Method"] = "ConvertScalarToVector128Double", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "(double)right != result[0]"}),
+};
+
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Sse3Inputs = new []
{
("AlternatingBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse3", ["LoadIsa"] = "Sse2", ["Method"] = "AddSubtract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["NextValueOp2"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(left[i] - right[i])", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i + 1]) != BitConverter.DoubleToInt64Bits(left[i + 1] + right[i + 1])"}),
@@ -379,14 +393,10 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[1]))"}),
("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Byte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Byte", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetByte()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
- ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "(BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(firstOp[1]))"}),
("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Floor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Double", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateFirstResult"] = "BitConverter.DoubleToInt64Bits(result[0]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.DoubleToInt64Bits(result[i]) != BitConverter.DoubleToInt64Bits(Math.Floor(firstOp[i]))"}),
("SimpleUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Floor", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[0]))", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(MathF.Floor(firstOp[i]))"}),
@@ -397,8 +407,6 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
("InsertVector128Test.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(0.0f)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
("InsertVector128Test.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["Imm"] = "2", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(right[0])", ["ValidateRemainingResults"] = "i == 1 ? BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(0.0f) : BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
("InsertVector128Test.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["Imm"] = "4", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(right[0])", ["ValidateRemainingResults"] = "i == 2 ? BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(0.0f) : BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
@@ -412,8 +420,6 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "SByte", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "SByte", ["Data"] = "(sbyte)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSByte()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Data"] = "(int)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt32", ["Data"] = "(uint)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
- ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
("InsertVector128Test.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(0.0f)", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
("InsertVector128Test.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Single", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Single", ["Imm"] = "192", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["ValidateFirstResult"] = "BitConverter.SingleToInt32Bits(result[0]) != BitConverter.SingleToInt32Bits(right[3])", ["ValidateRemainingResults"] = "BitConverter.SingleToInt32Bits(result[i]) != BitConverter.SingleToInt32Bits(left[i])"}),
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "Max", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int32", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int32", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt32()", ["ValidateFirstResult"] = "result[0] != Math.Max(left[0], right[0])", ["ValidateRemainingResults"] = "result[i] != Math.Max(left[i], right[i])"}),
@@ -497,6 +503,18 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
("BooleanBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41", ["LoadIsa"] = "Sse2", ["Method"] = "TestZ", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "(left[i] & right[i]) == 0"}),
};
+private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Sse41X64Inputs = new []
+{
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41.X64", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41.X64", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41.X64", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("ExtractScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41.X64", ["LoadIsa"] = "Sse2", ["Method"] = "Extract", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "(result[0] != firstOp[1])"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41.X64", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41.X64", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "129", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41.X64", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "Int64", ["Data"] = "(long)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
+ ("InsertScalarTest.template", new Dictionary<string, string> { ["Isa"] = "Sse41.X64", ["LoadIsa"] = "Sse2", ["Method"] = "Insert", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "UInt64", ["Op1VectorType"] ="Vector128", ["Op1BaseType"] = "UInt64", ["Data"] = "(ulong)2", ["Imm"] = "1", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateFirstResult"] = "(i == 1 ? result[i] != 2 : result[i] != firstOp[i])"}),
+};
+
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Sse42Inputs = new []
{
("SimpleBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Sse42", ["LoadIsa"] = "Sse2", ["Method"] = "CompareGreaterThan", ["RetVectorType"] = "Vector128", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector128", ["Op1BaseType"] = "Int64", ["Op2VectorType"] = "Vector128", ["Op2BaseType"] = "Int64", ["LargestVectorSize"] = "16", ["NextValueOp1"] = "TestLibrary.Generator.GetInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetInt64()", ["ValidateFirstResult"] = "result[0] != ((left[0] > right[0]) ? unchecked((long)(-1)) : 0)", ["ValidateRemainingResults"] = "result[i] != ((left[i] > right[i]) ? unchecked((long)(-1)) : 0)"}),
@@ -999,15 +1017,19 @@ private static readonly (string templateFileName, Dictionary<string, string> tem
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Bmi1Inputs = new []
{
("ScalarBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1", ["Method"] = "AndNot", ["RetBaseType"] = "UInt32", ["Op1BaseType"] = "UInt32", ["Op2BaseType"] = "UInt32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt32()", ["ValidateResult"] = "isUnexpectedResult = ((~left & right) != result);" }),
- ("ScalarBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1", ["Method"] = "AndNot", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["Op2BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = "isUnexpectedResult = ((~left & right) != result);" }),
("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1", ["Method"] = "ExtractLowestSetBit", ["RetBaseType"] = "UInt32", ["Op1BaseType"] = "UInt32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateResult"] = "isUnexpectedResult = ((unchecked((uint)(-(int)data)) & data) != result);" }),
- ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1", ["Method"] = "ExtractLowestSetBit", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = "isUnexpectedResult = ((unchecked((ulong)(-(long)data)) & data) != result);" }),
("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1", ["Method"] = "GetMaskUpToLowestSetBit", ["RetBaseType"] = "UInt32", ["Op1BaseType"] = "UInt32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateResult"] = "isUnexpectedResult = (((data - 1) ^ data) != result);" }),
- ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1", ["Method"] = "GetMaskUpToLowestSetBit", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = "isUnexpectedResult = (((data - 1) ^ data) != result);" }),
("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1", ["Method"] = "ResetLowestSetBit", ["RetBaseType"] = "UInt32", ["Op1BaseType"] = "UInt32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateResult"] = "isUnexpectedResult = (((data - 1) & data) != result);" }),
- ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1", ["Method"] = "ResetLowestSetBit", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = "isUnexpectedResult = (((data - 1) & data) != result);" }),
("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1", ["Method"] = "TrailingZeroCount", ["RetBaseType"] = "UInt32", ["Op1BaseType"] = "UInt32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateResult"] = "uint expectedResult = 0; for (int index = 0; ((data >> index) & 1) == 0; index++) { expectedResult++; } isUnexpectedResult = (expectedResult != result);" }),
- ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1", ["Method"] = "TrailingZeroCount", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = "ulong expectedResult = 0; for (int index = 0; ((data >> index) & 1) == 0; index++) { expectedResult++; } isUnexpectedResult = (expectedResult != result);" }),
+};
+
+private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Bmi1X64Inputs = new []
+{
+ ("ScalarBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1.X64", ["Method"] = "AndNot", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["Op2BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = "isUnexpectedResult = ((~left & right) != result);" }),
+ ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1.X64", ["Method"] = "ExtractLowestSetBit", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = "isUnexpectedResult = ((unchecked((ulong)(-(long)data)) & data) != result);" }),
+ ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1.X64", ["Method"] = "GetMaskUpToLowestSetBit", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = "isUnexpectedResult = (((data - 1) ^ data) != result);" }),
+ ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1.X64", ["Method"] = "ResetLowestSetBit", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = "isUnexpectedResult = (((data - 1) & data) != result);" }),
+ ("ScalarUnOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi1.X64", ["Method"] = "TrailingZeroCount", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = "ulong expectedResult = 0; for (int index = 0; ((data >> index) & 1) == 0; index++) { expectedResult++; } isUnexpectedResult = (expectedResult != result);" }),
};
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] AesInputs = new []
@@ -1120,9 +1142,13 @@ isUnexpectedResult = (dest != result);
private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Bmi2Inputs = new []
{
("ScalarBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi2", ["Method"] = "ParallelBitDeposit", ["RetBaseType"] = "UInt32", ["Op1BaseType"] = "UInt32", ["Op2BaseType"] = "UInt32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt32()", ["ValidateResult"] = ValidateBmi2ParallelBitDepositUInt32 }),
- ("ScalarBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi2", ["Method"] = "ParallelBitDeposit", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["Op2BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = ValidateBmi2ParallelBitDepositUInt64 }),
("ScalarBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi2", ["Method"] = "ParallelBitExtract", ["RetBaseType"] = "UInt32", ["Op1BaseType"] = "UInt32", ["Op2BaseType"] = "UInt32", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt32()", ["ValidateResult"] = ValidateBmi2ParallelBitExtractUInt32 }),
- ("ScalarBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi2", ["Method"] = "ParallelBitExtract", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["Op2BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = ValidateBmi2ParallelBitExtractUInt64 }),
+};
+
+private static readonly (string templateFileName, Dictionary<string, string> templateData)[] Bmi2X64Inputs = new []
+{
+ ("ScalarBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi2.X64", ["Method"] = "ParallelBitDeposit", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["Op2BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = ValidateBmi2ParallelBitDepositUInt64 }),
+ ("ScalarBinOpTest.template", new Dictionary<string, string> { ["Isa"] = "Bmi2.X64", ["Method"] = "ParallelBitExtract", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["Op2BaseType"] = "UInt64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt64()", ["ValidateResult"] = ValidateBmi2ParallelBitExtractUInt64 }),
};
private static void ProcessInputs(string groupName, (string templateFileName, Dictionary<string, string> templateData)[] inputs)
@@ -1219,10 +1245,13 @@ private static void ProcessInput(StreamWriter testListFile, string groupName, (s
}
ProcessInputs("Sse", SseInputs);
+ProcessInputs("Sse.X64", SseX64Inputs);
ProcessInputs("Sse2", Sse2Inputs);
+ProcessInputs("Sse2.X64", Sse2X64Inputs);
ProcessInputs("Sse3", Sse3Inputs);
ProcessInputs("Ssse3", Ssse3Inputs);
ProcessInputs("Sse41", Sse41Inputs);
+ProcessInputs("Sse41.X64", Sse41X64Inputs);
ProcessInputs("Sse42", Sse42Inputs);
ProcessInputs("Avx", AvxInputs);
ProcessInputs("Avx_Vector128", Avx_Vector128Inputs);
@@ -1231,6 +1260,8 @@ ProcessInputs("Avx2_Vector128", Avx2_Vector128Inputs);
ProcessInputs("Fma_Vector128", Fma_Vector128Inputs);
ProcessInputs("Fma_Vector256", Fma_Vector256Inputs);
ProcessInputs("Bmi1", Bmi1Inputs);
+ProcessInputs("Bmi1.X64", Bmi1X64Inputs);
ProcessInputs("Bmi2", Bmi2Inputs);
+ProcessInputs("Bmi2.X64", Bmi2X64Inputs);
ProcessInputs("Aes", AesInputs);
ProcessInputs("Pclmulqdq", PclmulqdqInputs);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimdScalarUnOpConvTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimdScalarUnOpConvTest.template
index 2819dcd81d..fde3817511 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimdScalarUnOpConvTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimdScalarUnOpConvTest.template
@@ -141,7 +141,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimdScalarUnaryOpTest__DataTable<{Op1BaseType}>(_data, LargestVectorSize);
}
- public bool IsSupported => {Isa}.IsSupported && (Environment.Is64BitProcess || ((typeof({RetBaseType}) != typeof(long)) && (typeof({RetBaseType}) != typeof(ulong))));
+ public bool IsSupported => {Isa}.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpConvTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpConvTest.template
new file mode 100644
index 0000000000..0049bf5966
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpConvTest.template
@@ -0,0 +1,395 @@
+// 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 {Method}{RetBaseType}()
+ {
+ var test = new SimpleBinaryOpConvTest__{Method}{RetBaseType}();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if ({LoadIsa}.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if ({LoadIsa}.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if ({LoadIsa}.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local class works
+ test.RunClassLclFldScenario();
+
+ // Validates passing an instance member of a class works
+ test.RunClassFldScenario();
+
+ // Validates passing the field of a local struct works
+ test.RunStructLclFldScenario();
+
+ // Validates passing an instance member of a struct works
+ test.RunStructFldScenario();
+ }
+ 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 SimpleBinaryOpConvTest__{Method}{RetBaseType}
+ {
+ private struct TestStruct
+ {
+ public {Op1VectorType}<{Op1BaseType}> _fld1;
+ public {Op2BaseType} _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref testStruct._fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ _data2 = {NextValueOp2};
+ testStruct._fld2 = _data2;
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(SimpleBinaryOpConvTest__{Method}{RetBaseType} testClass)
+ {
+ var result = {Isa}.{Method}(_fld1, _fld2);
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
+ }
+ }
+
+ private static readonly int LargestVectorSize = {LargestVectorSize};
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>() / sizeof({Op1BaseType});
+ private static readonly int RetElementCount = Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>() / sizeof({RetBaseType});
+
+ private static {Op1BaseType}[] _data1 = new {Op1BaseType}[Op1ElementCount];
+ private static {Op2BaseType} _data2;
+
+ private static {Op1VectorType}<{Op1BaseType}> _clsVar1;
+ private static {Op2BaseType} _clsVar2;
+
+ private {Op1VectorType}<{Op1BaseType}> _fld1;
+ private {Op2BaseType} _fld2;
+
+ private SimpleBinaryOpConvTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}> _dataTable;
+
+ static SimpleBinaryOpConvTest__{Method}{RetBaseType}()
+ {
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _clsVar1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ _data2 = {NextValueOp2};
+ _clsVar2 = _data2;
+ }
+
+ public SimpleBinaryOpConvTest__{Method}{RetBaseType}()
+ {
+ Succeeded = true;
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = {NextValueOp1}; }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1VectorType}<{Op1BaseType}>, byte>(ref _fld1), ref Unsafe.As<{Op1BaseType}, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ _data2 = {NextValueOp2};
+ _fld2 = _data2;
+
+ _dataTable = new SimpleBinaryOpConvTest__DataTable<{RetBaseType}, {Op1BaseType}, {Op2BaseType}>(_data1, _data2, new {RetBaseType}[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => {Isa}.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
+
+ var result = {Isa}.{Method}(
+ Unsafe.Read<{Op1VectorType}<{Op1BaseType}>>(_dataTable.inArray1Ptr),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
+
+ var result = {Isa}.{Method}(
+ {LoadIsa}.Load{Op1VectorType}(({Op1BaseType}*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
+
+ var result = {Isa}.{Method}(
+ {LoadIsa}.LoadAligned{Op1VectorType}(({Op1BaseType}*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
+
+ var result = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1VectorType}<{Op1BaseType}>), typeof({Op2BaseType}) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<{Op1VectorType}<{Op1BaseType}>>(_dataTable.inArray1Ptr),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, ({RetVectorType}<{RetBaseType}>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
+
+ var result = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1VectorType}<{Op1BaseType}>), typeof({Op2BaseType}) })
+ .Invoke(null, new object[] {
+ {LoadIsa}.Load{Op1VectorType}(({Op1BaseType}*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, ({RetVectorType}<{RetBaseType}>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
+
+ var result = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1VectorType}<{Op1BaseType}>), typeof({Op2BaseType}) })
+ .Invoke(null, new object[] {
+ {LoadIsa}.LoadAligned{Op1VectorType}(({Op1BaseType}*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, ({RetVectorType}<{RetBaseType}>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
+
+ var result = {Isa}.{Method}(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
+
+ var left = Unsafe.Read<{Op1VectorType}<{Op1BaseType}>>(_dataTable.inArray1Ptr);
+ var right = _dataTable.inData2;
+ var result = {Isa}.{Method}(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
+
+ var left = {LoadIsa}.Load{Op1VectorType}(({Op1BaseType}*)(_dataTable.inArray1Ptr));
+ var right = _dataTable.inData2;
+ var result = {Isa}.{Method}(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
+
+ var left = {LoadIsa}.LoadAligned{Op1VectorType}(({Op1BaseType}*)(_dataTable.inArray1Ptr));
+ var right = _dataTable.inData2;
+ var result = {Isa}.{Method}(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunClassLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
+
+ var test = new SimpleBinaryOpConvTest__{Method}{RetBaseType}();
+ var result = {Isa}.{Method}(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunClassFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
+
+ var result = {Isa}.{Method}(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
+
+ var test = TestStruct.Create();
+ var result = {Isa}.{Method}(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
+
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
+
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult({Op1VectorType}<{Op1BaseType}> left, {Op2BaseType} right, void* result, [CallerMemberName] string method = "")
+ {
+ {Op1BaseType}[] inArray1 = new {Op1BaseType}[Op1ElementCount];
+ {RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
+
+ ValidateResult(inArray1, right, outArray, method);
+ }
+
+ private void ValidateResult(void* left, {Op2BaseType} right, void* result, [CallerMemberName] string method = "")
+ {
+ {Op1BaseType}[] inArray1 = new {Op1BaseType}[Op1ElementCount];
+ {RetBaseType}[] outArray = new {RetBaseType}[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{Op1BaseType}, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<{Op1VectorType}<{Op1BaseType}>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<{RetBaseType}, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<{RetVectorType}<{RetBaseType}>>());
+
+ ValidateResult(inArray1, right, outArray, method);
+ }
+
+ private void ValidateResult({Op1BaseType}[] left, {Op2BaseType} right, {RetBaseType}[] result, [CallerMemberName] string method = "")
+ {
+ if ({ValidateFirstResult})
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != left[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{nameof({Isa})}.{nameof({Isa}.{Method})}<{RetBaseType}>({Op1VectorType}<{Op1BaseType}>, {Op2BaseType}): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
+ TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpConvTest_DataTable.cs b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpConvTest_DataTable.cs
new file mode 100644
index 0000000000..c217514c28
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleBinOpConvTest_DataTable.cs
@@ -0,0 +1,63 @@
+// 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.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Intrinsics;
+using System.Runtime.Intrinsics.X86;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public unsafe struct SimpleBinaryOpConvTest__DataTable<TResult, TOp1, TOp2> : IDisposable
+ where TResult : struct
+ where TOp1 : struct
+ where TOp2 : struct
+ {
+ private byte[] inArray1;
+ public TOp2 inData2;
+ private byte[] outArray;
+
+ private GCHandle inHandle1;
+ private GCHandle outHandle;
+
+ private ulong alignment;
+
+ public SimpleBinaryOpConvTest__DataTable(TOp1[] inArray1, TOp2 inData2, TResult[] outArray, int alignment)
+ {
+ int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<TOp1>();
+ int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<TResult>();
+ if ((alignment != 32 && alignment != 16) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray)
+ {
+ throw new ArgumentException("Invalid value of alignment");
+ }
+
+ this.inArray1 = new byte[alignment * 2];
+ this.outArray = new byte[alignment * 2];
+ this.inData2 = inData2;
+
+ this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
+ this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
+
+ this.alignment = (ulong)alignment;
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<TOp1, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
+ }
+
+ public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
+ public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
+
+ public void Dispose()
+ {
+ inHandle1.Free();
+ outHandle.Free();
+ }
+
+ private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
+ {
+ return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpConvTest.template b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpConvTest.template
index dd6fa70868..e23555ccb8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpConvTest.template
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpConvTest.template
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<{RetBaseType}, {Op1BaseType}>(_data, new {RetBaseType}[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => {Isa}.IsSupported && (Environment.Is64BitProcess || ((typeof({RetBaseType}) != typeof(long)) && (typeof({RetBaseType}) != typeof(ulong))));
+ public bool IsSupported => {Isa}.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/ConvertScalarToVector128Single.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/ConvertScalarToVector128Single.Single.cs
new file mode 100644
index 0000000000..1472731282
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/ConvertScalarToVector128Single.Single.cs
@@ -0,0 +1,395 @@
+// 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 ConvertScalarToVector128SingleSingle()
+ {
+ var test = new SimpleBinaryOpConvTest__ConvertScalarToVector128SingleSingle();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Sse.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Sse.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Sse.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local class works
+ test.RunClassLclFldScenario();
+
+ // Validates passing an instance member of a class works
+ test.RunClassFldScenario();
+
+ // Validates passing the field of a local struct works
+ test.RunStructLclFldScenario();
+
+ // Validates passing an instance member of a struct works
+ test.RunStructFldScenario();
+ }
+ 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 SimpleBinaryOpConvTest__ConvertScalarToVector128SingleSingle
+ {
+ private struct TestStruct
+ {
+ public Vector128<Single> _fld1;
+ public Int64 _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref testStruct._fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ _data2 = TestLibrary.Generator.GetInt64();
+ testStruct._fld2 = _data2;
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(SimpleBinaryOpConvTest__ConvertScalarToVector128SingleSingle testClass)
+ {
+ var result = Sse.X64.ConvertScalarToVector128Single(_fld1, _fld2);
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
+ }
+ }
+
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ private static Single[] _data1 = new Single[Op1ElementCount];
+ private static Int64 _data2;
+
+ private static Vector128<Single> _clsVar1;
+ private static Int64 _clsVar2;
+
+ private Vector128<Single> _fld1;
+ private Int64 _fld2;
+
+ private SimpleBinaryOpConvTest__DataTable<Single, Single, Int64> _dataTable;
+
+ static SimpleBinaryOpConvTest__ConvertScalarToVector128SingleSingle()
+ {
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ _data2 = TestLibrary.Generator.GetInt64();
+ _clsVar2 = _data2;
+ }
+
+ public SimpleBinaryOpConvTest__ConvertScalarToVector128SingleSingle()
+ {
+ Succeeded = true;
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ _data2 = TestLibrary.Generator.GetInt64();
+ _fld2 = _data2;
+
+ _dataTable = new SimpleBinaryOpConvTest__DataTable<Single, Single, Int64>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Sse.X64.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
+
+ var result = Sse.X64.ConvertScalarToVector128Single(
+ Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
+
+ var result = Sse.X64.ConvertScalarToVector128Single(
+ Sse.LoadVector128((Single*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
+
+ var result = Sse.X64.ConvertScalarToVector128Single(
+ Sse.LoadAlignedVector128((Single*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
+
+ var result = typeof(Sse.X64).GetMethod(nameof(Sse.X64.ConvertScalarToVector128Single), new Type[] { typeof(Vector128<Single>), typeof(Int64) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Single>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
+
+ var result = typeof(Sse.X64).GetMethod(nameof(Sse.X64.ConvertScalarToVector128Single), new Type[] { typeof(Vector128<Single>), typeof(Int64) })
+ .Invoke(null, new object[] {
+ Sse.LoadVector128((Single*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Single>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
+
+ var result = typeof(Sse.X64).GetMethod(nameof(Sse.X64.ConvertScalarToVector128Single), new Type[] { typeof(Vector128<Single>), typeof(Int64) })
+ .Invoke(null, new object[] {
+ Sse.LoadAlignedVector128((Single*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Single>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
+
+ var result = Sse.X64.ConvertScalarToVector128Single(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
+
+ var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+ var right = _dataTable.inData2;
+ var result = Sse.X64.ConvertScalarToVector128Single(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
+
+ var left = Sse.LoadVector128((Single*)(_dataTable.inArray1Ptr));
+ var right = _dataTable.inData2;
+ var result = Sse.X64.ConvertScalarToVector128Single(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
+
+ var left = Sse.LoadAlignedVector128((Single*)(_dataTable.inArray1Ptr));
+ var right = _dataTable.inData2;
+ var result = Sse.X64.ConvertScalarToVector128Single(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunClassLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
+
+ var test = new SimpleBinaryOpConvTest__ConvertScalarToVector128SingleSingle();
+ var result = Sse.X64.ConvertScalarToVector128Single(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunClassFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
+
+ var result = Sse.X64.ConvertScalarToVector128Single(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
+
+ var test = TestStruct.Create();
+ var result = Sse.X64.ConvertScalarToVector128Single(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
+
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
+
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<Single> left, Int64 right, void* result, [CallerMemberName] string method = "")
+ {
+ Single[] inArray1 = new Single[Op1ElementCount];
+ Single[] outArray = new Single[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
+
+ ValidateResult(inArray1, right, outArray, method);
+ }
+
+ private void ValidateResult(void* left, Int64 right, void* result, [CallerMemberName] string method = "")
+ {
+ Single[] inArray1 = new Single[Op1ElementCount];
+ Single[] outArray = new Single[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
+
+ ValidateResult(inArray1, right, outArray, method);
+ }
+
+ private void ValidateResult(Single[] left, Int64 right, Single[] result, [CallerMemberName] string method = "")
+ {
+ if ((float)right != result[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != left[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse.X64)}.{nameof(Sse.X64.ConvertScalarToVector128Single)}<Single>(Vector128<Single>, Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
+ TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/ConvertToInt64.Vector128Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/ConvertToInt64.Vector128Single.cs
new file mode 100644
index 0000000000..93f2e0319c
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/ConvertToInt64.Vector128Single.cs
@@ -0,0 +1,350 @@
+// 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 ConvertToInt64Vector128Single()
+ {
+ var test = new SimdScalarUnaryOpConvertTest__ConvertToInt64Vector128Single();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Sse.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Sse.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Sse.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local class works
+ test.RunClassLclFldScenario();
+
+ // Validates passing an instance member of a class works
+ test.RunClassFldScenario();
+
+ // Validates passing the field of a local struct works
+ test.RunStructLclFldScenario();
+
+ // Validates passing an instance member of a struct works
+ test.RunStructFldScenario();
+ }
+ 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 SimdScalarUnaryOpConvertTest__ConvertToInt64Vector128Single
+ {
+ private struct TestStruct
+ {
+ public Vector128<Single> _fld;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSingle(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref testStruct._fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(SimdScalarUnaryOpConvertTest__ConvertToInt64Vector128Single testClass)
+ {
+ var result = Sse.X64.ConvertToInt64(_fld);
+ testClass.ValidateResult(_fld, result);
+ }
+ }
+
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ private static Single[] _data = new Single[Op1ElementCount];
+
+ private static Vector128<Single> _clsVar;
+
+ private Vector128<Single> _fld;
+
+ private SimdScalarUnaryOpTest__DataTable<Single> _dataTable;
+
+ static SimdScalarUnaryOpConvertTest__ConvertToInt64Vector128Single()
+ {
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSingle(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ }
+
+ public SimdScalarUnaryOpConvertTest__ConvertToInt64Vector128Single()
+ {
+ Succeeded = true;
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSingle(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSingle(); }
+ _dataTable = new SimdScalarUnaryOpTest__DataTable<Single>(_data, LargestVectorSize);
+ }
+
+ public bool IsSupported => Sse.X64.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
+
+ var result = Sse.X64.ConvertToInt64(
+ Unsafe.Read<Vector128<Single>>(_dataTable.inArrayPtr)
+ );
+
+ ValidateResult(_dataTable.inArrayPtr, result);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
+
+ var result = Sse.X64.ConvertToInt64(
+ Sse.LoadVector128((Single*)(_dataTable.inArrayPtr))
+ );
+
+ ValidateResult(_dataTable.inArrayPtr, result);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
+
+ var result = Sse.X64.ConvertToInt64(
+ Sse.LoadAlignedVector128((Single*)(_dataTable.inArrayPtr))
+ );
+
+ ValidateResult(_dataTable.inArrayPtr, result);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
+
+ var result = typeof(Sse.X64).GetMethod(nameof(Sse.X64.ConvertToInt64), new Type[] { typeof(Vector128<Single>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<Single>>(_dataTable.inArrayPtr)
+ });
+
+ ValidateResult(_dataTable.inArrayPtr, (Int64)(result));
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
+
+ var result = typeof(Sse.X64).GetMethod(nameof(Sse.X64.ConvertToInt64), new Type[] { typeof(Vector128<Single>) })
+ .Invoke(null, new object[] {
+ Sse.LoadVector128((Single*)(_dataTable.inArrayPtr))
+ });
+
+ ValidateResult(_dataTable.inArrayPtr, (Int64)(result));
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
+
+ var result = typeof(Sse.X64).GetMethod(nameof(Sse.X64.ConvertToInt64), new Type[] { typeof(Vector128<Single>) })
+ .Invoke(null, new object[] {
+ Sse.LoadAlignedVector128((Single*)(_dataTable.inArrayPtr))
+ });
+
+ ValidateResult(_dataTable.inArrayPtr, (Int64)(result));
+ }
+
+ public void RunClsVarScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
+
+ var result = Sse.X64.ConvertToInt64(
+ _clsVar
+ );
+
+ ValidateResult(_clsVar, result);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
+
+ var firstOp = Unsafe.Read<Vector128<Single>>(_dataTable.inArrayPtr);
+ var result = Sse.X64.ConvertToInt64(firstOp);
+
+ ValidateResult(firstOp, result);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
+
+ var firstOp = Sse.LoadVector128((Single*)(_dataTable.inArrayPtr));
+ var result = Sse.X64.ConvertToInt64(firstOp);
+
+ ValidateResult(firstOp, result);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
+
+ var firstOp = Sse.LoadAlignedVector128((Single*)(_dataTable.inArrayPtr));
+ var result = Sse.X64.ConvertToInt64(firstOp);
+
+ ValidateResult(firstOp, result);
+ }
+
+ public void RunClassLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
+
+ var test = new SimdScalarUnaryOpConvertTest__ConvertToInt64Vector128Single();
+ var result = Sse.X64.ConvertToInt64(test._fld);
+
+ ValidateResult(test._fld, result);
+ }
+
+ public void RunClassFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
+
+ var result = Sse.X64.ConvertToInt64(_fld);
+
+ ValidateResult(_fld, result);
+ }
+
+ public void RunStructLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
+
+ var test = TestStruct.Create();
+ var result = Sse.X64.ConvertToInt64(test._fld);
+
+ ValidateResult(test._fld, result);
+ }
+
+ public void RunStructFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
+
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
+
+ bool succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+ }
+ }
+
+ private void ValidateResult(Vector128<Single> firstOp, Int64 result, [CallerMemberName] string method = "")
+ {
+ Single[] inArray = new Single[Op1ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ ValidateResult(inArray, result, method);
+ }
+
+ private void ValidateResult(void* firstOp, Int64 result, [CallerMemberName] string method = "")
+ {
+ Single[] inArray = new Single[Op1ElementCount];
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ ValidateResult(inArray, result, method);
+ }
+
+ private void ValidateResult(Single[] firstOp, Int64 result, [CallerMemberName] string method = "")
+ {
+ bool succeeded = true;
+
+ if ((long)Math.Round(firstOp[0]) != result)
+ {
+ succeeded = false;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse.X64)}.{nameof(Sse.X64.ConvertToInt64)}<Int64>(Vector128<Single>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
+ TestLibrary.TestFramework.LogInformation($" result: result");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+
+ Succeeded = false;
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/ConvertToInt64WithTruncation.Vector128Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/ConvertToInt64WithTruncation.Vector128Single.cs
new file mode 100644
index 0000000000..59db15562b
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/ConvertToInt64WithTruncation.Vector128Single.cs
@@ -0,0 +1,350 @@
+// 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 ConvertToInt64WithTruncationVector128Single()
+ {
+ var test = new SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationVector128Single();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Sse.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Sse.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Sse.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local class works
+ test.RunClassLclFldScenario();
+
+ // Validates passing an instance member of a class works
+ test.RunClassFldScenario();
+
+ // Validates passing the field of a local struct works
+ test.RunStructLclFldScenario();
+
+ // Validates passing an instance member of a struct works
+ test.RunStructFldScenario();
+ }
+ 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 SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationVector128Single
+ {
+ private struct TestStruct
+ {
+ public Vector128<Single> _fld;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSingle(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref testStruct._fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationVector128Single testClass)
+ {
+ var result = Sse.X64.ConvertToInt64WithTruncation(_fld);
+ testClass.ValidateResult(_fld, result);
+ }
+ }
+
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ private static Single[] _data = new Single[Op1ElementCount];
+
+ private static Vector128<Single> _clsVar;
+
+ private Vector128<Single> _fld;
+
+ private SimdScalarUnaryOpTest__DataTable<Single> _dataTable;
+
+ static SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationVector128Single()
+ {
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSingle(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ }
+
+ public SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationVector128Single()
+ {
+ Succeeded = true;
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSingle(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld), ref Unsafe.As<Single, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetSingle(); }
+ _dataTable = new SimdScalarUnaryOpTest__DataTable<Single>(_data, LargestVectorSize);
+ }
+
+ public bool IsSupported => Sse.X64.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
+
+ var result = Sse.X64.ConvertToInt64WithTruncation(
+ Unsafe.Read<Vector128<Single>>(_dataTable.inArrayPtr)
+ );
+
+ ValidateResult(_dataTable.inArrayPtr, result);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
+
+ var result = Sse.X64.ConvertToInt64WithTruncation(
+ Sse.LoadVector128((Single*)(_dataTable.inArrayPtr))
+ );
+
+ ValidateResult(_dataTable.inArrayPtr, result);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
+
+ var result = Sse.X64.ConvertToInt64WithTruncation(
+ Sse.LoadAlignedVector128((Single*)(_dataTable.inArrayPtr))
+ );
+
+ ValidateResult(_dataTable.inArrayPtr, result);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
+
+ var result = typeof(Sse.X64).GetMethod(nameof(Sse.X64.ConvertToInt64WithTruncation), new Type[] { typeof(Vector128<Single>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<Single>>(_dataTable.inArrayPtr)
+ });
+
+ ValidateResult(_dataTable.inArrayPtr, (Int64)(result));
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
+
+ var result = typeof(Sse.X64).GetMethod(nameof(Sse.X64.ConvertToInt64WithTruncation), new Type[] { typeof(Vector128<Single>) })
+ .Invoke(null, new object[] {
+ Sse.LoadVector128((Single*)(_dataTable.inArrayPtr))
+ });
+
+ ValidateResult(_dataTable.inArrayPtr, (Int64)(result));
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
+
+ var result = typeof(Sse.X64).GetMethod(nameof(Sse.X64.ConvertToInt64WithTruncation), new Type[] { typeof(Vector128<Single>) })
+ .Invoke(null, new object[] {
+ Sse.LoadAlignedVector128((Single*)(_dataTable.inArrayPtr))
+ });
+
+ ValidateResult(_dataTable.inArrayPtr, (Int64)(result));
+ }
+
+ public void RunClsVarScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
+
+ var result = Sse.X64.ConvertToInt64WithTruncation(
+ _clsVar
+ );
+
+ ValidateResult(_clsVar, result);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
+
+ var firstOp = Unsafe.Read<Vector128<Single>>(_dataTable.inArrayPtr);
+ var result = Sse.X64.ConvertToInt64WithTruncation(firstOp);
+
+ ValidateResult(firstOp, result);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
+
+ var firstOp = Sse.LoadVector128((Single*)(_dataTable.inArrayPtr));
+ var result = Sse.X64.ConvertToInt64WithTruncation(firstOp);
+
+ ValidateResult(firstOp, result);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
+
+ var firstOp = Sse.LoadAlignedVector128((Single*)(_dataTable.inArrayPtr));
+ var result = Sse.X64.ConvertToInt64WithTruncation(firstOp);
+
+ ValidateResult(firstOp, result);
+ }
+
+ public void RunClassLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
+
+ var test = new SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationVector128Single();
+ var result = Sse.X64.ConvertToInt64WithTruncation(test._fld);
+
+ ValidateResult(test._fld, result);
+ }
+
+ public void RunClassFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
+
+ var result = Sse.X64.ConvertToInt64WithTruncation(_fld);
+
+ ValidateResult(_fld, result);
+ }
+
+ public void RunStructLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
+
+ var test = TestStruct.Create();
+ var result = Sse.X64.ConvertToInt64WithTruncation(test._fld);
+
+ ValidateResult(test._fld, result);
+ }
+
+ public void RunStructFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
+
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
+
+ bool succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+ }
+ }
+
+ private void ValidateResult(Vector128<Single> firstOp, Int64 result, [CallerMemberName] string method = "")
+ {
+ Single[] inArray = new Single[Op1ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), firstOp);
+ ValidateResult(inArray, result, method);
+ }
+
+ private void ValidateResult(void* firstOp, Int64 result, [CallerMemberName] string method = "")
+ {
+ Single[] inArray = new Single[Op1ElementCount];
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ ValidateResult(inArray, result, method);
+ }
+
+ private void ValidateResult(Single[] firstOp, Int64 result, [CallerMemberName] string method = "")
+ {
+ bool succeeded = true;
+
+ if ((long) firstOp[0] != result)
+ {
+ succeeded = false;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse.X64)}.{nameof(Sse.X64.ConvertToInt64WithTruncation)}<Int64>(Vector128<Single>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
+ TestLibrary.TestFramework.LogInformation($" result: result");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+
+ Succeeded = false;
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/Program.Sse.X64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/Program.Sse.X64.cs
new file mode 100644
index 0000000000..7fb867506e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/Program.Sse.X64.cs
@@ -0,0 +1,21 @@
+// 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.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["ConvertToInt64.Vector128Single"] = ConvertToInt64Vector128Single,
+ ["ConvertToInt64WithTruncation.Vector128Single"] = ConvertToInt64WithTruncationVector128Single,
+ ["ConvertScalarToVector128Single.Single"] = ConvertScalarToVector128SingleSingle,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/Sse.X64_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/Sse.X64_r.csproj
new file mode 100644
index 0000000000..6a165cf91a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/Sse.X64_r.csproj
@@ -0,0 +1,40 @@
+<?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>Embedded</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ConvertToInt64.Vector128Single.cs" />
+ <Compile Include="ConvertToInt64WithTruncation.Vector128Single.cs" />
+ <Compile Include="ConvertScalarToVector128Single.Single.cs" />
+ <Compile Include="..\Shared\SimpleBinOpConvTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimdScalarUnOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ <Compile Include="Program.Sse.X64.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/Sse.X64_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/Sse.X64_ro.csproj
new file mode 100644
index 0000000000..18492b4fd7
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse.X64/Sse.X64_ro.csproj
@@ -0,0 +1,40 @@
+<?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>Embedded</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ConvertToInt64.Vector128Single.cs" />
+ <Compile Include="ConvertToInt64WithTruncation.Vector128Single.cs" />
+ <Compile Include="ConvertScalarToVector128Single.Single.cs" />
+ <Compile Include="..\Shared\SimpleBinOpConvTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimdScalarUnOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ <Compile Include="Program.Sse.X64.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertScalarToVector128Single.Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertScalarToVector128Single.Single.cs
new file mode 100644
index 0000000000..c7bcd98799
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertScalarToVector128Single.Single.cs
@@ -0,0 +1,395 @@
+// 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 ConvertScalarToVector128SingleSingle()
+ {
+ var test = new SimpleBinaryOpConvTest__ConvertScalarToVector128SingleSingle();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Sse.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Sse.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Sse.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local class works
+ test.RunClassLclFldScenario();
+
+ // Validates passing an instance member of a class works
+ test.RunClassFldScenario();
+
+ // Validates passing the field of a local struct works
+ test.RunStructLclFldScenario();
+
+ // Validates passing an instance member of a struct works
+ test.RunStructFldScenario();
+ }
+ 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 SimpleBinaryOpConvTest__ConvertScalarToVector128SingleSingle
+ {
+ private struct TestStruct
+ {
+ public Vector128<Single> _fld1;
+ public Int32 _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref testStruct._fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ _data2 = TestLibrary.Generator.GetInt32();
+ testStruct._fld2 = _data2;
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(SimpleBinaryOpConvTest__ConvertScalarToVector128SingleSingle testClass)
+ {
+ var result = Sse.ConvertScalarToVector128Single(_fld1, _fld2);
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
+ }
+ }
+
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single);
+
+ private static Single[] _data1 = new Single[Op1ElementCount];
+ private static Int32 _data2;
+
+ private static Vector128<Single> _clsVar1;
+ private static Int32 _clsVar2;
+
+ private Vector128<Single> _fld1;
+ private Int32 _fld2;
+
+ private SimpleBinaryOpConvTest__DataTable<Single, Single, Int32> _dataTable;
+
+ static SimpleBinaryOpConvTest__ConvertScalarToVector128SingleSingle()
+ {
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ _data2 = TestLibrary.Generator.GetInt32();
+ _clsVar2 = _data2;
+ }
+
+ public SimpleBinaryOpConvTest__ConvertScalarToVector128SingleSingle()
+ {
+ Succeeded = true;
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ _data2 = TestLibrary.Generator.GetInt32();
+ _fld2 = _data2;
+
+ _dataTable = new SimpleBinaryOpConvTest__DataTable<Single, Single, Int32>(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Sse.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
+
+ var result = Sse.ConvertScalarToVector128Single(
+ Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
+
+ var result = Sse.ConvertScalarToVector128Single(
+ Sse.LoadVector128((Single*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
+
+ var result = Sse.ConvertScalarToVector128Single(
+ Sse.LoadAlignedVector128((Single*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
+
+ var result = typeof(Sse).GetMethod(nameof(Sse.ConvertScalarToVector128Single), new Type[] { typeof(Vector128<Single>), typeof(Int32) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Single>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
+
+ var result = typeof(Sse).GetMethod(nameof(Sse.ConvertScalarToVector128Single), new Type[] { typeof(Vector128<Single>), typeof(Int32) })
+ .Invoke(null, new object[] {
+ Sse.LoadVector128((Single*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Single>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
+
+ var result = typeof(Sse).GetMethod(nameof(Sse.ConvertScalarToVector128Single), new Type[] { typeof(Vector128<Single>), typeof(Int32) })
+ .Invoke(null, new object[] {
+ Sse.LoadAlignedVector128((Single*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Single>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
+
+ var result = Sse.ConvertScalarToVector128Single(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
+
+ var left = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr);
+ var right = _dataTable.inData2;
+ var result = Sse.ConvertScalarToVector128Single(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
+
+ var left = Sse.LoadVector128((Single*)(_dataTable.inArray1Ptr));
+ var right = _dataTable.inData2;
+ var result = Sse.ConvertScalarToVector128Single(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
+
+ var left = Sse.LoadAlignedVector128((Single*)(_dataTable.inArray1Ptr));
+ var right = _dataTable.inData2;
+ var result = Sse.ConvertScalarToVector128Single(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunClassLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
+
+ var test = new SimpleBinaryOpConvTest__ConvertScalarToVector128SingleSingle();
+ var result = Sse.ConvertScalarToVector128Single(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunClassFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
+
+ var result = Sse.ConvertScalarToVector128Single(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
+
+ var test = TestStruct.Create();
+ var result = Sse.ConvertScalarToVector128Single(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
+
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
+
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<Single> left, Int32 right, void* result, [CallerMemberName] string method = "")
+ {
+ Single[] inArray1 = new Single[Op1ElementCount];
+ Single[] outArray = new Single[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
+
+ ValidateResult(inArray1, right, outArray, method);
+ }
+
+ private void ValidateResult(void* left, Int32 right, void* result, [CallerMemberName] string method = "")
+ {
+ Single[] inArray1 = new Single[Op1ElementCount];
+ Single[] outArray = new Single[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Single>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Single>>());
+
+ ValidateResult(inArray1, right, outArray, method);
+ }
+
+ private void ValidateResult(Single[] left, Int32 right, Single[] result, [CallerMemberName] string method = "")
+ {
+ if ((float)right != result[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != left[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse)}.{nameof(Sse.ConvertScalarToVector128Single)}<Single>(Vector128<Single>, Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
+ TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64.cs
deleted file mode 100644
index 60b2b58b1b..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Sse.IsSupported)
- {
- try
- {
- using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }))
- {
- var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArrayPtr);
- var l2 = Sse.ConvertToInt64(vf1);
-
- if (l2 != ((long)floatTable.inArray[0]))
- {
- Console.WriteLine("SSE ConvertToInt64 failed on float:");
- Console.WriteLine(l2);
- testResult = Fail;
- }
- }
- }
- catch (PlatformNotSupportedException)
- {
- if (Environment.Is64BitProcess)
- {
- testResult = Fail;
- }
- }
- }
-
- return testResult;
- }
-
- public unsafe struct TestTable<T> : IDisposable where T : struct
- {
- public T[] inArray;
-
- public void* inArrayPtr => inHandle.AddrOfPinnedObject().ToPointer();
-
- GCHandle inHandle;
- public TestTable(T[] a)
- {
- this.inArray = a;
-
- inHandle = GCHandle.Alloc(inArray, GCHandleType.Pinned);
- }
-
- public void Dispose()
- {
- inHandle.Free();
- }
- }
-
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64WithTruncation.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64WithTruncation.cs
deleted file mode 100644
index 466952377c..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64WithTruncation.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Sse.IsSupported)
- {
- try
- {
- using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }))
- {
- var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArrayPtr);
- var l2 = Sse.ConvertToInt64WithTruncation(vf1);
-
- if (l2 != ((long)floatTable.inArray[0]))
- {
- Console.WriteLine("SSE ConvertToInt64WithTruncation failed on float:");
- Console.WriteLine(l2);
- testResult = Fail;
- }
- }
- }
- catch (PlatformNotSupportedException)
- {
- if (Environment.Is64BitProcess)
- {
- testResult = Fail;
- }
- }
- }
-
- return testResult;
- }
-
- public unsafe struct TestTable<T> : IDisposable where T : struct
- {
- public T[] inArray;
-
- public void* inArrayPtr => inHandle.AddrOfPinnedObject().ToPointer();
-
- GCHandle inHandle;
- public TestTable(T[] a)
- {
- this.inArray = a;
-
- inHandle = GCHandle.Alloc(inArray, GCHandleType.Pinned);
- }
-
- public void Dispose()
- {
- inHandle.Free();
- }
- }
-
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Program.Sse.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Program.Sse.cs
index dbf3f5bf1f..533f0e3adb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Program.Sse.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Program.Sse.cs
@@ -52,6 +52,7 @@ namespace JIT.HardwareIntrinsics.X86
["CompareOrderedScalar.Single"] = CompareOrderedScalarSingle,
["CompareUnordered.Single"] = CompareUnorderedSingle,
["CompareUnorderedScalar.Single"] = CompareUnorderedScalarSingle,
+ ["ConvertScalarToVector128Single.Single"] = ConvertScalarToVector128SingleSingle,
["Divide.Single"] = DivideSingle,
["DivideScalar.Single"] = DivideScalarSingle,
["LoadVector128.Single"] = LoadVector128Single,
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Sse_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Sse_r.csproj
index c657d44de7..8205d11985 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Sse_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Sse_r.csproj
@@ -67,6 +67,7 @@
<Compile Include="CompareOrderedScalar.Single.cs" />
<Compile Include="CompareUnordered.Single.cs" />
<Compile Include="CompareUnorderedScalar.Single.cs" />
+ <Compile Include="ConvertScalarToVector128Single.Single.cs" />
<Compile Include="Divide.Single.cs" />
<Compile Include="DivideScalar.Single.cs" />
<Compile Include="LoadVector128.Single.cs" />
@@ -84,6 +85,7 @@
<Compile Include="Program.Sse.cs" />
<Compile Include="..\Shared\BooleanCmpOpTest_DataTable.cs" />
<Compile Include="..\Shared\SimpleUnOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimpleBinOpConvTest_DataTable.cs" />
<Compile Include="..\Shared\Program.cs" />
<Compile Include="..\Shared\SimpleBinOpTest_DataTable.cs" />
</ItemGroup>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Sse_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Sse_ro.csproj
index add19b5f42..5abfc839d1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/Sse_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/Sse_ro.csproj
@@ -67,6 +67,7 @@
<Compile Include="CompareOrderedScalar.Single.cs" />
<Compile Include="CompareUnordered.Single.cs" />
<Compile Include="CompareUnorderedScalar.Single.cs" />
+ <Compile Include="ConvertScalarToVector128Single.Single.cs" />
<Compile Include="Divide.Single.cs" />
<Compile Include="DivideScalar.Single.cs" />
<Compile Include="LoadVector128.Single.cs" />
@@ -86,6 +87,7 @@
<Compile Include="..\Shared\Program.cs" />
<Compile Include="..\Shared\SimpleBinOpTest_DataTable.cs" />
<Compile Include="..\Shared\SimpleUnOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimpleBinOpConvTest_DataTable.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128Double.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128Double.Double.cs
new file mode 100644
index 0000000000..0a46cd1136
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128Double.Double.cs
@@ -0,0 +1,395 @@
+// 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 ConvertScalarToVector128DoubleDouble()
+ {
+ var test = new SimpleBinaryOpConvTest__ConvertScalarToVector128DoubleDouble();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Sse2.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Sse2.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Sse2.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local class works
+ test.RunClassLclFldScenario();
+
+ // Validates passing an instance member of a class works
+ test.RunClassFldScenario();
+
+ // Validates passing the field of a local struct works
+ test.RunStructLclFldScenario();
+
+ // Validates passing an instance member of a struct works
+ test.RunStructFldScenario();
+ }
+ 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 SimpleBinaryOpConvTest__ConvertScalarToVector128DoubleDouble
+ {
+ private struct TestStruct
+ {
+ public Vector128<Double> _fld1;
+ public Int64 _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref testStruct._fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ _data2 = TestLibrary.Generator.GetInt64();
+ testStruct._fld2 = _data2;
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(SimpleBinaryOpConvTest__ConvertScalarToVector128DoubleDouble testClass)
+ {
+ var result = Sse2.X64.ConvertScalarToVector128Double(_fld1, _fld2);
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
+ }
+ }
+
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ private static Double[] _data1 = new Double[Op1ElementCount];
+ private static Int64 _data2;
+
+ private static Vector128<Double> _clsVar1;
+ private static Int64 _clsVar2;
+
+ private Vector128<Double> _fld1;
+ private Int64 _fld2;
+
+ private SimpleBinaryOpConvTest__DataTable<Double, Double, Int64> _dataTable;
+
+ static SimpleBinaryOpConvTest__ConvertScalarToVector128DoubleDouble()
+ {
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ _data2 = TestLibrary.Generator.GetInt64();
+ _clsVar2 = _data2;
+ }
+
+ public SimpleBinaryOpConvTest__ConvertScalarToVector128DoubleDouble()
+ {
+ Succeeded = true;
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ _data2 = TestLibrary.Generator.GetInt64();
+ _fld2 = _data2;
+
+ _dataTable = new SimpleBinaryOpConvTest__DataTable<Double, Double, Int64>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Sse2.X64.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
+
+ var result = Sse2.X64.ConvertScalarToVector128Double(
+ Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
+
+ var result = Sse2.X64.ConvertScalarToVector128Double(
+ Sse2.LoadVector128((Double*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
+
+ var result = Sse2.X64.ConvertScalarToVector128Double(
+ Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
+
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertScalarToVector128Double), new Type[] { typeof(Vector128<Double>), typeof(Int64) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
+
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertScalarToVector128Double), new Type[] { typeof(Vector128<Double>), typeof(Int64) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((Double*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
+
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertScalarToVector128Double), new Type[] { typeof(Vector128<Double>), typeof(Int64) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
+
+ var result = Sse2.X64.ConvertScalarToVector128Double(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
+
+ var left = Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr);
+ var right = _dataTable.inData2;
+ var result = Sse2.X64.ConvertScalarToVector128Double(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
+
+ var left = Sse2.LoadVector128((Double*)(_dataTable.inArray1Ptr));
+ var right = _dataTable.inData2;
+ var result = Sse2.X64.ConvertScalarToVector128Double(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
+
+ var left = Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray1Ptr));
+ var right = _dataTable.inData2;
+ var result = Sse2.X64.ConvertScalarToVector128Double(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunClassLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
+
+ var test = new SimpleBinaryOpConvTest__ConvertScalarToVector128DoubleDouble();
+ var result = Sse2.X64.ConvertScalarToVector128Double(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunClassFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
+
+ var result = Sse2.X64.ConvertScalarToVector128Double(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
+
+ var test = TestStruct.Create();
+ var result = Sse2.X64.ConvertScalarToVector128Double(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
+
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
+
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<Double> left, Int64 right, void* result, [CallerMemberName] string method = "")
+ {
+ Double[] inArray1 = new Double[Op1ElementCount];
+ Double[] outArray = new Double[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
+
+ ValidateResult(inArray1, right, outArray, method);
+ }
+
+ private void ValidateResult(void* left, Int64 right, void* result, [CallerMemberName] string method = "")
+ {
+ Double[] inArray1 = new Double[Op1ElementCount];
+ Double[] outArray = new Double[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
+
+ ValidateResult(inArray1, right, outArray, method);
+ }
+
+ private void ValidateResult(Double[] left, Int64 right, Double[] result, [CallerMemberName] string method = "")
+ {
+ if ((double)right != result[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != left[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse2.X64)}.{nameof(Sse2.X64.ConvertScalarToVector128Double)}<Double>(Vector128<Double>, Int64): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
+ TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertScalarToVector128Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128Int64.cs
index 4ca1586290..32d7bf1afb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertScalarToVector128Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128Int64.cs
@@ -20,19 +20,17 @@ namespace IntelHardwareIntrinsicTest
{
int testResult = Pass;
- if (Sse.IsSupported)
+ using (TestTable<long> longTable = new TestTable<long>(new long[2] { 1, -5 }, new long[2]))
{
- using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 1, -5, 100, 0 }, new float[4]))
+ if (Sse2.X64.IsSupported)
{
- var vf1 = Unsafe.Read<Vector128<float>>(floatTable.inArrayPtr);
- var vf2 = Sse.ConvertScalarToVector128Single(vf1, 5);
- Unsafe.Write(floatTable.outArrayPtr, vf2);
+ var vd = Sse2.X64.ConvertScalarToVector128Int64((long)-5);
+ Unsafe.Write(longTable.outArrayPtr, vd);
- if (!floatTable.CheckResult((x, y) => (y[0] == 5)
- && (y[1] == x[1]) && (y[2] == x[2]) && (y[3] == x[3])))
+ if (!longTable.CheckResult((x, y) => (y[0] == -5) && (y[1] == 0)))
{
- Console.WriteLine("SSE ConvertScalarToVector128Single failed on float:");
- foreach (var item in floatTable.outArray)
+ Console.WriteLine("SSE2.X64 ConvertScalarToVector128Int32 failed on long:");
+ foreach (var item in longTable.outArray)
{
Console.Write(item + ", ");
}
@@ -40,6 +38,24 @@ namespace IntelHardwareIntrinsicTest
testResult = Fail;
}
}
+ else
+ {
+ try
+ {
+ var vd = Sse2.X64.ConvertScalarToVector128Int64(-5l);
+ testResult = Fail;
+ Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.X64.ConvertScalarToVector128Int64)} failed: expected PlatformNotSupportedException exception.");
+ }
+ catch (PlatformNotSupportedException)
+ {
+
+ }
+ catch (Exception ex)
+ {
+ testResult = Fail;
+ Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.X64.ConvertScalarToVector128Int64)}-{ex} failed: expected PlatformNotSupportedException exception.");
+ }
+ }
}
return testResult;
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Int64_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128Int64_r.csproj
index ec6993425a..ec6993425a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Int64_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128Int64_r.csproj
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Int64_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128Int64_ro.csproj
index 7f54535498..7f54535498 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Int64_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128Int64_ro.csproj
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128UInt64.cs
index 361f98eaf2..96c277eaff 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128UInt64.cs
@@ -19,44 +19,40 @@ namespace IntelHardwareIntrinsicTest
static unsafe int Main(string[] args)
{
int testResult = Pass;
-
- if (Sse2.IsSupported)
+ using (TestTable<ulong> ulongTable = new TestTable<ulong>(new ulong[2], new ulong[2]))
{
- using (TestTable<ulong> ulongTable = new TestTable<ulong>(new ulong[2], new ulong[2]))
+ if (Sse2.X64.IsSupported)
{
- if (Environment.Is64BitProcess)
- {
- var vd = Sse2.ConvertScalarToVector128UInt64(0xffffffff01ul);
- Unsafe.Write(ulongTable.outArrayPtr, vd);
+ var vd = Sse2.X64.ConvertScalarToVector128UInt64(0xffffffff01ul);
+ Unsafe.Write(ulongTable.outArrayPtr, vd);
- if (!ulongTable.CheckResult((x, y) => (y[0] == 0xffffffff01ul) && (y[1] == 0)))
+ if (!ulongTable.CheckResult((x, y) => (y[0] == 0xffffffff01ul) && (y[1] == 0)))
+ {
+ Console.WriteLine("SSE2.X64 ConvertScalarToVector128Single failed on ulong:");
+ foreach (var item in ulongTable.outArray)
{
- Console.WriteLine("SSE ConvertScalarToVector128Single failed on ulong:");
- foreach (var item in ulongTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
+ Console.Write(item + ", ");
}
+ Console.WriteLine();
+ testResult = Fail;
}
- else
+ }
+ else
+ {
+ try
+ {
+ var vd = Sse2.X64.ConvertScalarToVector128UInt64((ulong)5);
+ testResult = Fail;
+ Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.X64.ConvertScalarToVector128UInt64)} failed: expected PlatformNotSupportedException exception.");
+ }
+ catch (PlatformNotSupportedException)
{
- try
- {
- var vd = Sse2.ConvertScalarToVector128UInt64((ulong)5);
- testResult = Fail;
- Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.ConvertScalarToVector128UInt64)} failed: expected PlatformNotSupportedException exception.");
- }
- catch (PlatformNotSupportedException)
- {
- }
- catch(Exception ex)
- {
- testResult = Fail;
- Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.ConvertScalarToVector128UInt64)}-{ex} failed: expected PlatformNotSupportedException exception.");
- }
+ }
+ catch (Exception ex)
+ {
+ testResult = Fail;
+ Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.X64.ConvertScalarToVector128UInt64)}-{ex} failed: expected PlatformNotSupportedException exception.");
}
}
}
@@ -93,6 +89,5 @@ namespace IntelHardwareIntrinsicTest
outHandle.Free();
}
}
-
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128UInt64_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128UInt64_r.csproj
index 4d9ff52056..4d9ff52056 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128UInt64_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128UInt64_r.csproj
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128UInt64_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128UInt64_ro.csproj
index 7228f5c9f2..7228f5c9f2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128UInt64_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertScalarToVector128UInt64_ro.csproj
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64.Vector128Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertToInt64.Vector128Double.cs
index c6952d4e86..8b43e685b9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64.Vector128Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertToInt64.Vector128Double.cs
@@ -107,7 +107,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(SimdScalarUnaryOpConvertTest__ConvertToInt64Vector128Double testClass)
{
- var result = Sse2.ConvertToInt64(_fld);
+ var result = Sse2.X64.ConvertToInt64(_fld);
testClass.ValidateResult(_fld, result);
}
}
@@ -141,7 +141,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimdScalarUnaryOpTest__DataTable<Double>(_data, LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
+ public bool IsSupported => Sse2.X64.IsSupported;
public bool Succeeded { get; set; }
@@ -149,7 +149,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Sse2.ConvertToInt64(
+ var result = Sse2.X64.ConvertToInt64(
Unsafe.Read<Vector128<Double>>(_dataTable.inArrayPtr)
);
@@ -160,7 +160,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
- var result = Sse2.ConvertToInt64(
+ var result = Sse2.X64.ConvertToInt64(
Sse2.LoadVector128((Double*)(_dataTable.inArrayPtr))
);
@@ -171,7 +171,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
- var result = Sse2.ConvertToInt64(
+ var result = Sse2.X64.ConvertToInt64(
Sse2.LoadAlignedVector128((Double*)(_dataTable.inArrayPtr))
);
@@ -182,7 +182,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertToInt64), new Type[] { typeof(Vector128<Double>) })
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertToInt64), new Type[] { typeof(Vector128<Double>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<Double>>(_dataTable.inArrayPtr)
});
@@ -194,7 +194,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
- var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertToInt64), new Type[] { typeof(Vector128<Double>) })
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertToInt64), new Type[] { typeof(Vector128<Double>) })
.Invoke(null, new object[] {
Sse2.LoadVector128((Double*)(_dataTable.inArrayPtr))
});
@@ -206,7 +206,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
- var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertToInt64), new Type[] { typeof(Vector128<Double>) })
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertToInt64), new Type[] { typeof(Vector128<Double>) })
.Invoke(null, new object[] {
Sse2.LoadAlignedVector128((Double*)(_dataTable.inArrayPtr))
});
@@ -218,7 +218,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Sse2.ConvertToInt64(
+ var result = Sse2.X64.ConvertToInt64(
_clsVar
);
@@ -230,7 +230,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector128<Double>>(_dataTable.inArrayPtr);
- var result = Sse2.ConvertToInt64(firstOp);
+ var result = Sse2.X64.ConvertToInt64(firstOp);
ValidateResult(firstOp, result);
}
@@ -240,7 +240,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = Sse2.LoadVector128((Double*)(_dataTable.inArrayPtr));
- var result = Sse2.ConvertToInt64(firstOp);
+ var result = Sse2.X64.ConvertToInt64(firstOp);
ValidateResult(firstOp, result);
}
@@ -250,7 +250,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
var firstOp = Sse2.LoadAlignedVector128((Double*)(_dataTable.inArrayPtr));
- var result = Sse2.ConvertToInt64(firstOp);
+ var result = Sse2.X64.ConvertToInt64(firstOp);
ValidateResult(firstOp, result);
}
@@ -260,7 +260,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimdScalarUnaryOpConvertTest__ConvertToInt64Vector128Double();
- var result = Sse2.ConvertToInt64(test._fld);
+ var result = Sse2.X64.ConvertToInt64(test._fld);
ValidateResult(test._fld, result);
}
@@ -269,7 +269,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Sse2.ConvertToInt64(_fld);
+ var result = Sse2.X64.ConvertToInt64(_fld);
ValidateResult(_fld, result);
}
@@ -279,7 +279,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Sse2.ConvertToInt64(test._fld);
+ var result = Sse2.X64.ConvertToInt64(test._fld);
ValidateResult(test._fld, result);
}
@@ -338,7 +338,7 @@ namespace JIT.HardwareIntrinsics.X86
if (!succeeded)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.ConvertToInt64)}<Int64>(Vector128<Double>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse2.X64)}.{nameof(Sse2.X64.ConvertToInt64)}<Int64>(Vector128<Double>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: result");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64.Vector128Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertToInt64.Vector128Int64.cs
index 50ae137bd3..452b4a0883 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64.Vector128Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertToInt64.Vector128Int64.cs
@@ -107,7 +107,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(SimdScalarUnaryOpConvertTest__ConvertToInt64Vector128Int64 testClass)
{
- var result = Sse2.ConvertToInt64(_fld);
+ var result = Sse2.X64.ConvertToInt64(_fld);
testClass.ValidateResult(_fld, result);
}
}
@@ -141,7 +141,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimdScalarUnaryOpTest__DataTable<Int64>(_data, LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
+ public bool IsSupported => Sse2.X64.IsSupported;
public bool Succeeded { get; set; }
@@ -149,7 +149,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Sse2.ConvertToInt64(
+ var result = Sse2.X64.ConvertToInt64(
Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr)
);
@@ -160,7 +160,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
- var result = Sse2.ConvertToInt64(
+ var result = Sse2.X64.ConvertToInt64(
Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr))
);
@@ -171,7 +171,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
- var result = Sse2.ConvertToInt64(
+ var result = Sse2.X64.ConvertToInt64(
Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr))
);
@@ -182,7 +182,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertToInt64), new Type[] { typeof(Vector128<Int64>) })
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertToInt64), new Type[] { typeof(Vector128<Int64>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr)
});
@@ -194,7 +194,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
- var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertToInt64), new Type[] { typeof(Vector128<Int64>) })
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertToInt64), new Type[] { typeof(Vector128<Int64>) })
.Invoke(null, new object[] {
Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr))
});
@@ -206,7 +206,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
- var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertToInt64), new Type[] { typeof(Vector128<Int64>) })
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertToInt64), new Type[] { typeof(Vector128<Int64>) })
.Invoke(null, new object[] {
Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr))
});
@@ -218,7 +218,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Sse2.ConvertToInt64(
+ var result = Sse2.X64.ConvertToInt64(
_clsVar
);
@@ -230,7 +230,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr);
- var result = Sse2.ConvertToInt64(firstOp);
+ var result = Sse2.X64.ConvertToInt64(firstOp);
ValidateResult(firstOp, result);
}
@@ -240,7 +240,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr));
- var result = Sse2.ConvertToInt64(firstOp);
+ var result = Sse2.X64.ConvertToInt64(firstOp);
ValidateResult(firstOp, result);
}
@@ -250,7 +250,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
var firstOp = Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr));
- var result = Sse2.ConvertToInt64(firstOp);
+ var result = Sse2.X64.ConvertToInt64(firstOp);
ValidateResult(firstOp, result);
}
@@ -260,7 +260,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimdScalarUnaryOpConvertTest__ConvertToInt64Vector128Int64();
- var result = Sse2.ConvertToInt64(test._fld);
+ var result = Sse2.X64.ConvertToInt64(test._fld);
ValidateResult(test._fld, result);
}
@@ -269,7 +269,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Sse2.ConvertToInt64(_fld);
+ var result = Sse2.X64.ConvertToInt64(_fld);
ValidateResult(_fld, result);
}
@@ -279,7 +279,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Sse2.ConvertToInt64(test._fld);
+ var result = Sse2.X64.ConvertToInt64(test._fld);
ValidateResult(test._fld, result);
}
@@ -338,7 +338,7 @@ namespace JIT.HardwareIntrinsics.X86
if (!succeeded)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.ConvertToInt64)}<Int64>(Vector128<Int64>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse2.X64)}.{nameof(Sse2.X64.ConvertToInt64)}<Int64>(Vector128<Int64>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: result");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64WithTruncation.Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertToInt64WithTruncation.Vector128Double.cs
index 18511d44a4..5d98c754c9 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64WithTruncation.Int64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertToInt64WithTruncation.Vector128Double.cs
@@ -19,11 +19,11 @@ namespace JIT.HardwareIntrinsics.X86
{
public static partial class Program
{
- private static void ConvertToInt64WithTruncationInt64Vector128Double()
+ private static void ConvertToInt64WithTruncationVector128Double()
{
- var test = new SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationInt64Vector128Double();
+ var test = new SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationVector128Double();
- if (test.IsSupported && (Environment.Is64BitProcess))
+ if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
@@ -89,7 +89,7 @@ namespace JIT.HardwareIntrinsics.X86
}
}
- public sealed unsafe class SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationInt64Vector128Double
+ public sealed unsafe class SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationVector128Double
{
private struct TestStruct
{
@@ -105,9 +105,9 @@ namespace JIT.HardwareIntrinsics.X86
return testStruct;
}
- public void RunStructFldScenario(SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationInt64Vector128Double testClass)
+ public void RunStructFldScenario(SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationVector128Double testClass)
{
- var result = Sse2.ConvertToInt64WithTruncation(_fld);
+ var result = Sse2.X64.ConvertToInt64WithTruncation(_fld);
testClass.ValidateResult(_fld, result);
}
}
@@ -124,13 +124,13 @@ namespace JIT.HardwareIntrinsics.X86
private SimdScalarUnaryOpTest__DataTable<Double> _dataTable;
- static SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationInt64Vector128Double()
+ static SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationVector128Double()
{
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar), ref Unsafe.As<Double, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
}
- public SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationInt64Vector128Double()
+ public SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationVector128Double()
{
Succeeded = true;
@@ -141,7 +141,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimdScalarUnaryOpTest__DataTable<Double>(_data, LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported;
+ public bool IsSupported => Sse2.X64.IsSupported;
public bool Succeeded { get; set; }
@@ -149,7 +149,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Sse2.ConvertToInt64WithTruncation(
+ var result = Sse2.X64.ConvertToInt64WithTruncation(
Unsafe.Read<Vector128<Double>>(_dataTable.inArrayPtr)
);
@@ -160,7 +160,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
- var result = Sse2.ConvertToInt64WithTruncation(
+ var result = Sse2.X64.ConvertToInt64WithTruncation(
Sse2.LoadVector128((Double*)(_dataTable.inArrayPtr))
);
@@ -171,7 +171,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
- var result = Sse2.ConvertToInt64WithTruncation(
+ var result = Sse2.X64.ConvertToInt64WithTruncation(
Sse2.LoadAlignedVector128((Double*)(_dataTable.inArrayPtr))
);
@@ -182,7 +182,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertToInt64WithTruncation), new Type[] { typeof(Vector128<Double>) })
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertToInt64WithTruncation), new Type[] { typeof(Vector128<Double>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<Double>>(_dataTable.inArrayPtr)
});
@@ -194,7 +194,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
- var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertToInt64WithTruncation), new Type[] { typeof(Vector128<Double>) })
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertToInt64WithTruncation), new Type[] { typeof(Vector128<Double>) })
.Invoke(null, new object[] {
Sse2.LoadVector128((Double*)(_dataTable.inArrayPtr))
});
@@ -206,7 +206,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
- var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertToInt64WithTruncation), new Type[] { typeof(Vector128<Double>) })
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertToInt64WithTruncation), new Type[] { typeof(Vector128<Double>) })
.Invoke(null, new object[] {
Sse2.LoadAlignedVector128((Double*)(_dataTable.inArrayPtr))
});
@@ -218,7 +218,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Sse2.ConvertToInt64WithTruncation(
+ var result = Sse2.X64.ConvertToInt64WithTruncation(
_clsVar
);
@@ -230,7 +230,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector128<Double>>(_dataTable.inArrayPtr);
- var result = Sse2.ConvertToInt64WithTruncation(firstOp);
+ var result = Sse2.X64.ConvertToInt64WithTruncation(firstOp);
ValidateResult(firstOp, result);
}
@@ -240,7 +240,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = Sse2.LoadVector128((Double*)(_dataTable.inArrayPtr));
- var result = Sse2.ConvertToInt64WithTruncation(firstOp);
+ var result = Sse2.X64.ConvertToInt64WithTruncation(firstOp);
ValidateResult(firstOp, result);
}
@@ -250,7 +250,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
var firstOp = Sse2.LoadAlignedVector128((Double*)(_dataTable.inArrayPtr));
- var result = Sse2.ConvertToInt64WithTruncation(firstOp);
+ var result = Sse2.X64.ConvertToInt64WithTruncation(firstOp);
ValidateResult(firstOp, result);
}
@@ -259,8 +259,8 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
- var test = new SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationInt64Vector128Double();
- var result = Sse2.ConvertToInt64WithTruncation(test._fld);
+ var test = new SimdScalarUnaryOpConvertTest__ConvertToInt64WithTruncationVector128Double();
+ var result = Sse2.X64.ConvertToInt64WithTruncation(test._fld);
ValidateResult(test._fld, result);
}
@@ -269,7 +269,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Sse2.ConvertToInt64WithTruncation(_fld);
+ var result = Sse2.X64.ConvertToInt64WithTruncation(_fld);
ValidateResult(_fld, result);
}
@@ -279,7 +279,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Sse2.ConvertToInt64WithTruncation(test._fld);
+ var result = Sse2.X64.ConvertToInt64WithTruncation(test._fld);
ValidateResult(test._fld, result);
}
@@ -296,7 +296,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
- Succeeded = false;
+ bool succeeded = false;
try
{
@@ -304,7 +304,12 @@ namespace JIT.HardwareIntrinsics.X86
}
catch (PlatformNotSupportedException)
{
- Succeeded = true;
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
}
}
@@ -324,17 +329,21 @@ namespace JIT.HardwareIntrinsics.X86
private void ValidateResult(Double[] firstOp, Int64 result, [CallerMemberName] string method = "")
{
- if ((long) firstOp[0] != result)
+ bool succeeded = true;
+
+ if ((long)firstOp[0] != result)
{
- Succeeded = false;
+ succeeded = false;
}
- if (!Succeeded)
+ if (!succeeded)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.ConvertToInt64WithTruncation)}<Int64>(Vector128<Double>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse2.X64)}.{nameof(Sse2.X64.ConvertToInt64WithTruncation)}<Int64>(Vector128<Double>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: result");
TestLibrary.TestFramework.LogInformation(string.Empty);
+
+ Succeeded = false;
}
}
}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertToUInt64.Vector128UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertToUInt64.Vector128UInt64.cs
new file mode 100644
index 0000000000..dd8907984f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/ConvertToUInt64.Vector128UInt64.cs
@@ -0,0 +1,350 @@
+// 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 ConvertToUInt64Vector128UInt64()
+ {
+ var test = new SimdScalarUnaryOpConvertTest__ConvertToUInt64Vector128UInt64();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Sse2.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Sse2.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Sse2.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local class works
+ test.RunClassLclFldScenario();
+
+ // Validates passing an instance member of a class works
+ test.RunClassFldScenario();
+
+ // Validates passing the field of a local struct works
+ test.RunStructLclFldScenario();
+
+ // Validates passing an instance member of a struct works
+ test.RunStructFldScenario();
+ }
+ 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 SimdScalarUnaryOpConvertTest__ConvertToUInt64Vector128UInt64
+ {
+ private struct TestStruct
+ {
+ public Vector128<UInt64> _fld;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref testStruct._fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(SimdScalarUnaryOpConvertTest__ConvertToUInt64Vector128UInt64 testClass)
+ {
+ var result = Sse2.X64.ConvertToUInt64(_fld);
+ testClass.ValidateResult(_fld, result);
+ }
+ }
+
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64);
+
+ private static UInt64[] _data = new UInt64[Op1ElementCount];
+
+ private static Vector128<UInt64> _clsVar;
+
+ private Vector128<UInt64> _fld;
+
+ private SimdScalarUnaryOpTest__DataTable<UInt64> _dataTable;
+
+ static SimdScalarUnaryOpConvertTest__ConvertToUInt64Vector128UInt64()
+ {
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _clsVar), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ }
+
+ public SimdScalarUnaryOpConvertTest__ConvertToUInt64Vector128UInt64()
+ {
+ Succeeded = true;
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt64>, byte>(ref _fld), ref Unsafe.As<UInt64, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt64(); }
+ _dataTable = new SimdScalarUnaryOpTest__DataTable<UInt64>(_data, LargestVectorSize);
+ }
+
+ public bool IsSupported => Sse2.X64.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
+
+ var result = Sse2.X64.ConvertToUInt64(
+ Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr)
+ );
+
+ ValidateResult(_dataTable.inArrayPtr, result);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
+
+ var result = Sse2.X64.ConvertToUInt64(
+ Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr))
+ );
+
+ ValidateResult(_dataTable.inArrayPtr, result);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
+
+ var result = Sse2.X64.ConvertToUInt64(
+ Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr))
+ );
+
+ ValidateResult(_dataTable.inArrayPtr, result);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
+
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertToUInt64), new Type[] { typeof(Vector128<UInt64>) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr)
+ });
+
+ ValidateResult(_dataTable.inArrayPtr, (UInt64)(result));
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
+
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertToUInt64), new Type[] { typeof(Vector128<UInt64>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr))
+ });
+
+ ValidateResult(_dataTable.inArrayPtr, (UInt64)(result));
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
+
+ var result = typeof(Sse2.X64).GetMethod(nameof(Sse2.X64.ConvertToUInt64), new Type[] { typeof(Vector128<UInt64>) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr))
+ });
+
+ ValidateResult(_dataTable.inArrayPtr, (UInt64)(result));
+ }
+
+ public void RunClsVarScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
+
+ var result = Sse2.X64.ConvertToUInt64(
+ _clsVar
+ );
+
+ ValidateResult(_clsVar, result);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
+
+ var firstOp = Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr);
+ var result = Sse2.X64.ConvertToUInt64(firstOp);
+
+ ValidateResult(firstOp, result);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
+
+ var firstOp = Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr));
+ var result = Sse2.X64.ConvertToUInt64(firstOp);
+
+ ValidateResult(firstOp, result);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
+
+ var firstOp = Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr));
+ var result = Sse2.X64.ConvertToUInt64(firstOp);
+
+ ValidateResult(firstOp, result);
+ }
+
+ public void RunClassLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
+
+ var test = new SimdScalarUnaryOpConvertTest__ConvertToUInt64Vector128UInt64();
+ var result = Sse2.X64.ConvertToUInt64(test._fld);
+
+ ValidateResult(test._fld, result);
+ }
+
+ public void RunClassFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
+
+ var result = Sse2.X64.ConvertToUInt64(_fld);
+
+ ValidateResult(_fld, result);
+ }
+
+ public void RunStructLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
+
+ var test = TestStruct.Create();
+ var result = Sse2.X64.ConvertToUInt64(test._fld);
+
+ ValidateResult(test._fld, result);
+ }
+
+ public void RunStructFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
+
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
+
+ bool succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ succeeded = true;
+ }
+
+ if (!succeeded)
+ {
+ Succeeded = false;
+ }
+ }
+
+ private void ValidateResult(Vector128<UInt64> firstOp, UInt64 result, [CallerMemberName] string method = "")
+ {
+ UInt64[] inArray = new UInt64[Op1ElementCount];
+ Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), firstOp);
+ ValidateResult(inArray, result, method);
+ }
+
+ private void ValidateResult(void* firstOp, UInt64 result, [CallerMemberName] string method = "")
+ {
+ UInt64[] inArray = new UInt64[Op1ElementCount];
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt64>>());
+ ValidateResult(inArray, result, method);
+ }
+
+ private void ValidateResult(UInt64[] firstOp, UInt64 result, [CallerMemberName] string method = "")
+ {
+ bool succeeded = true;
+
+ if (firstOp[0] != result)
+ {
+ succeeded = false;
+ }
+
+ if (!succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse2.X64)}.{nameof(Sse2.X64.ConvertToUInt64)}<UInt64>(Vector128<UInt64>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
+ TestLibrary.TestFramework.LogInformation($" result: result");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+
+ Succeeded = false;
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/Program.Sse2.X64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/Program.Sse2.X64.cs
new file mode 100644
index 0000000000..dc0895797f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/Program.Sse2.X64.cs
@@ -0,0 +1,23 @@
+// 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.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["ConvertToInt64.Vector128Double"] = ConvertToInt64Vector128Double,
+ ["ConvertToInt64.Vector128Int64"] = ConvertToInt64Vector128Int64,
+ ["ConvertToUInt64.Vector128UInt64"] = ConvertToUInt64Vector128UInt64,
+ ["ConvertToInt64WithTruncation.Vector128Double"] = ConvertToInt64WithTruncationVector128Double,
+ ["ConvertScalarToVector128Double.Double"] = ConvertScalarToVector128DoubleDouble,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/Sse2.X64_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/Sse2.X64_r.csproj
new file mode 100644
index 0000000000..3cdfdfa8ef
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/Sse2.X64_r.csproj
@@ -0,0 +1,42 @@
+<?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>Embedded</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ConvertToInt64.Vector128Double.cs" />
+ <Compile Include="ConvertToInt64.Vector128Int64.cs" />
+ <Compile Include="ConvertToUInt64.Vector128UInt64.cs" />
+ <Compile Include="ConvertToInt64WithTruncation.Vector128Double.cs" />
+ <Compile Include="ConvertScalarToVector128Double.Double.cs" />
+ <Compile Include="..\Shared\SimpleBinOpConvTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimdScalarUnOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ <Compile Include="Program.Sse2.X64.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/Sse2.X64_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/Sse2.X64_ro.csproj
new file mode 100644
index 0000000000..86d895688f
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/Sse2.X64_ro.csproj
@@ -0,0 +1,42 @@
+<?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>Embedded</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ConvertToInt64.Vector128Double.cs" />
+ <Compile Include="ConvertToInt64.Vector128Int64.cs" />
+ <Compile Include="ConvertToUInt64.Vector128UInt64.cs" />
+ <Compile Include="ConvertToInt64WithTruncation.Vector128Double.cs" />
+ <Compile Include="ConvertScalarToVector128Double.Double.cs" />
+ <Compile Include="..\Shared\SimpleBinOpConvTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimdScalarUnOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ <Compile Include="Program.Sse2.X64.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/StoreNonTemporal.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/StoreNonTemporal.cs
new file mode 100644
index 0000000000..6e80f93034
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/StoreNonTemporal.cs
@@ -0,0 +1,120 @@
+// 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.X64.IsSupported)
+ {
+ {
+ long* inArray = stackalloc long[2];
+ inArray[0] = 0xffffffff01l;
+ long* outBuffer = stackalloc long[2];
+
+ Sse2.X64.StoreNonTemporal(outBuffer, inArray[0]);
+
+ for (var i = 0; i < 2; i++)
+ {
+ if (inArray[i] != outBuffer[i])
+ {
+ Console.WriteLine("Sse2 StoreNonTemporal failed on long:");
+ for (var n = 0; n < 2; n++)
+ {
+ Console.Write(outBuffer[n] + ", ");
+ }
+ Console.WriteLine();
+
+ testResult = Fail;
+ break;
+ }
+ }
+ }
+
+ {
+ ulong* inArray = stackalloc ulong[2];
+ inArray[0] = 0xffffffffff01ul;
+ ulong* outBuffer = stackalloc ulong[2];
+
+ Sse2.X64.StoreNonTemporal(outBuffer, inArray[0]);
+
+ for (var i = 0; i < 2; i++)
+ {
+ if (inArray[i] != outBuffer[i])
+ {
+ Console.WriteLine("Sse2 StoreNonTemporal failed on ulong:");
+ for (var n = 0; n < 2; n++)
+ {
+ Console.Write(outBuffer[n] + ", ");
+ }
+ Console.WriteLine();
+
+ testResult = Fail;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ try
+ {
+ long* inArray = stackalloc long[2];
+ inArray[0] = 0xffffffff01l;
+ long* outBuffer = stackalloc long[2];
+
+ Sse2.X64.StoreNonTemporal(outBuffer, inArray[0]);
+ testResult = Fail;
+ Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.X64.StoreNonTemporal)} failed on long: expected PlatformNotSupportedException exception.");
+ }
+ catch (PlatformNotSupportedException)
+ {
+
+ }
+ catch (Exception ex)
+ {
+ testResult = Fail;
+ Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.X64.StoreNonTemporal)}-{ex} failed on long: expected PlatformNotSupportedException exception.");
+ }
+
+ try
+ {
+ ulong* inArray = stackalloc ulong[2];
+ inArray[0] = 0xffffffffff01ul;
+ ulong* outBuffer = stackalloc ulong[2];
+
+ Sse2.X64.StoreNonTemporal(outBuffer, inArray[0]);
+ testResult = Fail;
+ Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.X64.StoreNonTemporal)} failed on ulong: expected PlatformNotSupportedException exception.");
+ }
+ catch (PlatformNotSupportedException)
+ {
+
+ }
+ catch (Exception ex)
+ {
+ testResult = Fail;
+ Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.X64.StoreNonTemporal)}-{ex} failed on ulong: expected PlatformNotSupportedException exception.");
+ }
+ }
+
+ return testResult;
+ }
+ }
+}
+
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/StoreNonTemporal_r.csproj
index 5616341ac0..ba23807d59 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/StoreNonTemporal_r.csproj
@@ -27,8 +27,8 @@
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
- <Compile Include="ConvertToInt64.cs" />
+ <Compile Include="StoreNonTemporal.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/StoreNonTemporal_ro.csproj
index 4d1c7f0b03..0e525a3dea 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/ConvertToInt64_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2.X64/StoreNonTemporal_ro.csproj
@@ -27,8 +27,8 @@
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
- <Compile Include="ConvertToInt64.cs" />
+ <Compile Include="StoreNonTemporal.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
-</Project>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Double.Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Double.Double.cs
new file mode 100644
index 0000000000..98fbf0647d
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Double.Double.cs
@@ -0,0 +1,395 @@
+// 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 ConvertScalarToVector128DoubleDouble()
+ {
+ var test = new SimpleBinaryOpConvTest__ConvertScalarToVector128DoubleDouble();
+
+ if (test.IsSupported)
+ {
+ // Validates basic functionality works, using Unsafe.Read
+ test.RunBasicScenario_UnsafeRead();
+
+ if (Sse2.IsSupported)
+ {
+ // Validates basic functionality works, using Load
+ test.RunBasicScenario_Load();
+
+ // Validates basic functionality works, using LoadAligned
+ test.RunBasicScenario_LoadAligned();
+ }
+
+ // Validates calling via reflection works, using Unsafe.Read
+ test.RunReflectionScenario_UnsafeRead();
+
+ if (Sse2.IsSupported)
+ {
+ // Validates calling via reflection works, using Load
+ test.RunReflectionScenario_Load();
+
+ // Validates calling via reflection works, using LoadAligned
+ test.RunReflectionScenario_LoadAligned();
+ }
+
+ // Validates passing a static member works
+ test.RunClsVarScenario();
+
+ // Validates passing a local works, using Unsafe.Read
+ test.RunLclVarScenario_UnsafeRead();
+
+ if (Sse2.IsSupported)
+ {
+ // Validates passing a local works, using Load
+ test.RunLclVarScenario_Load();
+
+ // Validates passing a local works, using LoadAligned
+ test.RunLclVarScenario_LoadAligned();
+ }
+
+ // Validates passing the field of a local class works
+ test.RunClassLclFldScenario();
+
+ // Validates passing an instance member of a class works
+ test.RunClassFldScenario();
+
+ // Validates passing the field of a local struct works
+ test.RunStructLclFldScenario();
+
+ // Validates passing an instance member of a struct works
+ test.RunStructFldScenario();
+ }
+ 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 SimpleBinaryOpConvTest__ConvertScalarToVector128DoubleDouble
+ {
+ private struct TestStruct
+ {
+ public Vector128<Double> _fld1;
+ public Int32 _fld2;
+
+ public static TestStruct Create()
+ {
+ var testStruct = new TestStruct();
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref testStruct._fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ _data2 = TestLibrary.Generator.GetInt32();
+ testStruct._fld2 = _data2;
+ return testStruct;
+ }
+
+ public void RunStructFldScenario(SimpleBinaryOpConvTest__ConvertScalarToVector128DoubleDouble testClass)
+ {
+ var result = Sse2.ConvertScalarToVector128Double(_fld1, _fld2);
+
+ Unsafe.Write(testClass._dataTable.outArrayPtr, result);
+ testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
+ }
+ }
+
+ private static readonly int LargestVectorSize = 16;
+
+ private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+ private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
+
+ private static Double[] _data1 = new Double[Op1ElementCount];
+ private static Int32 _data2;
+
+ private static Vector128<Double> _clsVar1;
+ private static Int32 _clsVar2;
+
+ private Vector128<Double> _fld1;
+ private Int32 _fld2;
+
+ private SimpleBinaryOpConvTest__DataTable<Double, Double, Int32> _dataTable;
+
+ static SimpleBinaryOpConvTest__ConvertScalarToVector128DoubleDouble()
+ {
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ _data2 = TestLibrary.Generator.GetInt32();
+ _clsVar2 = _data2;
+ }
+
+ public SimpleBinaryOpConvTest__ConvertScalarToVector128DoubleDouble()
+ {
+ Succeeded = true;
+
+ for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ _data2 = TestLibrary.Generator.GetInt32();
+ _fld2 = _data2;
+
+ _dataTable = new SimpleBinaryOpConvTest__DataTable<Double, Double, Int32>(_data1, _data2, new Double[RetElementCount], LargestVectorSize);
+ }
+
+ public bool IsSupported => Sse2.IsSupported;
+
+ public bool Succeeded { get; set; }
+
+ public void RunBasicScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
+
+ var result = Sse2.ConvertScalarToVector128Double(
+ Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
+
+ var result = Sse2.ConvertScalarToVector128Double(
+ Sse2.LoadVector128((Double*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunBasicScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
+
+ var result = Sse2.ConvertScalarToVector128Double(
+ Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
+
+ var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertScalarToVector128Double), new Type[] { typeof(Vector128<Double>), typeof(Int32) })
+ .Invoke(null, new object[] {
+ Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
+
+ var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertScalarToVector128Double), new Type[] { typeof(Vector128<Double>), typeof(Int32) })
+ .Invoke(null, new object[] {
+ Sse2.LoadVector128((Double*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunReflectionScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
+
+ var result = typeof(Sse2).GetMethod(nameof(Sse2.ConvertScalarToVector128Double), new Type[] { typeof(Vector128<Double>), typeof(Int32) })
+ .Invoke(null, new object[] {
+ Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray1Ptr)),
+ _dataTable.inData2
+ });
+
+ Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result));
+ ValidateResult(_dataTable.inArray1Ptr, _dataTable.inData2, _dataTable.outArrayPtr);
+ }
+
+ public void RunClsVarScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
+
+ var result = Sse2.ConvertScalarToVector128Double(
+ _clsVar1,
+ _clsVar2
+ );
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_UnsafeRead()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
+
+ var left = Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr);
+ var right = _dataTable.inData2;
+ var result = Sse2.ConvertScalarToVector128Double(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_Load()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
+
+ var left = Sse2.LoadVector128((Double*)(_dataTable.inArray1Ptr));
+ var right = _dataTable.inData2;
+ var result = Sse2.ConvertScalarToVector128Double(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunLclVarScenario_LoadAligned()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
+
+ var left = Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray1Ptr));
+ var right = _dataTable.inData2;
+ var result = Sse2.ConvertScalarToVector128Double(left, right);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(left, right, _dataTable.outArrayPtr);
+ }
+
+ public void RunClassLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
+
+ var test = new SimpleBinaryOpConvTest__ConvertScalarToVector128DoubleDouble();
+ var result = Sse2.ConvertScalarToVector128Double(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunClassFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
+
+ var result = Sse2.ConvertScalarToVector128Double(_fld1, _fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructLclFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
+
+ var test = TestStruct.Create();
+ var result = Sse2.ConvertScalarToVector128Double(test._fld1, test._fld2);
+
+ Unsafe.Write(_dataTable.outArrayPtr, result);
+ ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
+ }
+
+ public void RunStructFldScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
+
+ var test = TestStruct.Create();
+ test.RunStructFldScenario(this);
+ }
+
+ public void RunUnsupportedScenario()
+ {
+ TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
+
+ Succeeded = false;
+
+ try
+ {
+ RunBasicScenario_UnsafeRead();
+ }
+ catch (PlatformNotSupportedException)
+ {
+ Succeeded = true;
+ }
+ }
+
+ private void ValidateResult(Vector128<Double> left, Int32 right, void* result, [CallerMemberName] string method = "")
+ {
+ Double[] inArray1 = new Double[Op1ElementCount];
+ Double[] outArray = new Double[RetElementCount];
+
+ Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), left);
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
+
+ ValidateResult(inArray1, right, outArray, method);
+ }
+
+ private void ValidateResult(void* left, Int32 right, void* result, [CallerMemberName] string method = "")
+ {
+ Double[] inArray1 = new Double[Op1ElementCount];
+ Double[] outArray = new Double[RetElementCount];
+
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<Double>>());
+ Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
+
+ ValidateResult(inArray1, right, outArray, method);
+ }
+
+ private void ValidateResult(Double[] left, Int32 right, Double[] result, [CallerMemberName] string method = "")
+ {
+ if ((double)right != result[0])
+ {
+ Succeeded = false;
+ }
+ else
+ {
+ for (var i = 1; i < RetElementCount; i++)
+ {
+ if (result[i] != left[i])
+ {
+ Succeeded = false;
+ break;
+ }
+ }
+ }
+
+ if (!Succeeded)
+ {
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.ConvertScalarToVector128Double)}<Double>(Vector128<Double>, Int32): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
+ TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
+ TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
+ TestLibrary.TestFramework.LogInformation(string.Empty);
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Double.cs
index 9721f9c094..3e5aa8fed2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Double.cs
@@ -22,41 +22,6 @@ namespace IntelHardwareIntrinsicTest
if (Sse2.IsSupported)
{
- using (TestTable<double> doubleTable = new TestTable<double>(new double[2] { 1, -5 }, new double[2]))
- {
- var vf1 = Unsafe.Read<Vector128<double>>(doubleTable.inArrayPtr);
- var vf2 = Sse2.ConvertScalarToVector128Double(vf1, 5);
- Unsafe.Write(doubleTable.outArrayPtr, vf2);
-
- if (!doubleTable.CheckResult((x, y) => (y[0] == 5) && (y[1] == x[1])))
- {
- Console.WriteLine("SSE2 ConvertScalarToVector128Double failed on int:");
- foreach (var item in doubleTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
-
- using (TestTable<double> doubleTable = new TestTable<double>(new double[2] { 1, -5 }, new double[2]))
- {
- var vf1 = Unsafe.Read<Vector128<double>>(doubleTable.inArrayPtr);
- var vf2 = Sse2.ConvertScalarToVector128Double(vf1, 7);
- Unsafe.Write(doubleTable.outArrayPtr, vf2);
-
- if (!doubleTable.CheckResult((x, y) => (y[0] == 7) && (y[1] == x[1])))
- {
- Console.WriteLine("SSE2 ConvertScalarToVector128Double failed on long:");
- foreach (var item in doubleTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
using (TestTable<double> doubleTable = new TestTable<double>(new double[2] { 1, -5 }, new double[2]))
using (TestTable<float> floatTable = new TestTable<float>(new float[4] { 3, -11, 7, 49 }, new float[4]))
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Int64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Int64.cs
deleted file mode 100644
index 5ee35f0c17..0000000000
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertScalarToVector128Int64.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Intrinsics.X86;
-using System.Runtime.Intrinsics;
-
-namespace IntelHardwareIntrinsicTest
-{
- class Program
- {
- const int Pass = 100;
- const int Fail = 0;
-
- static unsafe int Main(string[] args)
- {
- int testResult = Pass;
-
- if (Sse2.IsSupported)
- {
- using (TestTable<long> longTable = new TestTable<long>(new long[2] { 1, -5 }, new long[2]))
- {
- if (Environment.Is64BitProcess)
- {
- var vd = Sse2.ConvertScalarToVector128Int64((long)-5);
- Unsafe.Write(longTable.outArrayPtr, vd);
-
- if (!longTable.CheckResult((x, y) => (y[0] == -5) && (y[1] == 0)))
- {
- Console.WriteLine("SSE2 ConvertScalarToVector128Int32 failed on long:");
- foreach (var item in longTable.outArray)
- {
- Console.Write(item + ", ");
- }
- Console.WriteLine();
- testResult = Fail;
- }
- }
- else
- {
- try
- {
- var vd = Sse2.ConvertScalarToVector128Int64(-5l);
- testResult = Fail;
- Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.ConvertScalarToVector128Int64)} failed: expected PlatformNotSupportedException exception.");
- }
- catch (PlatformNotSupportedException)
- {
-
- }
- catch(Exception ex)
- {
- testResult = Fail;
- Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.ConvertScalarToVector128Int64)}-{ex} failed: expected PlatformNotSupportedException exception.");
- }
- }
- }
- }
-
- return testResult;
- }
-
- public unsafe struct TestTable<T> : 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<T[], T[], bool> check)
- {
- return check(inArray, outArray);
- }
-
- public void Dispose()
- {
- inHandle.Free();
- outHandle.Free();
- }
- }
-
- }
-}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32.Vector128Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32.Vector128Double.cs
index 284e0577a4..cb0e95f770 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32.Vector128Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32.Vector128Double.cs
@@ -141,7 +141,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimdScalarUnaryOpTest__DataTable<Double>(_data, LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32.Vector128Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32.Vector128Int32.cs
index 0667343e1d..6038b0a096 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32.Vector128Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32.Vector128Int32.cs
@@ -141,7 +141,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimdScalarUnaryOpTest__DataTable<Int32>(_data, LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32WithTruncation.Vector128Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32WithTruncation.Vector128Double.cs
index 8dd705f37a..62ec521043 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32WithTruncation.Vector128Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32WithTruncation.Vector128Double.cs
@@ -141,7 +141,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimdScalarUnaryOpTest__DataTable<Double>(_data, LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64WithTruncation.Vector128Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64WithTruncation.Vector128Double.cs
index 8b423b71c5..54b1228103 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64WithTruncation.Vector128Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt64WithTruncation.Vector128Double.cs
@@ -141,7 +141,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimdScalarUnaryOpTest__DataTable<Double>(_data, LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToUInt32.Vector128UInt32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToUInt32.Vector128UInt32.cs
index 40877c3523..1715e186e1 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToUInt32.Vector128UInt32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToUInt32.Vector128UInt32.cs
@@ -141,7 +141,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimdScalarUnaryOpTest__DataTable<UInt32>(_data, LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt32) != typeof(long)) && (typeof(UInt32) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToUInt64.Vector128UInt64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToUInt64.Vector128UInt64.cs
index 31df382653..04e52013e4 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToUInt64.Vector128UInt64.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToUInt64.Vector128UInt64.cs
@@ -141,7 +141,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimdScalarUnaryOpTest__DataTable<UInt64>(_data, LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Double.Vector128Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Double.Vector128Int32.cs
index 7e023ed2e5..4b0c941914 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Double.Vector128Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Double.Vector128Int32.cs
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<Double, Int32>(_data, new Double[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Double) != typeof(long)) && (typeof(Double) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Double.Vector128Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Double.Vector128Single.cs
index b297c8dec7..56dac09c67 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Double.Vector128Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Double.Vector128Single.cs
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<Double, Single>(_data, new Double[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Double) != typeof(long)) && (typeof(Double) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32.Vector128Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32.Vector128Double.cs
index ea30c1c6f3..6da4e4ac84 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32.Vector128Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32.Vector128Double.cs
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<Int32, Double>(_data, new Int32[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32.Vector128Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32.Vector128Single.cs
index 2271c5bbec..00a9f77177 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32.Vector128Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32.Vector128Single.cs
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<Int32, Single>(_data, new Int32[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32WithTruncation.Vector128Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32WithTruncation.Vector128Double.cs
index a5e2e287f2..2d9416214b 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32WithTruncation.Vector128Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32WithTruncation.Vector128Double.cs
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<Int32, Double>(_data, new Int32[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32WithTruncation.Vector128Single.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32WithTruncation.Vector128Single.cs
index 2b28c6eee7..af10716f83 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32WithTruncation.Vector128Single.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Int32WithTruncation.Vector128Single.cs
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<Int32, Single>(_data, new Int32[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Int32) != typeof(long)) && (typeof(Int32) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Single.Vector128Double.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Single.Vector128Double.cs
index 186574c828..fd18c5f958 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Single.Vector128Double.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Single.Vector128Double.cs
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<Single, Double>(_data, new Single[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Single) != typeof(long)) && (typeof(Single) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Single.Vector128Int32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Single.Vector128Int32.cs
index 33afc005f5..f1396a9b97 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Single.Vector128Int32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/ConvertToVector128Single.Vector128Int32.cs
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<Single, Int32>(_data, new Single[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse2.IsSupported && (Environment.Is64BitProcess || ((typeof(Single) != typeof(long)) && (typeof(Single) != typeof(ulong))));
+ public bool IsSupported => Sse2.IsSupported;
public bool Succeeded { get; set; }
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Program.Sse2.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Program.Sse2.cs
index b572b56202..61a501d379 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Program.Sse2.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Program.Sse2.cs
@@ -97,11 +97,7 @@ namespace JIT.HardwareIntrinsics.X86
["ConvertToInt32.Vector128Double"] = ConvertToInt32Vector128Double,
["ConvertToInt32.Vector128Int32"] = ConvertToInt32Vector128Int32,
["ConvertToInt32WithTruncation.Vector128Double"] = ConvertToInt32WithTruncationVector128Double,
- ["ConvertToInt64.Vector128Double"] = ConvertToInt64Vector128Double,
- ["ConvertToInt64.Vector128Int64"] = ConvertToInt64Vector128Int64,
- ["ConvertToInt64WithTruncation.Vector128Double"] = ConvertToInt64WithTruncationVector128Double,
["ConvertToUInt32.Vector128UInt32"] = ConvertToUInt32Vector128UInt32,
- ["ConvertToUInt64.Vector128UInt64"] = ConvertToUInt64Vector128UInt64,
["ConvertToVector128Double.Vector128Single"] = ConvertToVector128DoubleVector128Single,
["ConvertToVector128Double.Vector128Int32"] = ConvertToVector128DoubleVector128Int32,
["ConvertToVector128Int32.Vector128Double"] = ConvertToVector128Int32Vector128Double,
@@ -110,6 +106,7 @@ namespace JIT.HardwareIntrinsics.X86
["ConvertToVector128Int32WithTruncation.Vector128Single"] = ConvertToVector128Int32WithTruncationVector128Single,
["ConvertToVector128Single.Vector128Double"] = ConvertToVector128SingleVector128Double,
["ConvertToVector128Single.Vector128Int32"] = ConvertToVector128SingleVector128Int32,
+ ["ConvertScalarToVector128Double.Double"] = ConvertScalarToVector128DoubleDouble,
["Divide.Double"] = DivideDouble,
["DivideScalar.Double"] = DivideScalarDouble,
["Extract.UInt16.1"] = ExtractUInt161,
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_r.csproj
index f99644c6a2..fb6dd081b6 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_r.csproj
@@ -112,11 +112,7 @@
<Compile Include="ConvertToInt32.Vector128Double.cs" />
<Compile Include="ConvertToInt32.Vector128Int32.cs" />
<Compile Include="ConvertToInt32WithTruncation.Vector128Double.cs" />
- <Compile Include="ConvertToInt64.Vector128Double.cs" />
- <Compile Include="ConvertToInt64.Vector128Int64.cs" />
- <Compile Include="ConvertToInt64WithTruncation.Vector128Double.cs" />
<Compile Include="ConvertToUInt32.Vector128UInt32.cs" />
- <Compile Include="ConvertToUInt64.Vector128UInt64.cs" />
<Compile Include="ConvertToVector128Double.Vector128Single.cs" />
<Compile Include="ConvertToVector128Double.Vector128Int32.cs" />
<Compile Include="ConvertToVector128Int32.Vector128Double.cs" />
@@ -125,6 +121,7 @@
<Compile Include="ConvertToVector128Int32WithTruncation.Vector128Single.cs" />
<Compile Include="ConvertToVector128Single.Vector128Double.cs" />
<Compile Include="ConvertToVector128Single.Vector128Int32.cs" />
+ <Compile Include="ConvertScalarToVector128Double.Double.cs" />
<Compile Include="Divide.Double.cs" />
<Compile Include="DivideScalar.Double.cs" />
<Compile Include="Extract.UInt16.1.cs" />
@@ -265,6 +262,7 @@
<Compile Include="..\Shared\SimpleUnOpTest_DataTable.cs" />
<Compile Include="..\Shared\ScalarSimdUnOpTest_DataTable.cs" />
<Compile Include="..\Shared\SimdScalarUnOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimpleBinOpConvTest_DataTable.cs" />
<Compile Include="Sse2Verify.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_ro.csproj
index cc917832d4..38d2002c43 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/Sse2_ro.csproj
@@ -112,11 +112,7 @@
<Compile Include="ConvertToInt32.Vector128Double.cs" />
<Compile Include="ConvertToInt32.Vector128Int32.cs" />
<Compile Include="ConvertToInt32WithTruncation.Vector128Double.cs" />
- <Compile Include="ConvertToInt64.Vector128Double.cs" />
- <Compile Include="ConvertToInt64.Vector128Int64.cs" />
- <Compile Include="ConvertToInt64WithTruncation.Vector128Double.cs" />
<Compile Include="ConvertToUInt32.Vector128UInt32.cs" />
- <Compile Include="ConvertToUInt64.Vector128UInt64.cs" />
<Compile Include="ConvertToVector128Double.Vector128Single.cs" />
<Compile Include="ConvertToVector128Double.Vector128Int32.cs" />
<Compile Include="ConvertToVector128Int32.Vector128Double.cs" />
@@ -125,6 +121,7 @@
<Compile Include="ConvertToVector128Int32WithTruncation.Vector128Single.cs" />
<Compile Include="ConvertToVector128Single.Vector128Double.cs" />
<Compile Include="ConvertToVector128Single.Vector128Int32.cs" />
+ <Compile Include="ConvertScalarToVector128Double.Double.cs" />
<Compile Include="Divide.Double.cs" />
<Compile Include="DivideScalar.Double.cs" />
<Compile Include="Extract.UInt16.1.cs" />
@@ -265,6 +262,7 @@
<Compile Include="..\Shared\SimpleUnOpTest_DataTable.cs" />
<Compile Include="..\Shared\ScalarSimdUnOpTest_DataTable.cs" />
<Compile Include="..\Shared\SimdScalarUnOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimpleBinOpConvTest_DataTable.cs" />
<Compile Include="Sse2Verify.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal.cs
index 76b468e12e..196c04742e 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal.cs
@@ -22,99 +22,6 @@ namespace IntelHardwareIntrinsicTest
if (Sse2.IsSupported)
{
- if (Environment.Is64BitProcess)
- {
- {
- long* inArray = stackalloc long[2];
- inArray[0] = 0xffffffff01l;
- long* outBuffer = stackalloc long[2];
-
- Sse2.StoreNonTemporal(outBuffer, inArray[0]);
-
- for (var i = 0; i < 2; i++)
- {
- if (inArray[i] != outBuffer[i])
- {
- Console.WriteLine("Sse2 StoreNonTemporal failed on long:");
- for (var n = 0; n < 2; n++)
- {
- Console.Write(outBuffer[n] + ", ");
- }
- Console.WriteLine();
-
- testResult = Fail;
- break;
- }
- }
- }
-
- {
- ulong* inArray = stackalloc ulong[2];
- inArray[0] = 0xffffffffff01ul;
- ulong* outBuffer = stackalloc ulong[2];
-
- Sse2.StoreNonTemporal(outBuffer, inArray[0]);
-
- for (var i = 0; i < 2; i++)
- {
- if (inArray[i] != outBuffer[i])
- {
- Console.WriteLine("Sse2 StoreNonTemporal failed on ulong:");
- for (var n = 0; n < 2; n++)
- {
- Console.Write(outBuffer[n] + ", ");
- }
- Console.WriteLine();
-
- testResult = Fail;
- break;
- }
- }
- }
- }
- else
- {
- try
- {
- long* inArray = stackalloc long[2];
- inArray[0] = 0xffffffff01l;
- long* outBuffer = stackalloc long[2];
-
- Sse2.StoreNonTemporal(outBuffer, inArray[0]);
- testResult = Fail;
- Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.StoreNonTemporal)} failed on long: expected PlatformNotSupportedException exception.");
- }
- catch (PlatformNotSupportedException)
- {
-
- }
- catch(Exception ex)
- {
- testResult = Fail;
- Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.StoreNonTemporal)}-{ex} failed on long: expected PlatformNotSupportedException exception.");
- }
-
- try
- {
- ulong* inArray = stackalloc ulong[2];
- inArray[0] = 0xffffffffff01ul;
- ulong* outBuffer = stackalloc ulong[2];
-
- Sse2.StoreNonTemporal(outBuffer, inArray[0]);
- testResult = Fail;
- Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.StoreNonTemporal)} failed on ulong: expected PlatformNotSupportedException exception.");
- }
- catch (PlatformNotSupportedException)
- {
-
- }
- catch(Exception ex)
- {
- testResult = Fail;
- Console.WriteLine($"{nameof(Sse2)}.{nameof(Sse2.StoreNonTemporal)}-{ex} failed on ulong: expected PlatformNotSupportedException exception.");
- }
- }
-
{
int* inArray = stackalloc int[4];
inArray[0] = -784561;
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Extract.Int64.1.cs
index 7048af4940..b354adcc4a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Extract.Int64.1.cs
@@ -107,7 +107,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(ExtractScalarTest__ExtractInt641 testClass)
{
- var result = Sse41.Extract(_fld, 1);
+ var result = Sse41.X64.Extract(_fld, 1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse41.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
+ public bool IsSupported => Sse41.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -152,7 +152,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr),
1
);
@@ -165,7 +165,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr)),
1
);
@@ -178,7 +178,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr)),
1
);
@@ -191,7 +191,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Extract), new Type[] { typeof(Vector128<Int64>), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Extract), new Type[] { typeof(Vector128<Int64>), typeof(byte) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr),
(byte)1
@@ -205,7 +205,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Extract), new Type[] { typeof(Vector128<Int64>), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Extract), new Type[] { typeof(Vector128<Int64>), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr)),
(byte)1
@@ -219,7 +219,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Extract), new Type[] { typeof(Vector128<Int64>), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Extract), new Type[] { typeof(Vector128<Int64>), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr)),
(byte)1
@@ -233,7 +233,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
_clsVar,
1
);
@@ -247,7 +247,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr);
- var result = Sse41.Extract(firstOp, 1);
+ var result = Sse41.X64.Extract(firstOp, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -258,7 +258,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr));
- var result = Sse41.Extract(firstOp, 1);
+ var result = Sse41.X64.Extract(firstOp, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -269,7 +269,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
var firstOp = Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr));
- var result = Sse41.Extract(firstOp, 1);
+ var result = Sse41.X64.Extract(firstOp, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -280,7 +280,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ExtractScalarTest__ExtractInt641();
- var result = Sse41.Extract(test._fld, 1);
+ var result = Sse41.X64.Extract(test._fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -290,7 +290,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Sse41.Extract(_fld, 1);
+ var result = Sse41.X64.Extract(_fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
@@ -301,7 +301,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Sse41.Extract(test._fld, 1);
+ var result = Sse41.X64.Extract(test._fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -369,7 +369,7 @@ namespace JIT.HardwareIntrinsics.X86
if (!succeeded)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse41)}.{nameof(Sse41.Extract)}<Int64>(Vector128<Int64><9>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse41.X64)}.{nameof(Sse41.X64.Extract)}<Int64>(Vector128<Int64><9>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Extract.Int64.129.cs
index bdbeee6326..b1c3a61752 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.Int64.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Extract.Int64.129.cs
@@ -107,7 +107,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(ExtractScalarTest__ExtractInt64129 testClass)
{
- var result = Sse41.Extract(_fld, 129);
+ var result = Sse41.X64.Extract(_fld, 129);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse41.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
+ public bool IsSupported => Sse41.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -152,7 +152,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr),
129
);
@@ -165,7 +165,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr)),
129
);
@@ -178,7 +178,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr)),
129
);
@@ -191,7 +191,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Extract), new Type[] { typeof(Vector128<Int64>), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Extract), new Type[] { typeof(Vector128<Int64>), typeof(byte) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr),
(byte)129
@@ -205,7 +205,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Extract), new Type[] { typeof(Vector128<Int64>), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Extract), new Type[] { typeof(Vector128<Int64>), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr)),
(byte)129
@@ -219,7 +219,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Extract), new Type[] { typeof(Vector128<Int64>), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Extract), new Type[] { typeof(Vector128<Int64>), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr)),
(byte)129
@@ -233,7 +233,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
_clsVar,
129
);
@@ -247,7 +247,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr);
- var result = Sse41.Extract(firstOp, 129);
+ var result = Sse41.X64.Extract(firstOp, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -258,7 +258,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr));
- var result = Sse41.Extract(firstOp, 129);
+ var result = Sse41.X64.Extract(firstOp, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -269,7 +269,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
var firstOp = Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr));
- var result = Sse41.Extract(firstOp, 129);
+ var result = Sse41.X64.Extract(firstOp, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -280,7 +280,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ExtractScalarTest__ExtractInt64129();
- var result = Sse41.Extract(test._fld, 129);
+ var result = Sse41.X64.Extract(test._fld, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -290,7 +290,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Sse41.Extract(_fld, 129);
+ var result = Sse41.X64.Extract(_fld, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
@@ -301,7 +301,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Sse41.Extract(test._fld, 129);
+ var result = Sse41.X64.Extract(test._fld, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -369,7 +369,7 @@ namespace JIT.HardwareIntrinsics.X86
if (!succeeded)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse41)}.{nameof(Sse41.Extract)}<Int64>(Vector128<Int64><9>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse41.X64)}.{nameof(Sse41.X64.Extract)}<Int64>(Vector128<Int64><9>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Extract.UInt64.1.cs
index 39dfa3a925..67769cb635 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Extract.UInt64.1.cs
@@ -107,7 +107,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(ExtractScalarTest__ExtractUInt641 testClass)
{
- var result = Sse41.Extract(_fld, 1);
+ var result = Sse41.X64.Extract(_fld, 1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse41.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
+ public bool IsSupported => Sse41.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -152,7 +152,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr),
1
);
@@ -165,7 +165,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr)),
1
);
@@ -178,7 +178,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr)),
1
);
@@ -191,7 +191,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Extract), new Type[] { typeof(Vector128<UInt64>), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Extract), new Type[] { typeof(Vector128<UInt64>), typeof(byte) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr),
(byte)1
@@ -205,7 +205,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Extract), new Type[] { typeof(Vector128<UInt64>), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Extract), new Type[] { typeof(Vector128<UInt64>), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr)),
(byte)1
@@ -219,7 +219,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Extract), new Type[] { typeof(Vector128<UInt64>), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Extract), new Type[] { typeof(Vector128<UInt64>), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr)),
(byte)1
@@ -233,7 +233,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
_clsVar,
1
);
@@ -247,7 +247,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr);
- var result = Sse41.Extract(firstOp, 1);
+ var result = Sse41.X64.Extract(firstOp, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -258,7 +258,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr));
- var result = Sse41.Extract(firstOp, 1);
+ var result = Sse41.X64.Extract(firstOp, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -269,7 +269,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
var firstOp = Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr));
- var result = Sse41.Extract(firstOp, 1);
+ var result = Sse41.X64.Extract(firstOp, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -280,7 +280,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ExtractScalarTest__ExtractUInt641();
- var result = Sse41.Extract(test._fld, 1);
+ var result = Sse41.X64.Extract(test._fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -290,7 +290,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Sse41.Extract(_fld, 1);
+ var result = Sse41.X64.Extract(_fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
@@ -301,7 +301,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Sse41.Extract(test._fld, 1);
+ var result = Sse41.X64.Extract(test._fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -369,7 +369,7 @@ namespace JIT.HardwareIntrinsics.X86
if (!succeeded)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse41)}.{nameof(Sse41.Extract)}<UInt64>(Vector128<UInt64><9>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse41.X64)}.{nameof(Sse41.X64.Extract)}<UInt64>(Vector128<UInt64><9>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Extract.UInt64.129.cs
index 849de902ea..0a58c66bb0 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Extract.UInt64.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Extract.UInt64.129.cs
@@ -107,7 +107,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(ExtractScalarTest__ExtractUInt64129 testClass)
{
- var result = Sse41.Extract(_fld, 129);
+ var result = Sse41.X64.Extract(_fld, 129);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse41.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
+ public bool IsSupported => Sse41.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -152,7 +152,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr),
129
);
@@ -165,7 +165,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr)),
129
);
@@ -178,7 +178,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr)),
129
);
@@ -191,7 +191,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Extract), new Type[] { typeof(Vector128<UInt64>), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Extract), new Type[] { typeof(Vector128<UInt64>), typeof(byte) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr),
(byte)129
@@ -205,7 +205,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Extract), new Type[] { typeof(Vector128<UInt64>), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Extract), new Type[] { typeof(Vector128<UInt64>), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr)),
(byte)129
@@ -219,7 +219,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Extract), new Type[] { typeof(Vector128<UInt64>), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Extract), new Type[] { typeof(Vector128<UInt64>), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr)),
(byte)129
@@ -233,7 +233,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Sse41.Extract(
+ var result = Sse41.X64.Extract(
_clsVar,
129
);
@@ -247,7 +247,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr);
- var result = Sse41.Extract(firstOp, 129);
+ var result = Sse41.X64.Extract(firstOp, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -258,7 +258,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr));
- var result = Sse41.Extract(firstOp, 129);
+ var result = Sse41.X64.Extract(firstOp, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -269,7 +269,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
var firstOp = Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr));
- var result = Sse41.Extract(firstOp, 129);
+ var result = Sse41.X64.Extract(firstOp, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -280,7 +280,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ExtractScalarTest__ExtractUInt64129();
- var result = Sse41.Extract(test._fld, 129);
+ var result = Sse41.X64.Extract(test._fld, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -290,7 +290,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Sse41.Extract(_fld, 129);
+ var result = Sse41.X64.Extract(_fld, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
@@ -301,7 +301,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Sse41.Extract(test._fld, 129);
+ var result = Sse41.X64.Extract(test._fld, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -369,7 +369,7 @@ namespace JIT.HardwareIntrinsics.X86
if (!succeeded)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse41)}.{nameof(Sse41.Extract)}<UInt64>(Vector128<UInt64><9>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse41.X64)}.{nameof(Sse41.X64.Extract)}<UInt64>(Vector128<UInt64><9>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Insert.Int64.1.cs
index e3c2d3ecef..1a4cda9beb 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Insert.Int64.1.cs
@@ -107,7 +107,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(InsertScalarTest__InsertInt641 testClass)
{
- var result = Sse41.Insert(_fld, (long)2, 1);
+ var result = Sse41.X64.Insert(_fld, (long)2, 1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse41.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
+ public bool IsSupported => Sse41.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -152,7 +152,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr),
(long)2,
1
@@ -166,7 +166,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr)),
(long)2,
1
@@ -180,7 +180,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr)),
(long)2,
1
@@ -194,7 +194,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Insert), new Type[] { typeof(Vector128<Int64>), typeof(Int64), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Insert), new Type[] { typeof(Vector128<Int64>), typeof(Int64), typeof(byte) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr),
(long)2,
@@ -209,7 +209,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Insert), new Type[] { typeof(Vector128<Int64>), typeof(Int64), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Insert), new Type[] { typeof(Vector128<Int64>), typeof(Int64), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr)),
(long)2,
@@ -224,7 +224,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Insert), new Type[] { typeof(Vector128<Int64>), typeof(Int64), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Insert), new Type[] { typeof(Vector128<Int64>), typeof(Int64), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr)),
(long)2,
@@ -239,7 +239,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
_clsVar,
(long)2,
1
@@ -254,7 +254,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr);
- var result = Sse41.Insert(firstOp, (long)2, 1);
+ var result = Sse41.X64.Insert(firstOp, (long)2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -265,7 +265,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr));
- var result = Sse41.Insert(firstOp, (long)2, 1);
+ var result = Sse41.X64.Insert(firstOp, (long)2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -276,7 +276,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
var firstOp = Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr));
- var result = Sse41.Insert(firstOp, (long)2, 1);
+ var result = Sse41.X64.Insert(firstOp, (long)2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -287,7 +287,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new InsertScalarTest__InsertInt641();
- var result = Sse41.Insert(test._fld, (long)2, 1);
+ var result = Sse41.X64.Insert(test._fld, (long)2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -297,7 +297,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Sse41.Insert(_fld, (long)2, 1);
+ var result = Sse41.X64.Insert(_fld, (long)2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
@@ -308,7 +308,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Sse41.Insert(test._fld, (long)2, 1);
+ var result = Sse41.X64.Insert(test._fld, (long)2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -380,7 +380,7 @@ namespace JIT.HardwareIntrinsics.X86
if (!succeeded)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse41)}.{nameof(Sse41.Insert)}<Int64>(Vector128<Int64><9>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse41.X64)}.{nameof(Sse41.X64.Insert)}<Int64>(Vector128<Int64><9>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Insert.Int64.129.cs
index 8e1c39ad1a..7aeb967717 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.Int64.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Insert.Int64.129.cs
@@ -107,7 +107,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(InsertScalarTest__InsertInt64129 testClass)
{
- var result = Sse41.Insert(_fld, (long)2, 129);
+ var result = Sse41.X64.Insert(_fld, (long)2, 129);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<Int64, Int64>(_data, new Int64[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse41.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
+ public bool IsSupported => Sse41.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(Int64) != typeof(long)) && (typeof(Int64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -152,7 +152,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr),
(long)2,
129
@@ -166,7 +166,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr)),
(long)2,
129
@@ -180,7 +180,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr)),
(long)2,
129
@@ -194,7 +194,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Insert), new Type[] { typeof(Vector128<Int64>), typeof(Int64), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Insert), new Type[] { typeof(Vector128<Int64>), typeof(Int64), typeof(byte) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr),
(long)2,
@@ -209,7 +209,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Insert), new Type[] { typeof(Vector128<Int64>), typeof(Int64), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Insert), new Type[] { typeof(Vector128<Int64>), typeof(Int64), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr)),
(long)2,
@@ -224,7 +224,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Insert), new Type[] { typeof(Vector128<Int64>), typeof(Int64), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Insert), new Type[] { typeof(Vector128<Int64>), typeof(Int64), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr)),
(long)2,
@@ -239,7 +239,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
_clsVar,
(long)2,
129
@@ -254,7 +254,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector128<Int64>>(_dataTable.inArrayPtr);
- var result = Sse41.Insert(firstOp, (long)2, 129);
+ var result = Sse41.X64.Insert(firstOp, (long)2, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -265,7 +265,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = Sse2.LoadVector128((Int64*)(_dataTable.inArrayPtr));
- var result = Sse41.Insert(firstOp, (long)2, 129);
+ var result = Sse41.X64.Insert(firstOp, (long)2, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -276,7 +276,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
var firstOp = Sse2.LoadAlignedVector128((Int64*)(_dataTable.inArrayPtr));
- var result = Sse41.Insert(firstOp, (long)2, 129);
+ var result = Sse41.X64.Insert(firstOp, (long)2, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -287,7 +287,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new InsertScalarTest__InsertInt64129();
- var result = Sse41.Insert(test._fld, (long)2, 129);
+ var result = Sse41.X64.Insert(test._fld, (long)2, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -297,7 +297,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Sse41.Insert(_fld, (long)2, 129);
+ var result = Sse41.X64.Insert(_fld, (long)2, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
@@ -308,7 +308,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Sse41.Insert(test._fld, (long)2, 129);
+ var result = Sse41.X64.Insert(test._fld, (long)2, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -380,7 +380,7 @@ namespace JIT.HardwareIntrinsics.X86
if (!succeeded)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse41)}.{nameof(Sse41.Insert)}<Int64>(Vector128<Int64><9>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse41.X64)}.{nameof(Sse41.X64.Insert)}<Int64>(Vector128<Int64><9>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.1.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Insert.UInt64.1.cs
index 7e7c21a440..1bda756939 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.1.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Insert.UInt64.1.cs
@@ -107,7 +107,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(InsertScalarTest__InsertUInt641 testClass)
{
- var result = Sse41.Insert(_fld, (ulong)2, 1);
+ var result = Sse41.X64.Insert(_fld, (ulong)2, 1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse41.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
+ public bool IsSupported => Sse41.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -152,7 +152,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr),
(ulong)2,
1
@@ -166,7 +166,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr)),
(ulong)2,
1
@@ -180,7 +180,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr)),
(ulong)2,
1
@@ -194,7 +194,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Insert), new Type[] { typeof(Vector128<UInt64>), typeof(UInt64), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Insert), new Type[] { typeof(Vector128<UInt64>), typeof(UInt64), typeof(byte) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr),
(ulong)2,
@@ -209,7 +209,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Insert), new Type[] { typeof(Vector128<UInt64>), typeof(UInt64), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Insert), new Type[] { typeof(Vector128<UInt64>), typeof(UInt64), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr)),
(ulong)2,
@@ -224,7 +224,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Insert), new Type[] { typeof(Vector128<UInt64>), typeof(UInt64), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Insert), new Type[] { typeof(Vector128<UInt64>), typeof(UInt64), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr)),
(ulong)2,
@@ -239,7 +239,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
_clsVar,
(ulong)2,
1
@@ -254,7 +254,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr);
- var result = Sse41.Insert(firstOp, (ulong)2, 1);
+ var result = Sse41.X64.Insert(firstOp, (ulong)2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -265,7 +265,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr));
- var result = Sse41.Insert(firstOp, (ulong)2, 1);
+ var result = Sse41.X64.Insert(firstOp, (ulong)2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -276,7 +276,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
var firstOp = Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr));
- var result = Sse41.Insert(firstOp, (ulong)2, 1);
+ var result = Sse41.X64.Insert(firstOp, (ulong)2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -287,7 +287,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new InsertScalarTest__InsertUInt641();
- var result = Sse41.Insert(test._fld, (ulong)2, 1);
+ var result = Sse41.X64.Insert(test._fld, (ulong)2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -297,7 +297,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Sse41.Insert(_fld, (ulong)2, 1);
+ var result = Sse41.X64.Insert(_fld, (ulong)2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
@@ -308,7 +308,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Sse41.Insert(test._fld, (ulong)2, 1);
+ var result = Sse41.X64.Insert(test._fld, (ulong)2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -380,7 +380,7 @@ namespace JIT.HardwareIntrinsics.X86
if (!succeeded)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse41)}.{nameof(Sse41.Insert)}<UInt64>(Vector128<UInt64><9>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse41.X64)}.{nameof(Sse41.X64.Insert)}<UInt64>(Vector128<UInt64><9>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.129.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Insert.UInt64.129.cs
index 77acb817ea..c1950f0b23 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Insert.UInt64.129.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Insert.UInt64.129.cs
@@ -107,7 +107,7 @@ namespace JIT.HardwareIntrinsics.X86
public void RunStructFldScenario(InsertScalarTest__InsertUInt64129 testClass)
{
- var result = Sse41.Insert(_fld, (ulong)2, 129);
+ var result = Sse41.X64.Insert(_fld, (ulong)2, 129);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
@@ -144,7 +144,7 @@ namespace JIT.HardwareIntrinsics.X86
_dataTable = new SimpleUnaryOpTest__DataTable<UInt64, UInt64>(_data, new UInt64[RetElementCount], LargestVectorSize);
}
- public bool IsSupported => Sse41.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
+ public bool IsSupported => Sse41.X64.IsSupported && (Environment.Is64BitProcess || ((typeof(UInt64) != typeof(long)) && (typeof(UInt64) != typeof(ulong))));
public bool Succeeded { get; set; }
@@ -152,7 +152,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr),
(ulong)2,
129
@@ -166,7 +166,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr)),
(ulong)2,
129
@@ -180,7 +180,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr)),
(ulong)2,
129
@@ -194,7 +194,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Insert), new Type[] { typeof(Vector128<UInt64>), typeof(UInt64), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Insert), new Type[] { typeof(Vector128<UInt64>), typeof(UInt64), typeof(byte) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr),
(ulong)2,
@@ -209,7 +209,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Insert), new Type[] { typeof(Vector128<UInt64>), typeof(UInt64), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Insert), new Type[] { typeof(Vector128<UInt64>), typeof(UInt64), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr)),
(ulong)2,
@@ -224,7 +224,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
- var result = typeof(Sse41).GetMethod(nameof(Sse41.Insert), new Type[] { typeof(Vector128<UInt64>), typeof(UInt64), typeof(byte) })
+ var result = typeof(Sse41.X64).GetMethod(nameof(Sse41.X64.Insert), new Type[] { typeof(Vector128<UInt64>), typeof(UInt64), typeof(byte) })
.Invoke(null, new object[] {
Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr)),
(ulong)2,
@@ -239,7 +239,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
- var result = Sse41.Insert(
+ var result = Sse41.X64.Insert(
_clsVar,
(ulong)2,
129
@@ -254,7 +254,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector128<UInt64>>(_dataTable.inArrayPtr);
- var result = Sse41.Insert(firstOp, (ulong)2, 129);
+ var result = Sse41.X64.Insert(firstOp, (ulong)2, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -265,7 +265,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = Sse2.LoadVector128((UInt64*)(_dataTable.inArrayPtr));
- var result = Sse41.Insert(firstOp, (ulong)2, 129);
+ var result = Sse41.X64.Insert(firstOp, (ulong)2, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -276,7 +276,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
var firstOp = Sse2.LoadAlignedVector128((UInt64*)(_dataTable.inArrayPtr));
- var result = Sse41.Insert(firstOp, (ulong)2, 129);
+ var result = Sse41.X64.Insert(firstOp, (ulong)2, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
@@ -287,7 +287,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new InsertScalarTest__InsertUInt64129();
- var result = Sse41.Insert(test._fld, (ulong)2, 129);
+ var result = Sse41.X64.Insert(test._fld, (ulong)2, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -297,7 +297,7 @@ namespace JIT.HardwareIntrinsics.X86
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
- var result = Sse41.Insert(_fld, (ulong)2, 129);
+ var result = Sse41.X64.Insert(_fld, (ulong)2, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
@@ -308,7 +308,7 @@ namespace JIT.HardwareIntrinsics.X86
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
- var result = Sse41.Insert(test._fld, (ulong)2, 129);
+ var result = Sse41.X64.Insert(test._fld, (ulong)2, 129);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
@@ -380,7 +380,7 @@ namespace JIT.HardwareIntrinsics.X86
if (!succeeded)
{
- TestLibrary.TestFramework.LogInformation($"{nameof(Sse41)}.{nameof(Sse41.Insert)}<UInt64>(Vector128<UInt64><9>): {method} failed:");
+ TestLibrary.TestFramework.LogInformation($"{nameof(Sse41.X64)}.{nameof(Sse41.X64.Insert)}<UInt64>(Vector128<UInt64><9>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Program.Sse41.X64.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Program.Sse41.X64.cs
new file mode 100644
index 0000000000..5f45189121
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Program.Sse41.X64.cs
@@ -0,0 +1,26 @@
+// 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.Collections.Generic;
+
+namespace JIT.HardwareIntrinsics.X86
+{
+ public static partial class Program
+ {
+ static Program()
+ {
+ TestList = new Dictionary<string, Action>() {
+ ["Extract.Int64.129"] = ExtractInt64129,
+ ["Extract.UInt64.129"] = ExtractUInt64129,
+ ["Extract.Int64.1"] = ExtractInt641,
+ ["Extract.UInt64.1"] = ExtractUInt641,
+ ["Insert.Int64.129"] = InsertInt64129,
+ ["Insert.UInt64.129"] = InsertUInt64129,
+ ["Insert.Int64.1"] = InsertInt641,
+ ["Insert.UInt64.1"] = InsertUInt641,
+ };
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Sse41.X64_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Sse41.X64_r.csproj
new file mode 100644
index 0000000000..4e5f4145bb
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Sse41.X64_r.csproj
@@ -0,0 +1,46 @@
+<?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>Embedded</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Extract.Int64.1.cs" />
+ <Compile Include="Extract.UInt64.1.cs" />
+ <Compile Include="Extract.Int64.129.cs" />
+ <Compile Include="Extract.UInt64.129.cs" />
+ <Compile Include="Insert.Int64.1.cs" />
+ <Compile Include="Insert.UInt64.1.cs" />
+ <Compile Include="Insert.Int64.129.cs" />
+ <Compile Include="Insert.UInt64.129.cs" />
+ <Compile Include="Program.Sse41.X64.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ <Compile Include="..\Shared\SimpleUnOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimpleBinOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimpleTernOpTest_DataTable.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Sse41.X64_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Sse41.X64_ro.csproj
new file mode 100644
index 0000000000..c75f15b944
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41.X64/Sse41.X64_ro.csproj
@@ -0,0 +1,46 @@
+<?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>Embedded</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Extract.Int64.1.cs" />
+ <Compile Include="Extract.UInt64.1.cs" />
+ <Compile Include="Extract.Int64.129.cs" />
+ <Compile Include="Extract.UInt64.129.cs" />
+ <Compile Include="Insert.Int64.1.cs" />
+ <Compile Include="Insert.UInt64.1.cs" />
+ <Compile Include="Insert.Int64.129.cs" />
+ <Compile Include="Insert.UInt64.129.cs" />
+ <Compile Include="Program.Sse41.X64.cs" />
+ <Compile Include="..\Shared\Program.cs" />
+ <Compile Include="..\Shared\SimpleUnOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimpleBinOpTest_DataTable.cs" />
+ <Compile Include="..\Shared\SimpleTernOpTest_DataTable.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Program.Sse41.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Program.Sse41.cs
index 7286e23783..f60ab4e0c8 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Program.Sse41.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Program.Sse41.cs
@@ -31,14 +31,10 @@ namespace JIT.HardwareIntrinsics.X86
["Extract.Byte.1"] = ExtractByte1,
["Extract.Int32.1"] = ExtractInt321,
["Extract.UInt32.1"] = ExtractUInt321,
- ["Extract.Int64.1"] = ExtractInt641,
- ["Extract.UInt64.1"] = ExtractUInt641,
["Extract.Single.1"] = ExtractSingle1,
["Extract.Byte.129"] = ExtractByte129,
["Extract.Int32.129"] = ExtractInt32129,
["Extract.UInt32.129"] = ExtractUInt32129,
- ["Extract.Int64.129"] = ExtractInt64129,
- ["Extract.UInt64.129"] = ExtractUInt64129,
["Extract.Single.129"] = ExtractSingle129,
["Floor.Double"] = FloorDouble,
["Floor.Single"] = FloorSingle,
@@ -49,8 +45,6 @@ namespace JIT.HardwareIntrinsics.X86
["Insert.SByte.1"] = InsertSByte1,
["Insert.Int32.1"] = InsertInt321,
["Insert.UInt32.1"] = InsertUInt321,
- ["Insert.Int64.1"] = InsertInt641,
- ["Insert.UInt64.1"] = InsertUInt641,
["Insert.Single.1"] = InsertSingle1,
["Insert.Single.2"] = InsertSingle2,
["Insert.Single.4"] = InsertSingle4,
@@ -64,8 +58,6 @@ namespace JIT.HardwareIntrinsics.X86
["Insert.SByte.129"] = InsertSByte129,
["Insert.Int32.129"] = InsertInt32129,
["Insert.UInt32.129"] = InsertUInt32129,
- ["Insert.Int64.129"] = InsertInt64129,
- ["Insert.UInt64.129"] = InsertUInt64129,
["Insert.Single.129"] = InsertSingle129,
["Insert.Single.192"] = InsertSingle192,
["Max.Int32"] = MaxInt32,
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Sse41_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Sse41_r.csproj
index 4677ddd6bd..c88f905b66 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Sse41_r.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Sse41_r.csproj
@@ -129,22 +129,16 @@
<Compile Include="Extract.Byte.1.cs" />
<Compile Include="Extract.Int32.1.cs" />
<Compile Include="Extract.UInt32.1.cs" />
- <Compile Include="Extract.Int64.1.cs" />
- <Compile Include="Extract.UInt64.1.cs" />
<Compile Include="Extract.Single.1.cs" />
<Compile Include="Extract.Byte.129.cs" />
<Compile Include="Extract.Int32.129.cs" />
<Compile Include="Extract.UInt32.129.cs" />
- <Compile Include="Extract.Int64.129.cs" />
- <Compile Include="Extract.UInt64.129.cs" />
<Compile Include="Extract.Single.129.cs" />
<Compile Include="Insert.Single.0.cs" />
<Compile Include="Insert.Byte.1.cs" />
<Compile Include="Insert.SByte.1.cs" />
<Compile Include="Insert.Int32.1.cs" />
<Compile Include="Insert.UInt32.1.cs" />
- <Compile Include="Insert.Int64.1.cs" />
- <Compile Include="Insert.UInt64.1.cs" />
<Compile Include="Insert.Single.1.cs" />
<Compile Include="Insert.Single.2.cs" />
<Compile Include="Insert.Single.4.cs" />
@@ -158,8 +152,6 @@
<Compile Include="Insert.SByte.129.cs" />
<Compile Include="Insert.Int32.129.cs" />
<Compile Include="Insert.UInt32.129.cs" />
- <Compile Include="Insert.Int64.129.cs" />
- <Compile Include="Insert.UInt64.129.cs" />
<Compile Include="Insert.Single.129.cs" />
<Compile Include="Insert.Single.192.cs" />
<Compile Include="Program.Sse41.cs" />
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Sse41_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Sse41_ro.csproj
index 19ded7d0b4..8588e655d2 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Sse41_ro.csproj
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse41/Sse41_ro.csproj
@@ -129,22 +129,16 @@
<Compile Include="Extract.Byte.1.cs" />
<Compile Include="Extract.Int32.1.cs" />
<Compile Include="Extract.UInt32.1.cs" />
- <Compile Include="Extract.Int64.1.cs" />
- <Compile Include="Extract.UInt64.1.cs" />
<Compile Include="Extract.Single.1.cs" />
<Compile Include="Extract.Byte.129.cs" />
<Compile Include="Extract.Int32.129.cs" />
<Compile Include="Extract.UInt32.129.cs" />
- <Compile Include="Extract.Int64.129.cs" />
- <Compile Include="Extract.UInt64.129.cs" />
<Compile Include="Extract.Single.129.cs" />
<Compile Include="Insert.Single.0.cs" />
<Compile Include="Insert.Byte.1.cs" />
<Compile Include="Insert.SByte.1.cs" />
<Compile Include="Insert.Int32.1.cs" />
<Compile Include="Insert.UInt32.1.cs" />
- <Compile Include="Insert.Int64.1.cs" />
- <Compile Include="Insert.UInt64.1.cs" />
<Compile Include="Insert.Single.1.cs" />
<Compile Include="Insert.Single.2.cs" />
<Compile Include="Insert.Single.4.cs" />
@@ -158,8 +152,6 @@
<Compile Include="Insert.SByte.129.cs" />
<Compile Include="Insert.Int32.129.cs" />
<Compile Include="Insert.UInt32.129.cs" />
- <Compile Include="Insert.Int64.129.cs" />
- <Compile Include="Insert.UInt64.129.cs" />
<Compile Include="Insert.Single.129.cs" />
<Compile Include="Insert.Single.192.cs" />
<Compile Include="Program.Sse41.cs" />
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32.cs
new file mode 100644
index 0000000000..f55ad61a76
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32.cs
@@ -0,0 +1,106 @@
+// 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.Reflection;
+using System.Runtime.Intrinsics.X86;
+
+namespace IntelHardwareIntrinsicTest
+{
+ class Program
+ {
+ const int Pass = 100;
+ const int Fail = 0;
+
+ static int Main(string[] args)
+ {
+ ulong s1l = 0, s2l = 0, resl;
+ int testResult = Pass;
+
+ if (Sse42.X64.IsSupported)
+ {
+ for (int i = 0; i < longCrcTable.Length; i++)
+ {
+ s1l = longCrcTable[i].s1;
+ s2l = longCrcTable[i].s2;
+
+ resl = Sse42.X64.Crc32(s1l, s2l);
+ if (resl != longCrcTable[i].res)
+ {
+ Console.WriteLine("{0}: Inputs: 0x{1,16:x}, 0x{2,16:x} Expected: 0x{3,16:x} actual: 0x{4,16:x}",
+ i, s1l, s2l, longCrcTable[i].res, resl);
+ testResult = Fail;
+ }
+
+ resl = Convert.ToUInt64(typeof(Sse42.X64).GetMethod(nameof(Sse42.X64.Crc32), new Type[] { s1l.GetType(), s2l.GetType() }).Invoke(null, new object[] { s1l, s2l }));
+ if (resl != longCrcTable[i].res)
+ {
+ Console.WriteLine("{0}: Inputs: 0x{1,16:x}, 0x{2,16:x} Expected: 0x{3,16:x} actual: 0x{4,16:x} - Reflection",
+ i, s1l, s2l, longCrcTable[i].res, resl);
+ testResult = Fail;
+ }
+ }
+ }
+ else
+ {
+ try
+ {
+ resl = Sse42.X64.Crc32(s1l, s2l);
+ Console.WriteLine("Intrinsic Sse42.X64.Crc32 is called on non-supported hardware.");
+ Console.WriteLine("Sse42.IsSupported " + Sse42.IsSupported);
+ Console.WriteLine("Environment.Is64BitProcess " + Environment.Is64BitProcess);
+ testResult = Fail;
+ }
+ catch (PlatformNotSupportedException)
+ {
+ }
+
+ try
+ {
+ resl = Convert.ToUInt64(typeof(Sse42.X64).GetMethod(nameof(Sse42.X64.Crc32), new Type[] { s1l.GetType(), s2l.GetType() }).Invoke(null, new object[] { s1l, s2l }));
+ Console.WriteLine("Intrinsic Sse42.X64.Crc32 is called via reflection on non-supported hardware.");
+ Console.WriteLine("Sse42.IsSupported " + Sse42.IsSupported);
+ Console.WriteLine("Environment.Is64BitProcess " + Environment.Is64BitProcess);
+ testResult = Fail;
+ }
+ catch (TargetInvocationException e) when (e.InnerException is PlatformNotSupportedException)
+ {
+ }
+ }
+
+ return testResult;
+ }
+
+ public struct Crc<T, U> where T : struct where U : struct
+ {
+ public T s1;
+ public U s2;
+ public T res;
+ public Crc(T a, U b, T c)
+ {
+ this.s1 = a;
+ this.s2 = b;
+ this.res = c;
+ }
+ }
+
+ public static Crc<ulong, ulong>[] longCrcTable = {
+ new Crc<ulong, ulong>(0x0000000000000000UL, 0x0000000000000000UL, 0x0000000000000000UL),
+ new Crc<ulong, ulong>(0x0000000000000000UL, 0x0000000000000001UL, 0x00000000493c7d27UL),
+ new Crc<ulong, ulong>(0x0000000000000001UL, 0x0000000000000000UL, 0x00000000493c7d27UL),
+ new Crc<ulong, ulong>(0x0000000000000001UL, 0x0000000000000001UL, 0x0000000000000000UL),
+ new Crc<ulong, ulong>(0x0000000000000000UL, 0xffffffffffffffffUL, 0x00000000c44ff94dUL),
+ new Crc<ulong, ulong>(0xffffffffffffffffUL, 0x0000000000000000UL, 0x0000000073d74d75UL),
+ new Crc<ulong, ulong>(0xffffffffffffffffUL, 0xffffffffffffffffUL, 0x00000000b798b438UL),
+ new Crc<ulong, ulong>(0x0000000000000001UL, 0xffffffffffffffffUL, 0x000000008d73846aUL),
+ new Crc<ulong, ulong>(0xffffffffffffffffUL, 0x0000000000000001UL, 0x000000003aeb3052UL),
+ new Crc<ulong, ulong>(0xfffffffffffe1f0dUL, 0x00000000f5c1ddb3UL, 0x000000000504c066UL),
+ new Crc<ulong, ulong>(0x0000000000000005UL, 0x000000bce1263cffUL, 0x000000004ab954daUL),
+ new Crc<ulong, ulong>(0x0000000000000463UL, 0xffffffffff840d0dUL, 0x00000000797d59f3UL),
+ new Crc<ulong, ulong>(0x00000000000f423fUL, 0x000000000001e0f3UL, 0x000000005c6b8093UL)
+ };
+
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32_r.csproj
new file mode 100644
index 0000000000..1fcdbb82ad
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32_r.csproj
@@ -0,0 +1,33 @@
+<?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>
+ </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>Embedded</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Crc32.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32_ro.csproj
new file mode 100644
index 0000000000..5dd67bb75a
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32_ro.csproj
@@ -0,0 +1,33 @@
+<?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>
+ </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>Embedded</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Crc32.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse42/Crc32.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse42/Crc32.cs
index 043bcbb2d0..3d420efa4a 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse42/Crc32.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse42/Crc32.cs
@@ -19,60 +19,8 @@ namespace IntelHardwareIntrinsicTest
ulong s1l = 0, s2l = 0, resl;
int testResult = Pass;
- if (!Sse42.IsSupported || !Environment.Is64BitProcess)
- {
- try
- {
- resl = Sse42.Crc32(s1l, s2l);
- Console.WriteLine("Intrinsic Sse42.Crc32 is called on non-supported hardware.");
- Console.WriteLine("Sse42.IsSupported " + Sse42.IsSupported);
- Console.WriteLine("Environment.Is64BitProcess " + Environment.Is64BitProcess);
- testResult = Fail;
- }
- catch (PlatformNotSupportedException)
- {
- }
-
- try
- {
- resl = Convert.ToUInt64(typeof(Sse42).GetMethod(nameof(Sse42.Crc32), new Type[] { s1l.GetType(), s2l.GetType() }).Invoke(null, new object[] { s1l, s2l }));
- Console.WriteLine("Intrinsic Sse42.Crc32 is called via reflection on non-supported hardware.");
- Console.WriteLine("Sse42.IsSupported " + Sse42.IsSupported);
- Console.WriteLine("Environment.Is64BitProcess " + Environment.Is64BitProcess);
- testResult = Fail;
- }
- catch (TargetInvocationException e) when (e.InnerException is PlatformNotSupportedException)
- {
- }
- }
-
-
if (Sse42.IsSupported)
{
- if (Environment.Is64BitProcess)
- {
- for (int i = 0; i < longCrcTable.Length; i++)
- {
- s1l = longCrcTable[i].s1;
- s2l = longCrcTable[i].s2;
-
- resl = Sse42.Crc32(s1l, s2l);
- if (resl != longCrcTable[i].res)
- {
- Console.WriteLine("{0}: Inputs: 0x{1,16:x}, 0x{2,16:x} Expected: 0x{3,16:x} actual: 0x{4,16:x}",
- i, s1l, s2l, longCrcTable[i].res, resl);
- testResult = Fail;
- }
-
- resl = Convert.ToUInt64(typeof(Sse42).GetMethod(nameof(Sse42.Crc32), new Type[] { s1l.GetType(), s2l.GetType() }).Invoke(null, new object[] { s1l, s2l }));
- if (resl != longCrcTable[i].res)
- {
- Console.WriteLine("{0}: Inputs: 0x{1,16:x}, 0x{2,16:x} Expected: 0x{3,16:x} actual: 0x{4,16:x} - Reflection",
- i, s1l, s2l, longCrcTable[i].res, resl);
- testResult = Fail;
- }
- }
- }
uint s1i, s2i, resi;
for (int i = 0; i < intCrcTable.Length; i++)
@@ -160,22 +108,6 @@ namespace IntelHardwareIntrinsicTest
}
}
- public static Crc<ulong, ulong>[] longCrcTable = {
- new Crc<ulong, ulong>(0x0000000000000000UL, 0x0000000000000000UL, 0x0000000000000000UL),
- new Crc<ulong, ulong>(0x0000000000000000UL, 0x0000000000000001UL, 0x00000000493c7d27UL),
- new Crc<ulong, ulong>(0x0000000000000001UL, 0x0000000000000000UL, 0x00000000493c7d27UL),
- new Crc<ulong, ulong>(0x0000000000000001UL, 0x0000000000000001UL, 0x0000000000000000UL),
- new Crc<ulong, ulong>(0x0000000000000000UL, 0xffffffffffffffffUL, 0x00000000c44ff94dUL),
- new Crc<ulong, ulong>(0xffffffffffffffffUL, 0x0000000000000000UL, 0x0000000073d74d75UL),
- new Crc<ulong, ulong>(0xffffffffffffffffUL, 0xffffffffffffffffUL, 0x00000000b798b438UL),
- new Crc<ulong, ulong>(0x0000000000000001UL, 0xffffffffffffffffUL, 0x000000008d73846aUL),
- new Crc<ulong, ulong>(0xffffffffffffffffUL, 0x0000000000000001UL, 0x000000003aeb3052UL),
- new Crc<ulong, ulong>(0xfffffffffffe1f0dUL, 0x00000000f5c1ddb3UL, 0x000000000504c066UL),
- new Crc<ulong, ulong>(0x0000000000000005UL, 0x000000bce1263cffUL, 0x000000004ab954daUL),
- new Crc<ulong, ulong>(0x0000000000000463UL, 0xffffffffff840d0dUL, 0x00000000797d59f3UL),
- new Crc<ulong, ulong>(0x00000000000f423fUL, 0x000000000001e0f3UL, 0x000000005c6b8093UL)
- };
-
public static Crc<uint, uint>[] intCrcTable = {
new Crc<uint, uint>(0x00000000U, 0x00000000U, 0x00000000U),
new Crc<uint, uint>(0x00000000U, 0x00000001U, 0xdd45aab8U),