New tests were added.
authorSergey Andreenko <AC-93@MAIL.RU>
Sat, 22 Aug 2015 04:09:50 +0000 (21:09 -0700)
committerSergey Andreenko <AC-93@MAIL.RU>
Thu, 27 Aug 2015 16:19:37 +0000 (09:19 -0700)
Some new SIMD tests were added, useless were deleted.
Tests, that are affected by issue 1441 are excluded.

mend

Commit migrated from https://github.com/dotnet/coreclr/commit/c52a37db7913947a97f44cb938680e109a9ab9c3

30 files changed:
src/coreclr/tests/issues.targets
src/coreclr/tests/src/JIT/SIMD/AbsGeneric.cs
src/coreclr/tests/src/JIT/SIMD/AbsGeneric2.cs [deleted file]
src/coreclr/tests/src/JIT/SIMD/AbsSqrt.cs
src/coreclr/tests/src/JIT/SIMD/Add.cs [deleted file]
src/coreclr/tests/src/JIT/SIMD/AddingSequence.cs [moved from src/coreclr/tests/src/JIT/SIMD/Simple.cs with 69% similarity]
src/coreclr/tests/src/JIT/SIMD/BitwiseOperations.cs
src/coreclr/tests/src/JIT/SIMD/BoxUnbox.cs
src/coreclr/tests/src/JIT/SIMD/BugWithAVX.cs [moved from src/coreclr/tests/src/JIT/SIMD/Ret100.cs with 59% similarity]
src/coreclr/tests/src/JIT/SIMD/CircleInConvex.cs
src/coreclr/tests/src/JIT/SIMD/Constr1.cs [deleted file]
src/coreclr/tests/src/JIT/SIMD/CreateGeneric.cs
src/coreclr/tests/src/JIT/SIMD/CreateGeneric2.cs [deleted file]
src/coreclr/tests/src/JIT/SIMD/CtorFromArray.cs [moved from src/coreclr/tests/src/JIT/SIMD/GenerCtrFromArray.cs with 52% similarity]
src/coreclr/tests/src/JIT/SIMD/Ctors.cs
src/coreclr/tests/src/JIT/SIMD/DivSignedUnsignedTest.cs
src/coreclr/tests/src/JIT/SIMD/Dup.cs
src/coreclr/tests/src/JIT/SIMD/Haar-likeFeaturesGeneric.cs [moved from src/coreclr/tests/src/JIT/SIMD/Haar-likeFfeaturesGeneric.cs with 97% similarity]
src/coreclr/tests/src/JIT/SIMD/InitFromArray.cs [deleted file]
src/coreclr/tests/src/JIT/SIMD/Ldfld.cs
src/coreclr/tests/src/JIT/SIMD/LdfldGeneric.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/SIMD/Ldind.cs
src/coreclr/tests/src/JIT/SIMD/MinMax.cs
src/coreclr/tests/src/JIT/SIMD/Mul.cs
src/coreclr/tests/src/JIT/SIMD/SqrtGeneric.cs
src/coreclr/tests/src/JIT/SIMD/StoreElement.cs [moved from src/coreclr/tests/src/JIT/SIMD/CurrTest.cs with 85% similarity]
src/coreclr/tests/src/JIT/SIMD/Sums.cs
src/coreclr/tests/src/JIT/SIMD/Vector3.cs
src/coreclr/tests/src/JIT/SIMD/Vector4.cs
src/coreclr/tests/src/JIT/SIMD/stelem.cs [deleted file]

index 3f22886..2577df8 100644 (file)
@@ -7,5 +7,20 @@
         <ExcludeList Include="$(XunitTestBinBase)\JIT\Directed\lifetime\lifetime2.cmd" >
              <Issue>1037</Issue>
         </ExcludeList>
+        <ExcludeList Include="$(XunitTestBinBase)\JIT\SIMD\BugWithAVX.cmd" >
+             <Issue>1441</Issue>
+        </ExcludeList>
+        <ExcludeList Include="$(XunitTestBinBase)\JIT\SIMD\CtorFromArray.cmd" >
+             <Issue>1441</Issue>
+        </ExcludeList>
+        <ExcludeList Include="$(XunitTestBinBase)\JIT\SIMD\Haar-likeFeaturesGeneric.cmd" >
+             <Issue>1441</Issue>
+        </ExcludeList>
+        <ExcludeList Include="$(XunitTestBinBase)\JIT\SIMD\CreateGeneric.cmd" >
+             <Issue>1441</Issue>
+        </ExcludeList>
+        <ExcludeList Include="$(XunitTestBinBase)\JIT\SIMD\BitwiseOperations.cmd" >
+             <Issue>1441</Issue>
+        </ExcludeList>
     </ItemGroup>
 </Project>
