summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2018-04-04 10:40:03 -0700
committerCarol Eidt <carol.eidt@microsoft.com>2018-04-04 13:55:50 -0700
commit22b2d86b276d78794c1e102b0d10b2cf039a90e4 (patch)
tree608f32a0d0c9fe08f8b320a6b8fa95baaf857179 /tests
parent757cb82a5800fd043713d7ee40feba1dd2c89793 (diff)
downloadcoreclr-22b2d86b276d78794c1e102b0d10b2cf039a90e4.tar.gz
coreclr-22b2d86b276d78794c1e102b0d10b2cf039a90e4.tar.bz2
coreclr-22b2d86b276d78794c1e102b0d10b2cf039a90e4.zip
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`.
Diffstat (limited to 'tests')
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_590358/DevDiv_590358.cs57
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_590358/DevDiv_590358.csproj37
2 files changed, 94 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_590358/DevDiv_590358.cs b/tests/src/JIT/Regression/JitBlue/DevDiv_590358/DevDiv_590358.cs
new file mode 100644
index 0000000000..dd690d1d52
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_590358/DevDiv_590358.cs
@@ -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;
+ }
+ }
+ }
+}
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_590358/DevDiv_590358.csproj b/tests/src/JIT/Regression/JitBlue/DevDiv_590358/DevDiv_590358.csproj
new file mode 100644
index 0000000000..6d58ab0227
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_590358/DevDiv_590358.csproj
@@ -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>