summaryrefslogtreecommitdiff
path: root/tests/src/JIT/opt/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/JIT/opt/perf')
-rw-r--r--tests/src/JIT/opt/perf/doublealign/Arrays.csproj55
-rw-r--r--tests/src/JIT/opt/perf/doublealign/Locals.csproj55
-rw-r--r--tests/src/JIT/opt/perf/doublealign/app.config27
-rw-r--r--tests/src/JIT/opt/perf/doublealign/arrays.cs83
-rw-r--r--tests/src/JIT/opt/perf/doublealign/locals.cs127
5 files changed, 347 insertions, 0 deletions
diff --git a/tests/src/JIT/opt/perf/doublealign/Arrays.csproj b/tests/src/JIT/opt/perf/doublealign/Arrays.csproj
new file mode 100644
index 0000000000..663bc35ebd
--- /dev/null
+++ b/tests/src/JIT/opt/perf/doublealign/Arrays.csproj
@@ -0,0 +1,55 @@
+<?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>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT .0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </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>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType></DebugType>
+ <NoLogo>True</NoLogo>
+ <NoStandardLib>True</NoStandardLib>
+ <Noconfig>True</Noconfig>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="arrays.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="$(JitPackagesConfigFileDirectory)threading+thread\project.json" />
+ <None Include="app.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)threading+thread\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)threading+thread\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/opt/perf/doublealign/Locals.csproj b/tests/src/JIT/opt/perf/doublealign/Locals.csproj
new file mode 100644
index 0000000000..3220818756
--- /dev/null
+++ b/tests/src/JIT/opt/perf/doublealign/Locals.csproj
@@ -0,0 +1,55 @@
+<?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>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT .0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </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>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType></DebugType>
+ <NoLogo>True</NoLogo>
+ <NoStandardLib>True</NoStandardLib>
+ <Noconfig>True</Noconfig>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="locals.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" />
+ <None Include="app.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/opt/perf/doublealign/app.config b/tests/src/JIT/opt/perf/doublealign/app.config
new file mode 100644
index 0000000000..6f7bbd9d2b
--- /dev/null
+++ b/tests/src/JIT/opt/perf/doublealign/app.config
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
diff --git a/tests/src/JIT/opt/perf/doublealign/arrays.cs b/tests/src/JIT/opt/perf/doublealign/arrays.cs
new file mode 100644
index 0000000000..c566eda83e
--- /dev/null
+++ b/tests/src/JIT/opt/perf/doublealign/arrays.cs
@@ -0,0 +1,83 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Runtime.CompilerServices;
+
+public class CMyException : System.Exception
+{
+}
+
+public class CTest
+{
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ private static void UseByte(byte x)
+ {
+ }
+
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ private static unsafe void CheckDoubleAlignment(double* p)
+ {
+ if (((int)p % sizeof(double)) != 0)
+ throw new CMyException();
+ }
+
+ private static void DoGC()
+ {
+ System.GC.Collect();
+ System.GC.WaitForPendingFinalizers();
+ System.Threading.Thread.Sleep(100);
+ }
+
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ private static unsafe void TestArrays1(int n, double d)
+ {
+ int i, j;
+
+ double[][] a = new double[n][];
+ byte[][] b = new byte[n][];
+
+
+ for (i = 0; i < n; i++)
+ {
+ a[i] = new double[i + 1];
+ fixed (double* p = &a[i][0])
+ {
+ CheckDoubleAlignment(p);
+ }
+ b[i] = new byte[i + 1];
+ }
+
+ for (i = 0; i < n; i++)
+ {
+ for (j = 1; j <= i; j++)
+ {
+ a[i][j] += a[i][j - 1];
+ b[i][j] = 48;
+ }
+ }
+
+ for (i = 0; i < n; i++)
+ {
+ UseByte(b[i][i]);
+ UseByte((byte)a[i][i]);
+ }
+ }
+
+ public static int Main()
+ {
+ try
+ {
+ TestArrays1(100, 2.0);
+ }
+ catch (CMyException)
+ {
+ Console.WriteLine("FAILED");
+ return 101;
+ }
+ Console.WriteLine("PASSED");
+ return 100;
+ }
+}
diff --git a/tests/src/JIT/opt/perf/doublealign/locals.cs b/tests/src/JIT/opt/perf/doublealign/locals.cs
new file mode 100644
index 0000000000..c3a9581b2b
--- /dev/null
+++ b/tests/src/JIT/opt/perf/doublealign/locals.cs
@@ -0,0 +1,127 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Runtime.CompilerServices;
+
+public class CMyException : System.Exception
+{
+}
+
+public class CTest
+{
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ private static void UseShort(short x)
+ {
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ private static void UseByte(byte x)
+ {
+ }
+
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ private static unsafe void CheckDoubleAlignment(double* p)
+ {
+ if (((int)p % sizeof(double)) != 0)
+ throw new CMyException();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ private static unsafe void TestLocals1(short a, double b, byte c, double d)
+ {
+ short i16;
+ double d1;
+ byte i8;
+ double d2;
+
+ i16 = a;
+ i8 = c;
+ d1 = b;
+ d2 = d;
+
+ CheckDoubleAlignment(&d1);
+ CheckDoubleAlignment(&d2);
+
+ i16 += (short)d1;
+ i8 += (byte)d2;
+
+ UseShort(i16);
+ UseByte(i8);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ private static unsafe void TestLocals2(short a, double b, byte c, double d)
+ {
+ char c1;
+ double d1;
+ CMyException e1 = new CMyException();
+ byte b1;
+ short s1;
+ double d2;
+ int[] a1 = new int[1];
+ int i1;
+ int i2;
+ int i3;
+ int i4;
+ int i5;
+ double d3;
+ byte b3;
+ byte b5;
+ double d5;
+ sbyte b4 = 5;
+ double d6;
+ int i6;
+
+ c1 = (char)a;
+ b1 = b3 = c;
+ d1 = b;
+ d2 = d;
+ d3 = d1 + d2;
+ d5 = d1 * 3;
+ i1 = a;
+ i2 = c;
+ i3 = a + c;
+ i4 = a - c;
+ i5 = i1--;
+ i6 = i3 * i4;
+ s1 = (short)(a + 5);
+ b4 += (sbyte)c;
+
+ byte b2 = (byte)-b1;
+ double d4 = d3 / 2;
+ b5 = (byte)b;
+ d6 = b1++;
+
+ CheckDoubleAlignment(&d1);
+ CheckDoubleAlignment(&d2);
+ CheckDoubleAlignment(&d3);
+ CheckDoubleAlignment(&d4);
+ CheckDoubleAlignment(&d5);
+ CheckDoubleAlignment(&d6);
+
+ b3 -= (byte)(d5 * b4 - b5);
+ s1 += (short)(d1 + d6 - (i1 + i2 + i3 + i4 + i5 + i6));
+ b1 += (byte)(b3 + d2 - (i1 * 3 + i2 - i3 - i4 * i5 - (i6 >> 2)));
+
+ UseShort(s1);
+ UseByte(b1);
+ }
+
+ public static int Main()
+ {
+ try
+ {
+ TestLocals1(1, 2, 3, 4);
+ TestLocals2(1, 2, 3, 4);
+ }
+ catch (CMyException)
+ {
+ Console.WriteLine("FAILED");
+ return 101;
+ }
+ Console.WriteLine("PASSED");
+ return 100;
+ }
+}