diff options
4 files changed, 146 insertions, 0 deletions
diff --git a/src/jit/gentree.h b/src/jit/gentree.h index 49c5682df0..6a1fd4a9bb 100644 --- a/src/jit/gentree.h +++ b/src/jit/gentree.h @@ -4072,6 +4072,10 @@ struct GenTreeHWIntrinsic : public GenTreeJitIntrinsic , gtHWIntrinsicId(hwIntrinsicID) , gtIndexBaseType(TYP_UNKNOWN) { + if (OperIsMemoryStore()) + { + gtFlags |= (GTF_GLOB_REF | GTF_ASG); + } } GenTreeHWIntrinsic( @@ -4080,6 +4084,10 @@ struct GenTreeHWIntrinsic : public GenTreeJitIntrinsic , gtHWIntrinsicId(hwIntrinsicID) , gtIndexBaseType(TYP_UNKNOWN) { + if (OperIsMemoryStore()) + { + gtFlags |= (GTF_GLOB_REF | GTF_ASG); + } } // Note that HW Instrinsic instructions are a sub class of GenTreeOp which only supports two operands 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> |