index dd89a7d..568837d 100644 (file)
@@ -6,12 +6,21 @@ namespace VectorMathTests
 {
     class Program
     {
+        const float EPS = Single.Epsilon * 5;
 
-
+        static short[] GenerateArray(int size, short value)
+        {
+            short[] arr = new short[size];
+            for (int i = 0; i < size; ++i)
+            {
+                arr[i] = value;
+            }
+            return arr;
+        }
 
         static int Main(string[] args)
         {
-                       short[] arr = new short[] {-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5};
+            short[] arr = GenerateArray(60, 5);
             var a = new System.Numerics.Vector<short>(arr);
             a = System.Numerics.Vector.Abs(a);
             if (a[0] != 5)
@@ -55,7 +64,6 @@ namespace VectorMathTests
             {
                 return 0;
             }
-
             return 100;
         }
     }
diff --git a/src/coreclr/tests/src/JIT/SIMD/AbsGeneric2.cs b/src/coreclr/tests/src/JIT/SIMD/AbsGeneric2.cs
deleted file mode 100644 (file)
index 1eeb0b2..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-
-namespace VectorMathTests
-{
-    class Program
-    {
-
-
-
-        static int Main(string[] args)
-        {
-            var a = new System.Numerics.Vector<short>(-5);
-            a = System.Numerics.Vector.Abs(a);
-            if (a[0] != 5)
-            {
-                return 0;
-            }
-            var b = System.Numerics.Vector<int>.One;
-            b = System.Numerics.Vector.Abs(b);
-            if (b[3] != 1)
-            {
-                return 0;
-            }
-            var c = new System.Numerics.Vector<long>(-11);
-            c = System.Numerics.Vector.Abs(c);
-            if (c[1] != 11)
-            {
-                return 0;
-            }
-
-            var d = new System.Numerics.Vector<double>(-100.0);
-            d = System.Numerics.Vector.Abs(d);
-            if (d[0] != 100)
-            {
-                return 0;
-            }
-            var e = new System.Numerics.Vector<float>(-22);
-            e = System.Numerics.Vector.Abs(e);
-            if (e[3] != 22)
-            {
-                return 0;
-            }
-            var f = new System.Numerics.Vector<ushort>(21);
-            f = System.Numerics.Vector.Abs(f);
-            if (f[7] != 21)
-            {
-                return 0;
-            }
-            var g = new System.Numerics.Vector<ulong>(21);
-            g = System.Numerics.Vector.Abs(g);
-            if (g[1] != 21)
-            {
-                return 0;
-            }
-
-            return 100;
-        }
-    }
-}
index fd0c3aa..36d3730 100644 (file)
@@ -7,20 +7,19 @@ namespace VectorMathTests
 {
     class Program
     {
-
-
-
         static int Main(string[] args)
         {
-            Point a = new Point(1, 2, 3, 4);
-            Point b = new Point(2, 2, 1, 1);
-            float c = 33;
-            Point d = (b + a) * c;
-            Point q = d + a;
-            Point s = Point.SquareRoot(q);
+            Point a = new Point(11, 13, 8, 4);
+            Point b = new Point(11, 13, 2, 1);
+            Point d = a * b;
+            Point s = Point.SquareRoot(d);
             s *= -1;
             s = Point.Abs(s);
-            return (int)(s).X * 10;
+            if ((int)(s.X) == 11 && (int)(s.Y) == 13 && (int)(s.Z) == 4 && (int)(s.W) == 2)
+            {
+                return 100;
+            }
+            return 0;
         }
     }
 }
diff --git a/src/coreclr/tests/src/JIT/SIMD/Add.cs b/src/coreclr/tests/src/JIT/SIMD/Add.cs
deleted file mode 100644 (file)
index 2666191..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Point = System.Numerics.Vector2;
-
-namespace VectorMathTests
-{
-    class Program
-    {
-
-      
-
-        static int Main(string[] args)
-        {
-                       Point a = new Point(3, 60);
-                       Point b = new Point(10, 40);
-            return (int)(a + b).Y;
-        }
-    }
-}
similarity index 69%
rename from src/coreclr/tests/src/JIT/SIMD/Simple.cs
rename to src/coreclr/tests/src/JIT/SIMD/AddingSequence.cs
index bddbdad..67f4469 100644 (file)
@@ -6,6 +6,17 @@ namespace VectorMathTests
 {
     class Program
     {
+               const float EPS = Single.Epsilon * 5;
+               
+               static bool CheckEQ(float a, float b)
+        {
+            return Math.Abs(a - b) < 5 * EPS;
+        }
+
+        static bool CheckNEQ(float a, float b)
+        {
+            return !CheckEQ(a, b);
+        }
 
         static int Adds()
         {
@@ -21,46 +32,39 @@ namespace VectorMathTests
             a += b;
             a += b;
             a += b;
-            if (a.X != 10 || a.Y != 20)
+            if (CheckNEQ(a.X, 10) || CheckNEQ(a.Y, 20))
             {
                 return 0;
             }
             return 100;
-
         }
 
-
         static int Main(string[] args)
         {
-
-
             Point a = new Point(0, 0), b = new Point(1, 0);
             Point c = a + b;
             Point d = c - b;
             Point e = d - a;
-            if (e.X != 0 || e.Y != 0)
+            if (CheckNEQ(e.X, 0) || CheckNEQ(e.Y, 0))
             {
                 return 0;
             }
-
             e += e;
-            if (e.X != 0 || e.Y != 0)
+            if (CheckNEQ(e.X, 0) || CheckNEQ(e.Y, 0))
             {
                 return 0;
             }
-
             a += new Point(5, 2);
             e += a + b;
-            if (e.X != 6 || e.Y != 2)
+            if (CheckNEQ(e.X, 6) || CheckNEQ(e.Y, 2))
             {
                 return 0;
             }
             e *= 10;
-            if (e.X != 60 || e.Y != 20)
+            if (CheckNEQ(e.X, 60) || CheckNEQ(e.Y, 20))
             {
                 return 0;
             }
-            // Debug.Assert(e.X == 0 && e.Y == 0);      
             if (Adds() != 100)
             {
                 return 0;
index be62d72..88cfecd 100644 (file)
@@ -6,7 +6,6 @@ namespace VectorMathTests
 {
     class Program
     {
-
         static float NextFloat(Random random)
         {
             double mantissa = (random.NextDouble() * 2.0) - 1.0;
@@ -14,10 +13,8 @@ namespace VectorMathTests
             return (float)(mantissa * exponent);
         }
 
-
         static int TestDouble()
         {
-            // care with NAN, it is very ofter situation.
             Random random = new Random(11);
             double[] arr1 = new double[] { NextFloat(random), NextFloat(random), NextFloat(random), NextFloat(random) };
             double[] arr2 = new double[] { NextFloat(random), NextFloat(random), NextFloat(random), NextFloat(random) };
@@ -45,7 +42,7 @@ namespace VectorMathTests
                 }
                 r = f | s;
                 d = BitConverter.Int64BitsToDouble(r);
-                if (orR[i] != d)
+                if (orR[i] != d && d == d)
                 {
                     return 0;
                 }
@@ -58,11 +55,21 @@ namespace VectorMathTests
             return (byte)random.Next(0, 255);
         }
 
+        static byte[] GenerateByteArray(int size, Random random)
+        {
+            byte[] arr = new byte[size];
+            for (int i = 0; i < size; ++i)
+            {
+                arr[i] = NextByte(random);
+            }
+            return arr;
+        }
+
         static int TestBool()
         {
             Random random = new Random(13);
-            byte[] arr1 = new byte[] { NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random) };
-            byte[] arr2 = new byte[] { NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random), NextByte(random) };
+            byte[] arr1 = GenerateByteArray(64, random);
+            byte[] arr2 = GenerateByteArray(64, random);
             var a = new System.Numerics.Vector<byte>(arr1);
             var b = new System.Numerics.Vector<byte>(arr2);
 
@@ -83,7 +90,7 @@ namespace VectorMathTests
                     return 0;
                 }
                 d = a[i] | b[i];
-                if (orR[i] != d && d == d)
+                if (orR[i] != d)
                 {
                     return 0;
                 }
index 65379e7..6f32ce7 100644 (file)
@@ -6,27 +6,40 @@ namespace VectorMathTests
 {
     class Program
     {
-
-
-
         static int Main(string[] args)
         {
-            var a = new System.Numerics.Vector<int>(1);
-            object b = a;
-            if (b is System.Numerics.Vector<int>)
             {
-                var c = (System.Numerics.Vector<int>)b;
-                if (a != c)
+                var a = new System.Numerics.Vector<int>(1);
+                object b = a;
+                if (b is System.Numerics.Vector<int>)
+                {
+                    var c = (System.Numerics.Vector<int>)b;
+                    if (a != c)
+                    {
+                        return 0;
+                    }
+                }
+                else
                 {
                     return 0;
                 }
             }
-            else
             {
-                return 0;
+                var a = new System.Numerics.Vector4(1);
+                object b = a;
+                if (b is System.Numerics.Vector4)
+                {
+                    var c = (System.Numerics.Vector4)b;
+                    if (a != c)
+                    {
+                        return 0;
+                    }
+                }
+                else
+                {
+                    return 0;
+                }
             }
-
-
             return 100;
         }
     }
similarity index 59%
rename from src/coreclr/tests/src/JIT/SIMD/Ret100.cs
rename to src/coreclr/tests/src/JIT/SIMD/BugWithAVX.cs
index 54b0662..bd8e11d 100644 (file)
@@ -1,18 +1,13 @@
-using System;
-using System.Collections.Generic;
-using Point = System.Numerics.Vector2;
+
+using System.Numerics;
 
 namespace VectorMathTests
 {
     class Program
     {
-
-      
-
         static int Main(string[] args)
         {
-
-
+            int Count = System.Numerics.Vector<int>.Count;
             return 100;
         }
     }
index cda51f9..bf3aff7 100644 (file)
@@ -1,3 +1,5 @@
+// Test generates Points, builds ConvexHull and then find the biggest Circle inside it.
+
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -14,21 +16,7 @@ namespace ClassLibrary
     {
         const float EPS = 1E-9F;
         const int steps = 100;
-        const float INF = 1000000;
-        //public struct Point
-        //{
-        //    public double X, Y;
-        //    public static Point operator -(Point a, Point b)
-        //    {
-        //        Point r;
-        //        r.X = a.X - b.X;
-        //        r.Y = a.Y - b.Y;
-        //        return r;
-        //    }
-
-
-
-        //}
+        const float INF = Single.PositiveInfinity;
 
         public static float vectMul(Point a, Point b)
         {
@@ -67,11 +55,11 @@ namespace ClassLibrary
             a = b;
             b = c;
         }
-
+               
+               
+               // Calc the radius of a circle, with a center in (x, y), the is bounded with Lines. 
         static public float radius(float x, float y, List<Line> l)
         {
-
-
             int n = (int)l.Count;
             float res = INF;
             for (int i = 0; i < n; ++i)
@@ -84,10 +72,9 @@ namespace ClassLibrary
             return res;
         }
 
+               // Find y and calc the radius of a circle, with a center in (x), tha is bounded with Lines.
         static public float y_radius(float x, List<Point> a, List<Line> l, out float yOut)
         {
-
-
             int n = (int)a.Count;
             float ly = INF, ry = -INF;
             for (int i = 0; i < n; ++i)
@@ -100,7 +87,6 @@ namespace ClassLibrary
                     swap(ref x1, ref x2);
                     swap(ref y1, ref y2);
                 }
-
                 if (x1 <= x + EPS && x - EPS <= x2)
                 {
                     float y = y1 + (x - x1) * (y2 - y1) / (x2 - x1);
@@ -123,16 +109,12 @@ namespace ClassLibrary
             return radius(x, ly, l);
         }
 
-
-
-
         static public Boolean Check(List<Point> points)
         {
             float zn = vectMul((points[2] - points[0]), (points[1] - points[0]));
             for (int i = 2; i < points.Count; ++i)
             {
                 float z = vectMul((points[i] - points[i - 2]), (points[i - 1] - points[i - 2]));
-
                 if (z * zn < 0)
                 {
 
@@ -146,12 +128,11 @@ namespace ClassLibrary
             return true;
         }
 
-        static public Boolean Solve(List<Point> points, out Point O, out float r)
+        static public Boolean FindCircle(List<Point> points, out Point O, out float r)
         {
             O.X = 0;
             O.Y = 0;
             r = 0;
-
             if (points.Count < 3)
                 return false;
             points.Add(points[0]);
@@ -195,13 +176,11 @@ namespace ClassLibrary
                 else
                     rx = x2;
             }
-
             float y;
             float ans = y_radius(lx, points, l, out y);
             O.X = lx;
             O.Y = y;
             r = ans;
-
             return true;
         }
 
@@ -259,7 +238,7 @@ namespace ClassLibrary
             double mantissa = (random.NextDouble() * 2.0) - 1.0;
             double exponent = Math.Pow(2.0, random.Next(-32, 32));
             return (float)(mantissa * exponent);
-        } 
+        }
 
         static int Main(string[] args)
         {
@@ -275,10 +254,10 @@ namespace ClassLibrary
             convex_hull(points);
             Point O;
             float r;
-            Solve(points, out O, out r);
+            FindCircle(points, out O, out r);
 
-               
-            if (r >= 999999.9 - 1 && r <= 999999.9 + 1)
+            float expRes = 7.565624E7F;
+            if (Math.Abs(r - expRes) > EPS)
                 return 100;
             return 0;
         }
diff --git a/src/coreclr/tests/src/JIT/SIMD/Constr1.cs b/src/coreclr/tests/src/JIT/SIMD/Constr1.cs
deleted file mode 100644 (file)
index bb34062..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Point = System.Numerics.Vector2;
-
-namespace VectorMathTests
-{
-    class Program
-    {
-
-      
-
-        static int Main(string[] args)
-        {
-                       Point a = new Point(100, 100);
-
-            return (int)a.X;
-        }
-    }
-}
index 69dbd6b..af6ed63 100644 (file)
@@ -6,16 +6,59 @@ namespace VectorMathTests
 {
     class Program
     {
-
-
-
+               const float EPS = Single.Epsilon * 5;
+               
         static int Main(string[] args)
         {
-            
-            var a = new System.Numerics.Vector<float>(1);
+            var a = new System.Numerics.Vector<short>(51);
+            for (int i = 0; i < System.Numerics.Vector<short>.Count; ++i)
+            {
+                if (a[i] != 51)
+                {
+                    return 0;
+                }
+            }
+            var b = System.Numerics.Vector<int>.One;
+            for (int i = 0; i < System.Numerics.Vector<int>.Count; ++i)
+            {
+                if (b[i] != 1)
+                {
+                    return 0;
+                }
+            }
+            var c = System.Numerics.Vector<short>.One;
+            for (int i = 0; i < System.Numerics.Vector<short>.Count; ++i)
+            {
+                if (c[i] != 1)
+                {
+                    return 0;
+                }
+            }
+            var d = new System.Numerics.Vector<double>(100.0);
+            for (int i = 0; i < System.Numerics.Vector<double>.Count; ++i)
+            {
+                if (Math.Abs(d[i] - 100.0) > EPS)
+                {
+                    return 0;
+                }
+            }
+
+            var e = new System.Numerics.Vector<float>(100);
+            for (int i = 0; i < System.Numerics.Vector<float>.Count; ++i)
+            {
+                if (Math.Abs(e[i] - 100.0) > EPS)
+                {
+                    return 0;
+                }
+            }
+            var f = c * 49;
+            var g = f + a;
 
-            return 100;
-          
+            if (g[0] == 100)
+            {
+                return 100;
+            }
+            return 0;
         }
     }
 }
diff --git a/src/coreclr/tests/src/JIT/SIMD/CreateGeneric2.cs b/src/coreclr/tests/src/JIT/SIMD/CreateGeneric2.cs
deleted file mode 100644 (file)
index 2b6c190..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-
-namespace VectorMathTests
-{
-    class Program
-    {
-
-
-
-        static int Main(string[] args)
-        {
-                       var a = new System.Numerics.Vector<short>(51);
-                       for(int i = 0; i < System.Numerics.Vector<short>.Count; ++i)
-                       {
-                               if (a[i] != 51)
-                               {
-                                       return 0;
-                               }
-                       }
-                       var b = System.Numerics.Vector<int>.One;
-                       for(int i = 0; i < System.Numerics.Vector<int>.Count; ++i)
-                       {
-                               if (b[i] != 1)
-                               {
-                                       return 0;
-                               }
-                       }
-                       var c = System.Numerics.Vector<short>.One;
-                       for(int i = 0; i < System.Numerics.Vector<short>.Count; ++i)
-                       {
-                               if (c[i] != 1)
-                               {
-                                       return 0;
-                               }
-                       }
-                       var d = new System.Numerics.Vector<double>(100.0);
-                       for(int i = 0; i < System.Numerics.Vector<double>.Count; ++i)
-                       {
-                               if (d[i] != 100.0)
-                               {
-                                       return 0;
-                               }
-                       }
-                       
-                       var e = new System.Numerics.Vector<float>(100);
-                       for(int i = 0; i < System.Numerics.Vector<float>.Count; ++i)
-                       {
-                               if (e[i] != 100.0)
-                               {
-                                       return 0;
-                               }
-                       }
-                       var f = c * 49;
-                       var g = f + a;
-                       
-                       short[] array1 = new short[] { 1, 3, 5, 7, 9, 2, 1, 1, 1,5,4,3,1,2,3,5,6,7,1,1,1,1 };
-            var w = new System.Numerics.Vector<short>(array1);
-                       return g[0];
-                       //return (int)c[1] + (int)b[3] - 100 + a[2] - 2 * d[1];
-          
-        }
-    }
-}
@@ -6,27 +6,29 @@ namespace VectorMathTests
 {
     class Program
     {
-        static int test(int[] arr)
+        static int[] GenerateArray(int size, int value)
         {
-            int a = arr[0];
-            return a;
+            int[] arr = new int[size];
+            for (int i = 0; i < size; ++i)
+            {
+                arr[i] = value;
+            }
+            return arr;
         }
 
         static int Main(string[] args)
         {
-                       int[] arr = new int[] {1,2,3,4,5,6,7,8};
-                       Point p = new Point(arr, 0);
+            int v = 2;
+            int[] arr = GenerateArray(20, v);
+            Point p = new Point(arr);
             for (int i = 0; i < Point.Count; ++i)
             {
-                if (p[i] != arr[i])
+                if (p[i] != v)
                 {
                     return 0;
                 }
             }
             return 100;
-
-
-            
         }
     }
 }
index 7c36185..5d32dfd 100644 (file)
@@ -5,58 +5,66 @@ using System.Numerics;
 namespace VectorMathTests
 {
     class Program
-    {
+    {          
+        const float EPS = Single.Epsilon * 5;
+
+        static bool CheckEQ(float a, float b)
+        {
+            return Math.Abs(a - b) < EPS;
+        }
+
+        static bool CheckNEQ(float a, float b)
+        {
+            return !CheckEQ(a, b);
+        }
 
         static int Vector2Ctors()
         {
             Vector2 a = new Vector2(45, 12);
-            if (a.X != 45 || a.Y != 12)
+            if (CheckNEQ(a.X, 45) || CheckNEQ(a.Y, 12))
                 return 0;
             a.X = 100;
             Vector2 b = new Vector2(65);
 
-            if (b.X != 65 || b.Y != 65)
+            if (CheckNEQ(b.X, 65) || CheckNEQ(b.Y, 65))
                 return 0;
             return 100;
-
         }
 
         static int Vector3Ctors()
         {
             Vector3 a = new Vector3(0, 1, 2);
-            if (a.X != 0 || a.Y != 1 || a.Z != 2)
+            if (CheckNEQ(a.X, 0) || CheckNEQ(a.Y, 1) || CheckNEQ(a.Z, 2))
                 return 0;
             Vector3 b = new Vector3(2);
-            if (b.X != 2 || b.Y != 2 || b.Z != 2)
+            if (CheckNEQ(b.X, 2) || CheckNEQ(b.Y, 2) || CheckNEQ(b.Z, 2))
                 return 0;
             Vector2 q = new Vector2(10, 1);
             Vector3 c = new Vector3(q, 5);
-            if (c.X != q.X || c.Y != q.Y || c.Z != 5)
+            if (CheckNEQ(c.X, q.X) || CheckNEQ(c.Y, q.Y) || CheckNEQ(c.Z, 5))
                 return 0;
             return 100;
-
         }
 
         static int Vector4Ctors()
         {
             Vector4 a = new Vector4(0, 1, 2, 3);
-            if (a.X != 0 || a.Y != 1 || a.Z != 2 || a.W != 3)
+            if (CheckNEQ(a.X, 0) || CheckNEQ(a.Y, 1) || CheckNEQ(a.Z, 2) || CheckNEQ(a.W, 3))
                 return 0;
             Vector4 b = new Vector4(2);
-            if (b.X != 2 || b.Y != 2 || b.Z != 2 || b.W != 2)
+            if (CheckNEQ(b.X, 2) || CheckNEQ(b.Y, 2) || CheckNEQ(b.Z, 2) || CheckNEQ(b.W, 2))
                 return 0;
             Vector2 q = new Vector2(10, 1);
             Vector4 c = new Vector4(q, 10, -1);
-            if (c.X != q.X || c.Y != q.Y || c.Z != 10 || c.W != -1)
+            if (CheckNEQ(c.X, q.X) || CheckNEQ(c.Y, q.Y) || CheckNEQ(c.Z, 10) || CheckNEQ(c.W, -1))
                 return 0;
             Vector3 w = new Vector3(5);
             Vector4 d = new Vector4(w, 2);
-            if (d.X != w.X || d.Y != w.Y || d.Z != w.Z || d.W != 2)
+            if (CheckNEQ(d.X, w.X) || CheckNEQ(d.Y, w.Y) || CheckNEQ(d.Z, w.Z) || CheckNEQ(d.W, 2))
                 return 0;
             return 100;
         }
 
-
         static int Main(string[] args)
         {
             if (Vector2Ctors() != 100 || Vector3Ctors() != 100 || Vector4Ctors() != 100)
index 800e488..46d0263 100644 (file)
@@ -6,9 +6,6 @@ namespace VectorMathTests
 {
     class Program
     {
-
-
-
         static int Main(string[] args)
         {
             {
index 2b84469..251deb2 100644 (file)
@@ -6,9 +6,7 @@ namespace VectorMathTests
 {
     class Program
     {
-
         static Point a;
-
         static int Main(string[] args)
         {
             Point p = new Point(1, 2, 3, 4);
@@ -6,7 +6,8 @@ namespace VectorMathTests
 {
     class Program
     {
-
+               const float EPS = Single.Epsilon * 5;
+               
         static float NextFloat(Random random)
         {
             double mantissa = (random.NextDouble() * 2.0) - 1.0;
@@ -22,7 +23,6 @@ namespace VectorMathTests
         static double[] VectorFilter(double[] color, double[] mask)
         {
             int count = Point.Count;
-
             int N = color.Length;
             double[] res = new double[N];
             for (int i = 0; i < N; i += count)
@@ -43,7 +43,6 @@ namespace VectorMathTests
         static double[] VectorAndFilter(double[] color, double[] mask)
         {
             int count = Point.Count;
-
             int N = color.Length;
             double[] res = new double[N];
             for (int i = 0; i < N; i += count)
@@ -57,12 +56,11 @@ namespace VectorMathTests
                     res[i + j] = r[j];
                 }
             }
-
             return res;
         }
 
         static double[] SimpleFilter(double[] color, double[] mask)
-        {           
+        {
             int N = color.Length;
             double[] res = new double[N];
             for (int i = 0; i < N; i += 1)
@@ -96,7 +94,7 @@ namespace VectorMathTests
                 else
                 {
                     res[i] = 1;
-                }                
+                }
             }
             return res;
         }
@@ -107,7 +105,7 @@ namespace VectorMathTests
             double[] res = new double[N];
             for (int i = 0; i < N; ++i)
             {
-              
+
                 if (mask[i] == 0)
                 {
                     res[i] = 0;
@@ -125,14 +123,14 @@ namespace VectorMathTests
             int N = a.Length;
             for (int i = 0; i < N; ++i)
             {
-                if (a[i] != b[i])
+                if (Math.Abs(a[i] - b[i]) > EPS)
                 {
                     return false;
                 }
             }
             return true;
         }
-        
+
         static int Main(string[] args)
         {
             Random random = new Random(13);
@@ -145,7 +143,7 @@ namespace VectorMathTests
             double[] res = VectorFilter(color, mask);
             double[] check = SimpleFilter(color, mask);
             double[] andRes = VectorAndFilter(color, andMask);
-            
+
             if (checkEQ(res, check) == false)
             {
                 return 0;
@@ -154,8 +152,6 @@ namespace VectorMathTests
             {
                 return 0;
             }
-
-
             return 100;
         }
     }
diff --git a/src/coreclr/tests/src/JIT/SIMD/InitFromArray.cs b/src/coreclr/tests/src/JIT/SIMD/InitFromArray.cs
deleted file mode 100644 (file)
index baea4cc..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Point = System.Numerics.Vector<int>;
-
-namespace VectorMathTests
-{
-    class Program
-    {
-
-
-        static int Main(string[] args)
-        {
-                       int[] arr = new int[] {1,1,1,1,1,1,1,1,1,1,1,1};
-                       Point p = new Point(arr);
-
-
-            return 100;
-        }
-    }
-}
index 4aa9bf1..60ccd57 100644 (file)
@@ -6,7 +6,6 @@ namespace VectorMathTests
 {
     class Program
     {
-
         static float Do(Point p)
         {
             return p.X;
@@ -22,7 +21,6 @@ namespace VectorMathTests
             public Point p;
         }
 
-
         static int Main(string[] args)
         {
             Point p = new Point(1, 2, 3, 4);
@@ -31,11 +29,25 @@ namespace VectorMathTests
             C c = new C();
             s.p.X = 1;
             c.p.Y = 2;
-            if (Do(s.p) != 1)
+            if (((int)Do(s.p) != 1))
+            {
+                return 0;
+            }
+            if (((int)c.p.X) != 0 || ((int)c.p.Y) != 2)
             {
                 return 0;
             }
-            if (c.p.X != 0 || c.p.Y != 2)
+            Point[] fixedArr = new Point[5];
+            Point fixedPoint = new Point(1);
+                       fixedArr[0] = fixedPoint;
+                       if (fixedArr[0].X != 1)
+                       {
+                               return 0;
+                       }
+
+            List<Point> points = new List<Point>();
+            points.Add(fixedPoint);
+            if (((int)points[0].X) != 1 && ((int)points[0].Y) != 2)
             {
                 return 0;
             }
diff --git a/src/coreclr/tests/src/JIT/SIMD/LdfldGeneric.cs b/src/coreclr/tests/src/JIT/SIMD/LdfldGeneric.cs
new file mode 100644 (file)
index 0000000..3c61d34
--- /dev/null
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using Point = System.Numerics.Vector<int>;
+
+namespace VectorMathTests
+{
+    class Program
+    {
+        static float Do(Point p)
+        {
+            return p[0];
+        }
+
+        struct S
+        {
+            public Point p;
+        }
+
+        class C
+        {
+            public Point p;
+        }
+
+        static int Main(string[] args)
+        {
+            Point p = new Point(1);
+
+            S s = new S();
+            C c = new C();
+            s.p = new Point(1);
+            c.p = new Point(2);
+            if (((int)Do(s.p) != 1))
+            {
+                return 0;
+            }
+            if (((int)c.p[1]) != 2 || ((int)c.p[1]) != 2)
+            {
+                return 0;
+            }
+            Point[] fixedArr = new Point[5];
+            Point fixedPoint = new Point(1);
+            fixedArr[0] = fixedPoint;
+            if (fixedArr[0][0] != 1)
+            {
+                return 0;
+            }
+
+            List<Point> points = new List<Point>();
+            points.Add(fixedPoint);
+            if (points[0][1] != 1)
+            {
+                return 0;
+            }
+
+            return 100;
+        }
+    }
+}
index 6cae39c..18f1bc5 100644 (file)
@@ -3,11 +3,8 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using Point = System.Numerics.Vector4;
 
-
 namespace Test
-{
-    [StructLayout(LayoutKind.Explicit, Pack = 1, Size = 8)]
-   
+{ 
     static class Program
     {
         static int Main()
@@ -19,11 +16,11 @@ namespace Test
                 Do1(&x, &y);
                 Do2(&y, &z);
             }
-                       if (y.X != 1)
+                       if (((int)y.X) != 1)
                        {
                                return 0;
                        }
-                       if (z.X != 1)
+                       if (((int)z.X) != 1)
                        {
                                return 0;
                        }
index af89f73..2865e4a 100644 (file)
@@ -1,23 +1,30 @@
 using System;
 using System.Collections.Generic;
-using Point = System.Numerics.Vector2;
+using Point = System.Numerics.Vector4;
 
 namespace VectorMathTests
 {
     class Program
     {
-
-
-
         static int Main(string[] args)
         {
-            Point a = new Point(10, 50);
-            Point b = new Point(10, 10);
+            Point a = new Point(10, 50,0,-100);
+            Point b = new Point(10);
             Point c = Point.Max(a, b);
-                       if (c.Y != 50)
+                       if (((int)c.Y) != 50 || ((int)c.W) != 10)
+                       {
+                               return 0;
+                       }               
+                       Point d = Point.Min(a, b);
+                       Point q = Point.Min(d, d);
+                       if (q != d)
+                       {
+                               return 0;
+                       }
+                       if (((int)d.W) != -100)
                        {
                                return 0;
-                       }                               
+                       }                       
             return 100;
         }
     }
index 170fe7a..1f5296e 100644 (file)
@@ -6,15 +6,16 @@ namespace VectorMathTests
 {
     class Program
     {
-
-      
-
         static int Main(string[] args)
         {
                        Point a = new Point(10, 50);
                        Point b = new Point(10, 10);
             Point c = a * b;
-                       return (int)c.X;
+                       if (((int)c.X) == 100)
+                       {
+                               return 100;
+                       }
+                       return 0;
         }
     }
 }
index 7d6b9e4..61f95ec 100644 (file)
@@ -6,11 +6,9 @@ namespace VectorMathTests
 {
     class Program
     {
-
-
-
         static int Main(string[] args)
         {
+            Random random = new Random(13);
             var a = new System.Numerics.Vector<short>(25);
             a = System.Numerics.Vector.SquareRoot(a);
             if (a[0] != 5)
@@ -29,16 +27,15 @@ namespace VectorMathTests
             {
                 return 0;
             }
-
             var d = new System.Numerics.Vector<double>(100.0);
             d = System.Numerics.Vector.SquareRoot(d);
-            if (d[0] != 10)
+            if (((int)d[0]) != 10)
             {
                 return 0;
             }
             var e = new System.Numerics.Vector<float>(64);
             e = System.Numerics.Vector.SquareRoot(e);
-            if (e[3] != 8)
+            if (((int)e[3]) != 8)
             {
                 return 0;
             }
@@ -54,7 +51,6 @@ namespace VectorMathTests
             {
                 return 0;
             }
-
             return 100;
         }
     }
similarity index 85%
rename from src/coreclr/tests/src/JIT/SIMD/CurrTest.cs
rename to src/coreclr/tests/src/JIT/SIMD/StoreElement.cs
index 2ea14f1..e8b710a 100644 (file)
@@ -2,24 +2,20 @@ using System;
 using System.Collections.Generic;
 using Point = System.Numerics.Vector<int>;
 
-namespace VectorMathTests
+namespace VectorTests
 {
     class Program
     {
-       
-
-
         static int Main(string[] args)
         {
             Point p = new Point(1);
             Point[] arr = new Point[10];
-            arr[0] = p; //loadelem
+            arr[0] = p; // Loadelem bytecode.
             arr[2] = p;
             if (arr[0] == arr[1] || arr[2] != p)
             {
                 return 0;
             }
-
             return 100;
         }
     }
index 3d23d68..229461d 100644 (file)
@@ -6,7 +6,6 @@ namespace VectorMathTests
 {
     class Program
     {
-
         static float NextFloat(Random random)
         {
             double mantissa = (random.NextDouble() * 2.0) - 1.0;
@@ -14,7 +13,6 @@ namespace VectorMathTests
             return (float)(mantissa * exponent);
         }
 
-
         static float sum(Point[] arr)
         {
             int n = arr.Length;
@@ -30,7 +28,6 @@ namespace VectorMathTests
             return s.X;
         }
 
-
         static int Main(string[] args)
         {
             System.Diagnostics.Stopwatch clock = new System.Diagnostics.Stopwatch();
index 60809e8..f42b698 100644 (file)
@@ -2,21 +2,29 @@ using System;
 using System.Collections.Generic;
 using Point = System.Numerics.Vector3;
 
-namespace VectorMathTests
+namespace VectorTests
 {
     class Program
     {
-
-      
+        const float EPS = Single.Epsilon * 5;
+               
+        static bool CheckEQ(float a, float b)
+        {
+            return Math.Abs(a - b) < EPS;
+        }
 
         static int Main(string[] args)
         {
-                       Point a = new Point(1,2,3);
-                       Point b = new Point(2,2, 5);
-                       float c = 33;
-                       Point d = (b + a)*c;
-                       Point q = d + a;
-            return (int)(q).X;
+            Point a = new Point(1, 2, 3);
+            Point b = new Point(2, 2, 5);
+            float c = 33;
+            Point d = (b + a) * c;
+            Point q = d + a;
+            if (CheckEQ(q.X, 100))
+            {
+                return 100;
+            }
+            return 0;
         }
     }
 }
index ca1851d..5fcad4b 100644 (file)
@@ -2,21 +2,29 @@ using System;
 using System.Collections.Generic;
 using Point = System.Numerics.Vector4;
 
-namespace VectorMathTests
+namespace VectorTests
 {
     class Program
     {
+        const float EPS = Single.Epsilon * 5;
 
-      
+        static bool CheckEQ(float a, float b)
+        {
+            return Math.Abs(a - b) < EPS;
+        }
 
         static int Main(string[] args)
         {
-                       Point a = new Point(1,2,3,4);
-                       Point b = new Point(2,2,1,1);
-                       float c = 33;
-                       Point d = (b + a)*c;
-                       Point q = d + a;
-            return (int)(q).X;
+            Point a = new Point(1, 2, 3, 4);
+            Point b = new Point(2, 2, 1, 1);
+            float c = 33;
+            Point d = (b + a) * c;
+            Point q = d + a;
+            if (CheckEQ(q.X, 100))
+            {
+                return 100;
+            }
+            return 0;
         }
     }
 }
diff --git a/src/coreclr/tests/src/JIT/SIMD/stelem.cs b/src/coreclr/tests/src/JIT/SIMD/stelem.cs
deleted file mode 100644 (file)
index 2ea14f1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Point = System.Numerics.Vector<int>;
-
-namespace VectorMathTests
-{
-    class Program
-    {
-       
-
-
-        static int Main(string[] args)
-        {
-            Point p = new Point(1);
-            Point[] arr = new Point[10];
-            arr[0] = p; //loadelem
-            arr[2] = p;
-            if (arr[0] == arr[1] || arr[2] != p)
-            {
-                return 0;
-            }
-
-            return 100;
-        }
-    }
-}