summaryrefslogtreecommitdiff
path: root/tests/src/JIT/HardwareIntrinsics/X86/Sse2
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2018-03-14 14:56:50 -0700
committerGitHub <noreply@github.com>2018-03-14 14:56:50 -0700
commit81bffab55632d3404ab2e39775b09ad3ca191050 (patch)
treea9d067cb075908e76a28cbb4584ce6eeb7935209 /tests/src/JIT/HardwareIntrinsics/X86/Sse2
parent76be5e3928cbfa01e96086e532a6476f1acac293 (diff)
parentbd55cc7f832b44500d9f8ee0ced8c205247436f9 (diff)
downloadcoreclr-81bffab55632d3404ab2e39775b09ad3ca191050.tar.gz
coreclr-81bffab55632d3404ab2e39775b09ad3ca191050.tar.bz2
coreclr-81bffab55632d3404ab2e39775b09ad3ca191050.zip
Merge pull request #16832 from dotnetrt/StoreNonTemporal
Implement SSE2 StoreNonTemporal HW intrinsic - complete SSE2 ISA
Diffstat (limited to 'tests/src/JIT/HardwareIntrinsics/X86/Sse2')
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal.cs171
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal_ro.csproj34
3 files changed, 239 insertions, 0 deletions
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal.cs
new file mode 100644
index 0000000000..76b468e12e
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal.cs
@@ -0,0 +1,171 @@
+// 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)
+ {
+ 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;
+ int* outBuffer = stackalloc int[4];
+
+ Sse2.StoreNonTemporal(outBuffer, inArray[0]);
+
+ for (var i = 0; i < 4; i++)
+ {
+ if (inArray[i] != outBuffer[i])
+ {
+ Console.WriteLine("Sse2 StoreNonTemporal failed on int:");
+ for (var n = 0; n < 4; n++)
+ {
+ Console.Write(outBuffer[n] + ", ");
+ }
+ Console.WriteLine();
+
+ testResult = Fail;
+ break;
+ }
+ }
+ }
+
+ {
+ uint* inArray = stackalloc uint[4];
+ inArray[0] = 0xffffff02u;
+ uint* outBuffer = stackalloc uint[4];
+
+ Sse2.StoreNonTemporal(outBuffer, inArray[0]);
+
+ for (var i = 0; i < 4; i++)
+ {
+ if (inArray[i] != outBuffer[i])
+ {
+ Console.WriteLine("Sse2 StoreNonTemporal failed on uint:");
+ for (var n = 0; n < 4; n++)
+ {
+ Console.Write(outBuffer[n] + ", ");
+ }
+ Console.WriteLine();
+
+ testResult = Fail;
+ break;
+ }
+ }
+ }
+ }
+
+ return testResult;
+ }
+ }
+}
+
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal_r.csproj
new file mode 100644
index 0000000000..8ca2a261c6
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal_r.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="StoreNonTemporal.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal_ro.csproj
new file mode 100644
index 0000000000..4f00c2b7c5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse2/StoreNonTemporal_ro.csproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="StoreNonTemporal.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project> \ No newline at end of file