diff options
author | Carol Eidt <carol.eidt@microsoft.com> | 2019-01-10 18:35:56 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-10 18:35:56 -0800 |
commit | b3881b417c808fa565f85d1ba04d126a333eaa38 (patch) | |
tree | 6a14d0ef684925567b4c2f79fb3456daabe2cde7 /tests | |
parent | 360e70f8935bf1c429b61713affe38114378a928 (diff) | |
parent | 34569bd74ec2df228a054e9f1c9fb6fb53b9fe17 (diff) | |
download | coreclr-b3881b417c808fa565f85d1ba04d126a333eaa38.tar.gz coreclr-b3881b417c808fa565f85d1ba04d126a333eaa38.tar.bz2 coreclr-b3881b417c808fa565f85d1ba04d126a333eaa38.zip |
Merge pull request #21928 from fiigii/fixMulx
Don't optimize MultiplyNoFlags away
Diffstat (limited to 'tests')
3 files changed, 138 insertions, 0 deletions
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899.cs b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899.cs new file mode 100644 index 0000000000..31a51015f6 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899.cs @@ -0,0 +1,70 @@ +using System; +using System.Runtime.Intrinsics.X86; +using System.Runtime.Intrinsics; +using System.Runtime.CompilerServices; + +namespace GitHub_21899 +{ + class GitHub_21899 + { + + static int Main(string[] args) + { + bool pass = true; + pass = test1() && test2() && test3() && test4(); + return pass ? 100 : 0; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static unsafe ulong MultiplyNoFlags1(ulong a, ulong b) + { + ulong r; + Bmi2.X64.MultiplyNoFlags(a, b, &r); + return r; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static unsafe ulong MultiplyNoFlags2(ulong a, ulong b) + { + ulong r; + r = Bmi2.X64.MultiplyNoFlags(a, b, &r); + return r; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static unsafe uint MultiplyNoFlags3(uint a, uint b) + { + uint r; + Bmi2.MultiplyNoFlags(a, b, &r); + return r; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static unsafe uint MultiplyNoFlags4(uint a, uint b) + { + uint r; + r = Bmi2.MultiplyNoFlags(a, b, &r); + return r; + } + + static bool test1() + { + return !Bmi2.X64.IsSupported || (MultiplyNoFlags1(1111111111111UL, 1111111111111UL) == 1107357235536201905UL); + } + + static bool test2() + { + return !Bmi2.X64.IsSupported || (MultiplyNoFlags2(1111111111111UL, 1111111111111UL) == 66926UL); + } + + static bool test3() + { + return !Bmi2.IsSupported || (MultiplyNoFlags3(1111111U, 1111111U) == 1912040369U); + } + + static bool test4() + { + return !Bmi2.IsSupported || (MultiplyNoFlags4(1111111U, 1111111U) == 287U); + } + } +} diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899_r.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899_r.csproj new file mode 100644 index 0000000000..c4589de648 --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899_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_21899.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_21899/GitHub_21899_ro.csproj b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899_ro.csproj new file mode 100644 index 0000000000..05e730657a --- /dev/null +++ b/tests/src/JIT/HardwareIntrinsics/X86/Regression/GitHub_21899/GitHub_21899_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_21899.cs" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup> +</Project> |