summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2019-03-06 10:07:07 -0800
committerGitHub <noreply@github.com>2019-03-06 10:07:07 -0800
commitb7922721dc7298094da3f4c2bcf31b43fde9476b (patch)
tree1d76510c823368a716708edaeb1c9abde1b00578 /tests
parent5a2650959268bf0a760965a2bd8cca34301cd1a1 (diff)
parentc5da1c4c42f1f1bc3f8254bc9c50bcd431f10001 (diff)
downloadcoreclr-b7922721dc7298094da3f4c2bcf31b43fde9476b.tar.gz
coreclr-b7922721dc7298094da3f4c2bcf31b43fde9476b.tar.bz2
coreclr-b7922721dc7298094da3f4c2bcf31b43fde9476b.zip
Merge pull request #22912 from fiigii/fixBroadcast
Fix BroadcastScalarToVector128/256 codegen
Diffstat (limited to 'tests')
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_22815/GitHub_22815.cs235
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_22815/GitHub_22815_r.csproj34
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_22815/GitHub_22815_ro.csproj34
3 files changed, 303 insertions, 0 deletions
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_22815/GitHub_22815.cs b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_22815/GitHub_22815.cs
new file mode 100644
index 0000000000..70a977a1c5
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_22815/GitHub_22815.cs
@@ -0,0 +1,235 @@
+using System;
+using System.Runtime.Intrinsics.X86;
+using System.Runtime.Intrinsics;
+
+namespace GitHub_22815
+{
+ class Program
+ {
+ const int Pass = 100;
+ const int Fail = 0;
+
+ static int Main(string[] args)
+ {
+ bool result = true;
+ if (Avx2.IsSupported)
+ {
+ result = test128((byte)1) && test128((sbyte)1) && test128((short)1) &&
+ test128((ushort)1) && test128((int)1) && test128((uint)1) &&
+ test128((long)1) && test128((ulong)1) &&
+ test256((byte)1) && test256((sbyte)1) && test256((short)1) &&
+ test256((ushort)1) && test256((int)1) && test256((uint)1) &&
+ test256((long)1) && test256((ulong)1);
+ }
+ return result ? Pass : Fail;
+ }
+
+ static unsafe bool test128(byte v)
+ {
+ var vec = Avx2.BroadcastScalarToVector128(&v);
+ for (int i = 0; i < Vector128<byte>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test128(sbyte v)
+ {
+ var vec = Avx2.BroadcastScalarToVector128(&v);
+ for (int i = 0; i < Vector128<sbyte>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test128(short v)
+ {
+ var vec = Avx2.BroadcastScalarToVector128(&v);
+ for (int i = 0; i < Vector128<short>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test128(ushort v)
+ {
+ var vec = Avx2.BroadcastScalarToVector128(&v);
+ for (int i = 0; i < Vector128<ushort>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test128(int v)
+ {
+ var vec = Avx2.BroadcastScalarToVector128(&v);
+ for (int i = 0; i < Vector128<int>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test128(uint v)
+ {
+ var vec = Avx2.BroadcastScalarToVector128(&v);
+ for (int i = 0; i < Vector128<uint>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test128(long v)
+ {
+ var vec = Avx2.BroadcastScalarToVector128(&v);
+ for (int i = 0; i < Vector128<long>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test128(ulong v)
+ {
+ var vec = Avx2.BroadcastScalarToVector128(&v);
+ for (int i = 0; i < Vector128<ulong>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test256(byte v)
+ {
+ var vec = Avx2.BroadcastScalarToVector256(&v);
+ for (int i = 0; i < Vector256<byte>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test256(sbyte v)
+ {
+ var vec = Avx2.BroadcastScalarToVector256(&v);
+ for (int i = 0; i < Vector256<sbyte>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test256(short v)
+ {
+ var vec = Avx2.BroadcastScalarToVector256(&v);
+ for (int i = 0; i < Vector256<short>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test256(ushort v)
+ {
+ var vec = Avx2.BroadcastScalarToVector256(&v);
+ for (int i = 0; i < Vector256<ushort>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test256(int v)
+ {
+ var vec = Avx2.BroadcastScalarToVector256(&v);
+ for (int i = 0; i < Vector256<int>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test256(uint v)
+ {
+ var vec = Avx2.BroadcastScalarToVector256(&v);
+ for (int i = 0; i < Vector256<uint>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test256(long v)
+ {
+ var vec = Avx2.BroadcastScalarToVector256(&v);
+ for (int i = 0; i < Vector256<long>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ static unsafe bool test256(ulong v)
+ {
+ var vec = Avx2.BroadcastScalarToVector256(&v);
+ for (int i = 0; i < Vector256<ulong>.Count; i++)
+ {
+ if (vec.GetElement(i) != v)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+}
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_22815/GitHub_22815_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_22815/GitHub_22815_r.csproj
new file mode 100644
index 0000000000..f120b6df68
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_22815/GitHub_22815_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>Embedded</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="GitHub_22815.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_22815/GitHub_22815_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_22815/GitHub_22815_ro.csproj
new file mode 100644
index 0000000000..f8858c76bf
--- /dev/null
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_22815/GitHub_22815_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>Embedded</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="GitHub_22815.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>