diff options
Diffstat (limited to 'tests/src/JIT/Directed')
-rw-r--r-- | tests/src/JIT/Directed/shift/uint64Opt.cs | 178 | ||||
-rw-r--r-- | tests/src/JIT/Directed/shift/uint64Opt_d.csproj | 47 | ||||
-rw-r--r-- | tests/src/JIT/Directed/shift/uint64Opt_do.csproj | 46 | ||||
-rw-r--r-- | tests/src/JIT/Directed/shift/uint64Opt_r.csproj | 47 | ||||
-rw-r--r-- | tests/src/JIT/Directed/shift/uint64Opt_ro.csproj | 46 |
5 files changed, 364 insertions, 0 deletions
diff --git a/tests/src/JIT/Directed/shift/uint64Opt.cs b/tests/src/JIT/Directed/shift/uint64Opt.cs new file mode 100644 index 0000000000..1c8a984e7f --- /dev/null +++ b/tests/src/JIT/Directed/shift/uint64Opt.cs @@ -0,0 +1,178 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// + +using System; + +// Test long and ulong shifts by 0, 32 and 64 constants that can be optimized. +namespace ShiftTest +{ + + public class ulong64Test + { + static int shiftByZero(ulong arg) + { + if (arg != arg << 0) + { + return -1; + } + if (arg != arg >> 0) + { + return -1; + } + return 100; + } + + static int shiftBy32(ulong arg) + { + ulong powerOfTwo = 0x100000000UL; + if (arg * powerOfTwo != arg << 32) + { + return -1; + } + if (arg / powerOfTwo != arg >> 32) + { + return -1; + } + return 100; + } + + static int shiftBy64(ulong arg) + { + // The shift count is computed from count & 0x3F. + if (arg != arg << 64) + { + return -1; + } + if (arg != arg >> 64) + { + return -1; + } + return 100; + } + + public static int run(ulong arg) + { + bool passed = true; + if (shiftByZero(arg) != 100) + { + passed = false; + Console.WriteLine("FAILED for uLong shiftByZero"); + } + if (shiftBy32(arg) != 100) + { + passed = false; + Console.WriteLine("FAILED for uLong shiftBy32"); + } + if (shiftBy64(arg) != 100) + { + passed = false; + Console.WriteLine("FAILED for uLong shiftBy64"); + } + if (passed) + { + return 100; + } + return -1; + } + } + + public class long64Test + { + static int shiftByZero(long arg) + { + if (arg != arg << 0) + { + return -1; + } + if (arg != arg >> 0) + { + return -1; + } + return 100; + } + + static int shiftBy32(long arg) + { + long powerOfTwo = 0x100000000L; + if (arg * powerOfTwo != arg << 32) + { + return -1; + } + if (arg / powerOfTwo != arg >> 32) + { + return -1; + } + return 100; + } + + static int shiftBy64(long arg) + { + // The shift count is computed from count & 0x3F. + if (arg != arg << 64) + { + return -1; + } + if (arg != arg >> 64) + { + return -1; + } + if (-arg != -arg >> 64) + { + return -1; + } + return 100; + } + + public static int run(long arg) + { + bool passed = true; + if (shiftByZero(arg) != 100) + { + passed = false; + Console.WriteLine("FAILED for Long shiftByZero"); + } + if (shiftBy32(arg) != 100) + { + passed = false; + Console.WriteLine("FAILED for Long shiftBy32"); + } + if (shiftBy64(arg) != 100) + { + passed = false; + Console.WriteLine("FAILED for Long shiftBy64"); + } + if (passed) + { + return 100; + } + return -1; + } + } + + class Test + { + public static int Main() + { + bool passed = true; + ulong ulongArg = 0x3F134; + if (ulong64Test.run(ulongArg) != 100) + { + passed = false; + } + long longArg = 0x3F134; + if (long64Test.run(longArg) != 100) + { + passed = false; + } + if (passed) + { + Console.WriteLine("PASSED"); + return 100; + } + Console.WriteLine("FAILED"); + return -1; + } + } +} diff --git a/tests/src/JIT/Directed/shift/uint64Opt_d.csproj b/tests/src/JIT/Directed/shift/uint64Opt_d.csproj new file mode 100644 index 0000000000..dc1d1e1b7a --- /dev/null +++ b/tests/src/JIT/Directed/shift/uint64Opt_d.csproj @@ -0,0 +1,47 @@ +<?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>{1562736B-261A-40CC-8AFE-C0F1C2892DEB}</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\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <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> + <DebugType> + </DebugType> + <Optimize> + </Optimize> + </PropertyGroup> + <ItemGroup> + <Compile Include="uint64Opt.cs" /> + </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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/shift/uint64Opt_do.csproj b/tests/src/JIT/Directed/shift/uint64Opt_do.csproj new file mode 100644 index 0000000000..cbef86f528 --- /dev/null +++ b/tests/src/JIT/Directed/shift/uint64Opt_do.csproj @@ -0,0 +1,46 @@ +<?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>{8FB8C934-E5DA-4A20-930B-5C30BE80831A}</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\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <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> + <DebugType> + </DebugType> + <Optimize>True</Optimize> + </PropertyGroup> + <ItemGroup> + <Compile Include="uint64Opt.cs" /> + </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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/shift/uint64Opt_r.csproj b/tests/src/JIT/Directed/shift/uint64Opt_r.csproj new file mode 100644 index 0000000000..157c0abaec --- /dev/null +++ b/tests/src/JIT/Directed/shift/uint64Opt_r.csproj @@ -0,0 +1,47 @@ +<?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>{DB8A5DD9-466F-484E-AEBA-2B78F1FF3633}</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\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <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> + <DebugType> + </DebugType> + <Optimize> + </Optimize> + </PropertyGroup> + <ItemGroup> + <Compile Include="uint64Opt.cs" /> + </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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/shift/uint64Opt_ro.csproj b/tests/src/JIT/Directed/shift/uint64Opt_ro.csproj new file mode 100644 index 0000000000..c7e008d96d --- /dev/null +++ b/tests/src/JIT/Directed/shift/uint64Opt_ro.csproj @@ -0,0 +1,46 @@ +<?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>{50453737-C530-4473-8D14-123A43C9DA9F}</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\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <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> + <DebugType> + </DebugType> + <Optimize>True</Optimize> + </PropertyGroup> + <ItemGroup> + <Compile Include="uint64Opt.cs" /> + </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>
\ No newline at end of file |