forked from dotnet/coreclr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle SIMD8/LONG recasts for LCL_FLD
Lowering needs to insert a `BITCAST` in the case of a `STORE_LCL_FLD` with mismatched `TYP_SIMD8`/`TYP_LONG` operands, just as for `STORE_LCL_VAR`.
- Loading branch information
Showing
3 changed files
with
100 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
tests/src/JIT/Regression/JitBlue/DevDiv_590358/DevDiv_590358.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.Numerics; | ||
|
||
// In this test case, we have a struct S that contains a single Vector2 field (Vector), | ||
// with an implicit conversion from an array of float to S. | ||
// We inline a call to this op_Implicit, and then the constructor that it invokes. | ||
// The op_Implicit RET_EXPR is TYP_LONG, since that's how the value is returned from the method. | ||
// It is then stored to the Vector field which is TYP_SIMD8. | ||
// | ||
// Bug: The JIT had code to deal with this kind of retyping (which must be made explicit by | ||
// Lowering, as the two types require different register types), when it involves locals | ||
// (GT_LCL_VAR) but not fields of locals (GT_LCL_FLD). | ||
// | ||
// Perf Issue: What we wind up with is this: (V05 & V07 are both TYP_SIMD8, V01 is the struct type S | ||
// V05 = *(TYP_SIMD8)numbers | ||
// V07 = V05 | ||
// LCL_FLD(V01) = LCL_FLD(V07) // Both re-typed as TYP_LONG | ||
// This generates: | ||
// vmovsd xmm0, qword ptr [rax+16] | ||
// vmovsd qword ptr[rsp + 28H], xmm0 | ||
// vmovsd xmm0, qword ptr[rsp + 28H] | ||
// vmovsd qword ptr[rsp + 20H], xmm0 | ||
// vmovsd xmm0, qword ptr[rsp + 20H] | ||
// vmovsd qword ptr[rsp + 30H], xmm0 | ||
// | ||
// We should be able to elide these excessive copies and unnecessary retyping, producing close to this: | ||
// vmovsd xmm0, qword ptr [rax+16] | ||
// vmovsd qword ptr[rsp + 30H], xmm0 | ||
|
||
namespace Repro | ||
{ | ||
class Program | ||
{ | ||
struct S | ||
{ | ||
public Vector2 Vector; | ||
public S(float[] numbers) | ||
{ | ||
Vector = new Vector2(numbers[0], numbers[1]); | ||
} | ||
public static implicit operator S(float[] numbers) => new S(numbers); | ||
} | ||
static int Main(string[] args) | ||
{ | ||
S s = new float[] { 1.0f, 2.0f }; | ||
Console.WriteLine(s.Vector); | ||
if ((s.Vector.X != 1.0f) || (s.Vector.Y != 2.0f)) | ||
{ | ||
return -1; | ||
} | ||
else | ||
{ | ||
return 100; | ||
} | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
tests/src/JIT/Regression/JitBlue/DevDiv_590358/DevDiv_590358.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?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> | ||
<AssemblyName>$(MSBuildProjectName)</AssemblyName> | ||
<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' "> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> | ||
<Visible>False</Visible> | ||
</CodeAnalysisDependentAssemblyPaths> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<DebugType></DebugType> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> | ||
</ItemGroup> | ||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> | ||
<PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> | ||
</PropertyGroup> | ||
</Project> |