summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2017-02-10 17:05:34 -0800
committerCarol Eidt <carol.eidt@microsoft.com>2017-02-10 17:05:34 -0800
commit106379c0432f1ed5320d102a5c71d220138ac702 (patch)
tree86baaab969b1da21744b2c5c606b74cdf33f273d /tests
parent91be288f0d63c801f3aa6cbf9abd9ed852b0666f (diff)
downloadcoreclr-106379c0432f1ed5320d102a5c71d220138ac702.tar.gz
coreclr-106379c0432f1ed5320d102a5c71d220138ac702.tar.bz2
coreclr-106379c0432f1ed5320d102a5c71d220138ac702.zip
Add a test case for PR #9496
Diffstat (limited to 'tests')
-rw-r--r--tests/src/JIT/SIMD/Vector3GetHash.cs80
-rw-r--r--tests/src/JIT/SIMD/Vector3GetHash_r.csproj46
-rw-r--r--tests/src/JIT/SIMD/Vector3GetHash_ro.csproj46
3 files changed, 172 insertions, 0 deletions
diff --git a/tests/src/JIT/SIMD/Vector3GetHash.cs b/tests/src/JIT/SIMD/Vector3GetHash.cs
new file mode 100644
index 0000000000..21742e0ef3
--- /dev/null
+++ b/tests/src/JIT/SIMD/Vector3GetHash.cs
@@ -0,0 +1,80 @@
+// 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.
+
+// This was copied from corefx\src\System.Numerics.Vectors\tests\Vector3Tests.cs.
+// It exposed a bug in morph, in which a SIMD field was being morphed in
+// a MACK_Ind context, even though it was under a GT_IND(G_ADDR()).
+// This was corefx issue #15713, and was "fixed" with coreclr PR # 9496,
+// and a new issue, #9518, has been filed to track the underlying unexpected
+// MACK_Ind context, which causes us to mark the Vector3 local as do-not-enregister.
+
+using System;
+using System.Numerics;
+
+internal partial class VectorTest
+{
+ private const int Pass = 100;
+ private const int Fail = -1;
+
+ public class Assert
+ {
+ public static void Equal(float f1, float f2)
+ {
+ if (f1 != f2)
+ {
+ throw new Exception("Assert.Equal failed");
+ }
+ }
+ public static void NotEqual(float f1, float f2)
+ {
+ if (f1 == f2)
+ {
+ throw new Exception("Assert.NotEqual failed");
+ }
+ }
+ }
+ public struct SimpleVector3
+ {
+ public static void Vector3GetHashCodeTest()
+ {
+ Vector3 v1 = new Vector3(2.0f, 3.0f, 3.3f);
+ Vector3 v2 = new Vector3(2.0f, 3.0f, 3.3f);
+ Vector3 v3 = new Vector3(2.0f, 3.0f, 3.3f);
+ Vector3 v5 = new Vector3(3.0f, 2.0f, 3.3f);
+ Assert.Equal(v1.GetHashCode(), v1.GetHashCode());
+ Assert.Equal(v1.GetHashCode(), v2.GetHashCode());
+ Assert.NotEqual(v1.GetHashCode(), v5.GetHashCode());
+ Assert.Equal(v1.GetHashCode(), v3.GetHashCode());
+ Vector3 v4 = new Vector3(0.0f, 0.0f, 0.0f);
+ Vector3 v6 = new Vector3(1.0f, 0.0f, 0.0f);
+ Vector3 v7 = new Vector3(0.0f, 1.0f, 0.0f);
+ Vector3 v8 = new Vector3(1.0f, 1.0f, 1.0f);
+ Vector3 v9 = new Vector3(1.0f, 1.0f, 0.0f);
+ Assert.NotEqual(v4.GetHashCode(), v6.GetHashCode());
+ Assert.NotEqual(v4.GetHashCode(), v7.GetHashCode());
+ Assert.NotEqual(v4.GetHashCode(), v8.GetHashCode());
+ Assert.NotEqual(v7.GetHashCode(), v6.GetHashCode());
+ Assert.NotEqual(v8.GetHashCode(), v6.GetHashCode());
+ Assert.NotEqual(v8.GetHashCode(), v9.GetHashCode());
+ Assert.NotEqual(v7.GetHashCode(), v9.GetHashCode());
+ }
+
+ public static int Main( string[] args )
+ {
+ int returnVal = Pass;
+
+ try
+ {
+ Vector3GetHashCodeTest();
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("FAILED: " + e.Message);
+ returnVal = Fail;
+ }
+ return returnVal;
+ }
+ }
+}
+
diff --git a/tests/src/JIT/SIMD/Vector3GetHash_r.csproj b/tests/src/JIT/SIMD/Vector3GetHash_r.csproj
new file mode 100644
index 0000000000..183dccf3f4
--- /dev/null
+++ b/tests/src/JIT/SIMD/Vector3GetHash_r.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>
+ <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\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' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize></Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Vector3GetHash.cs" />
+ </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/SIMD/Vector3GetHash_ro.csproj b/tests/src/JIT/SIMD/Vector3GetHash_ro.csproj
new file mode 100644
index 0000000000..3228f62369
--- /dev/null
+++ b/tests/src/JIT/SIMD/Vector3GetHash_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>
+ <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\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' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Vector3GetHash.cs" />
+ </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>