summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFei Peng <fei.peng@intel.com>2017-09-15 13:01:13 -0700
committerJan Kotas <jkotas@microsoft.com>2017-09-29 14:23:43 -0700
commit4252e77681840228d95318e920d649bb5b27ea82 (patch)
tree482719ef7759b8328b2a7710beb2f1717a4618c7 /tests
parent77eb81c4c5a72017b9fd95811e3e92adcb5a9d75 (diff)
downloadcoreclr-4252e77681840228d95318e920d649bb5b27ea82.tar.gz
coreclr-4252e77681840228d95318e920d649bb5b27ea82.tar.bz2
coreclr-4252e77681840228d95318e920d649bb5b27ea82.zip
Implement IsSuppoored for all ISA classes
Diffstat (limited to 'tests')
-rw-r--r--tests/src/Common/test_dependencies/test_dependencies.csproj3
-rw-r--r--tests/src/JIT/HardwareIntrinsics/IsSupported.cs89
-rw-r--r--tests/src/JIT/HardwareIntrinsics/IsSupported.csproj33
3 files changed, 125 insertions, 0 deletions
diff --git a/tests/src/Common/test_dependencies/test_dependencies.csproj b/tests/src/Common/test_dependencies/test_dependencies.csproj
index 9eefab2f10..e9d78ecb53 100644
--- a/tests/src/Common/test_dependencies/test_dependencies.csproj
+++ b/tests/src/Common/test_dependencies/test_dependencies.csproj
@@ -22,6 +22,9 @@
<PackageReference Include="System.Security.Permissions">
<Version>$(CoreFxPackageVersion)</Version>
</PackageReference>
+ <PackageReference Include="System.Runtime.Intrinsics.X86">
+ <Version>4.5.0-preview1-25718-03</Version>
+ </PackageReference>
</ItemGroup>
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
diff --git a/tests/src/JIT/HardwareIntrinsics/IsSupported.cs b/tests/src/JIT/HardwareIntrinsics/IsSupported.cs
new file mode 100644
index 0000000000..9f6d924b95
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/IsSupported.cs
@@ -0,0 +1,89 @@
+// 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.Runtime.Intrinsics.X86;
+
+namespace IntelHardwareIntrinsicTest
+{
+ class Program
+ {
+ static int Main(string[] args)
+ {
+ bool result = true;
+ if (Avx2.IsSupported)
+ {
+ if (Avx.IsSupported)
+ {
+ if (!Sse42.IsSupported)
+ {
+ result = false;
+ }
+
+ if (Sse41.IsSupported)
+ {
+ if (Ssse3.IsSupported)
+ {
+ if (Sse3.IsSupported)
+ {
+ if (Sse2.IsSupported && Sse.IsSupported)
+ {
+ result = result && true;
+ }
+ else
+ {
+ result = false;
+ }
+ }
+ else
+ {
+ result = false;
+ }
+ }
+ else
+ {
+ result = false;
+ }
+ }
+ else
+ {
+ result = false;
+ }
+ }
+ if (Aes.IsSupported && Bmi1.IsSupported && Bmi2.IsSupported && Fma.IsSupported &&
+ Lzcnt.IsSupported && Popcnt.IsSupported && Pclmulqdq.IsSupported)
+ {
+ result = result && true;
+ }
+ else
+ {
+ result = false;
+ }
+ }
+
+ // Non-X86 platforms
+ if (!(Sse.IsSupported))
+ {
+ if (Sse2.IsSupported ||
+ Sse3.IsSupported ||
+ Ssse3.IsSupported ||
+ Sse41.IsSupported ||
+ Sse42.IsSupported ||
+ Avx.IsSupported ||
+ Avx2.IsSupported ||
+ Aes.IsSupported ||
+ Bmi1.IsSupported ||
+ Bmi2.IsSupported ||
+ Fma.IsSupported ||
+ Lzcnt.IsSupported ||
+ Popcnt.IsSupported||
+ Pclmulqdq.IsSupported)
+ {
+ result = false;
+ }
+ }
+ return result ? 100 : 0;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/tests/src/JIT/HardwareIntrinsics/IsSupported.csproj b/tests/src/JIT/HardwareIntrinsics/IsSupported.csproj
new file mode 100644
index 0000000000..e8f88b5a40
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/IsSupported.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>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="IsSupported.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project> \ No newline at end of file