diff options
author | Tanner Gooding <tagoo@outlook.com> | 2019-01-07 16:57:34 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-07 16:57:34 -0800 |
commit | ccaf35e1e0dc6bbfb86e4fe6b8c24fe8fe346e55 (patch) | |
tree | 38b89a737ea572c515fce1fd910c368333eb96a2 /tests | |
parent | c2ac0f95ae6d453634dbe42159ad1f740cbe0958 (diff) | |
download | coreclr-ccaf35e1e0dc6bbfb86e4fe6b8c24fe8fe346e55.tar.gz coreclr-ccaf35e1e0dc6bbfb86e4fe6b8c24fe8fe346e55.tar.bz2 coreclr-ccaf35e1e0dc6bbfb86e4fe6b8c24fe8fe346e55.zip |
Fixing ContainCheckHWIntrinsic to ensure that scalar integer operands are the appropriate size (#21641)
* Fixing ContainCheckHWIntrinsic to ensure that scalar integer operands are the appropriate size
* Adding a regression test for issue 21625
* Fixing IsContainableHWIntrinsicOp to use the containing node type (rather than the simd base type) for Scalar intrinsics
* Fixing the containment check for `Sse41.Insert(V128<float>, V128<float>, byte)`
* Cleaning up the isContainableHWIntrinsicOp logic in lowerxarch.cpp
* Restrict containment to genActualType(baseType)
* Formatting
* Removing some comments and simplifying the supportsContainment checks for various HWIntrinsics that take a scalar operand
* Applying formatting patch
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/JIT/Regression/JitBlue/GitHub_21625/GitHub_21625.cs | 52 | ||||
-rw-r--r-- | tests/src/JIT/Regression/JitBlue/GitHub_21625/GitHub_21625.csproj | 36 |
2 files changed, 88 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_21625/GitHub_21625.cs b/tests/src/JIT/Regression/JitBlue/GitHub_21625/GitHub_21625.cs new file mode 100644 index 0000000000..405d6ff5f7 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_21625/GitHub_21625.cs @@ -0,0 +1,52 @@ +// 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.Intrinsics; +using System.Runtime.Intrinsics.X86; + +namespace GitHub_21625 +{ + public class test + { + public static Vector128<ushort> CreateScalar(ushort value) + { + if (Sse2.IsSupported) + { + return Sse2.ConvertScalarToVector128UInt32(value).AsUInt16(); + } + + return SoftwareFallback(value); + + Vector128<ushort> SoftwareFallback(ushort x) + { + var result = Vector128<ushort>.Zero; + Unsafe.WriteUnaligned(ref Unsafe.As<Vector128<ushort>, byte>(ref result), value); + return result; + } + } + + static int Main() + { + ushort value = TestLibrary.Generator.GetUInt16(); + Vector128<ushort> result = CreateScalar(value); + + if (result.GetElement(0) != value) + { + return 0; + } + + for (int i = 1; i < Vector128<ushort>.Count; i++) + { + if (result.GetElement(i) != 0) + { + return 0; + } + } + + return 100; + } + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_21625/GitHub_21625.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_21625/GitHub_21625.csproj new file mode 100644 index 0000000000..17a6d4efe0 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_21625/GitHub_21625.csproj @@ -0,0 +1,36 @@ +<?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>{2649FAFE-07BF-4F93-8120-BA9A69285ABB}</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' "></PropertyGroup> + <PropertyGroup> + <DebugType>None</DebugType> + <Optimize>True</Optimize> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <ItemGroup> + <Compile Include="$(MSBuildProjectName).cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="$(SourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup> +</Project> |