diff options
author | Sivarv <sivarv@microsoft.com> | 2016-05-07 08:20:57 -0700 |
---|---|---|
committer | Sivarv <sivarv@microsoft.com> | 2016-05-07 08:20:57 -0700 |
commit | ff7a57969edbb6da4983e823b690ca2c124e15d6 (patch) | |
tree | ffb3b31303cc559b73ce4bcf702269b6932ed9c8 /tests | |
parent | 417a98fb0f82b1c05010cdc2c41eb5056f14541c (diff) | |
parent | 60d4c09a23dbc0e1ef5ccc348a05f6545bb6472d (diff) | |
download | coreclr-ff7a57969edbb6da4983e823b690ca2c124e15d6.tar.gz coreclr-ff7a57969edbb6da4983e823b690ca2c124e15d6.tar.bz2 coreclr-ff7a57969edbb6da4983e823b690ca2c124e15d6.zip |
Merge pull request #4836 from sivarv/simdPromotion
Mark simd type vars as lvRegStruct accurately.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/JIT/SIMD/VectorReturn.cs | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/tests/src/JIT/SIMD/VectorReturn.cs b/tests/src/JIT/SIMD/VectorReturn.cs index 97fe80c2ee..d1785af450 100644 --- a/tests/src/JIT/SIMD/VectorReturn.cs +++ b/tests/src/JIT/SIMD/VectorReturn.cs @@ -57,6 +57,79 @@ internal partial class VectorTest return F1(u); } + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static Vector<T> VectorOne<T>() where T: struct + { + return Vector<T>.One; + } + + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static Vector<T> VectorPlusOne<T>(Vector<T> v1) where T : struct + { + Vector<T> v2 = VectorOne<T>(); + return v1 + v2; + } + + public static int VectorTReturnTest() + { + Vector<float> v1 = new Vector<float>(2.0f); + Vector<float> result1 = VectorPlusOne<float>(v1); + for (int i=0; i < Vector<float>.Count; ++i) + { + if (!CheckValue<float>(result1[i], 3.0f)) + { + Console.WriteLine("Expected result is " + 3.0f); + Console.WriteLine("Instead got " + result1[i]); + Console.WriteLine("FAILED"); + return Fail; + } + } + + Vector<int> v2 = new Vector<int>(5); + Vector<int> result2 = VectorPlusOne<int>(v2); + for (int i = 0; i < Vector<int>.Count; ++i) + { + if (!CheckValue<int>(result2[i], 6)) + { + Console.WriteLine("Expected result is " + 6); + Console.WriteLine("Instead got " + result2[i]); + Console.WriteLine("FAILED"); + return Fail; + } + } + + return Pass; + } + + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static Vector3 GetVector3One() + { + return new Vector3(1.0f); + } + + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static Vector3 GetVector3PlusOne(Vector3 v1) + { + Vector3 v2 = GetVector3One(); + return v1 + v2; + } + + public static int Vector3ReturnTest() + { + Vector3 v1 = new Vector3(3.0f, 4.0f, 5.0f); + Vector3 result = GetVector3PlusOne(v1); + + if (!CheckValue<float>(result.X, 4.0f) || + !CheckValue<float>(result.Y, 5.0f) || + !CheckValue<float>(result.Z, 6.0f)) + { + Console.WriteLine("Vector3ReturnTest did not return expected value"); + return Fail; + } + + return Pass; + } + public static int Main() { init(); @@ -69,6 +142,19 @@ internal partial class VectorTest Console.WriteLine("FAILED"); return Fail; } + + if (VectorTReturnTest() != Pass) + { + Console.WriteLine("FAILED"); + return Fail; + } + + if (Vector3ReturnTest() != Pass) + { + Console.WriteLine("FAILED"); + return Fail; + } + Console.WriteLine("PASSED"); return Pass; } |