[wasm] Fix test_0_conv_i under interp.
[mono.git] / mono / mini / basic-simd.cs
index b56a6761922dc1a0cbad284787a910a2907eb0a8..f8fdcebaf9b220170a913328bda60bf8e77ead3b 100644 (file)
@@ -557,12 +557,12 @@ public class SimdTests {
                if (a.Y != 2)
                        return 2;
 
-               a.X = 500000000000055l;
-               a.Y = -12345678900l;
+               a.X = 500000000000055L;
+               a.Y = -12345678900L;
 
-               if (a.X != 500000000000055l)
+               if (a.X != 500000000000055L)
                        return 3;
-               if (a.Y != -12345678900l)
+               if (a.Y != -12345678900L)
                        return 4;
                return 0;
        }
@@ -3183,6 +3183,127 @@ public class SimdTests {
                return 0;
        }
 
+       public static int test_0_i_to_d () {
+               var a = new Vector4i (1, 2, 3, 4);
+               var b = a.ConvertToDouble ();
+               if (b.X != 1)
+                       return 1;
+               if (b.Y != 2)
+                       return 2;
+               return 0;
+       }
+
+       public static int test_0_i_to_f () {
+               var a = new Vector4i (1, 2, 3, 4);
+               var b = a.ConvertToFloat ();
+               if (b.X != 1)
+                       return 1;
+               if (b.Y != 2)
+                       return 2;
+               if (b.Z != 3)
+                       return 3;
+               if (b.W != 4)
+                       return 4;
+               return 0;
+       }
+
+       public static int test_0_d_to_i () {
+               var a = new Vector2d (1.4, 2.6);
+               var b = a.ConvertToInt ();
+               if (b.X != 1)
+                       return 1;
+               if (b.Y != 3)
+                       return 2;
+               if (b.Z != 0)
+                       return 3;
+               if (b.W != 0)
+                       return 4;
+               return 0;
+       }
+
+       public static int test_0_d_to_f () {
+               var a = new Vector2d (1, 2);
+               var b = a.ConvertToFloat ();
+               if (b.X != 1)
+                       return 1;
+               if (b.Y != 2)
+                       return 2;
+               if (b.Z != 0)
+                       return 3;
+               if (b.W != 0)
+                       return 4;
+               return 0;
+       }
+
+       public static int test_0_f_to_i () {
+               var a = new Vector4f (1.1f, 2.2f, 3.5f, 4.6f);
+               var b = a.ConvertToInt ();
+               if (b.X != 1)
+                       return 1;
+               if (b.Y != 2)
+                       return 2;
+               if (b.Z != 4)
+                       return 3;
+               if (b.W != 5)
+                       return 4;
+               return 0;
+       }
+
+       public static int test_0_f_to_d () {
+               var a = new Vector4f (1,2,3,4);
+               var b = a.ConvertToDouble ();
+               if (b.X != 1)
+                       return 1;
+               if (b.Y != 2)
+                       return 2;
+               return 0;
+       }
+
+       public static int test_0_d_to_i_trunc () {
+               var a = new Vector2d (1.4, 2.6);
+               var b = a.ConvertToIntTruncated ();
+               if (b.X != 1)
+                       return 1;
+               if (b.Y != 2)
+                       return 2;
+               if (b.Z != 0)
+                       return 3;
+               if (b.W != 0)
+                       return 4;
+               return 0;
+       }
+
+       public static int test_0_f_to_i_trunc () {
+               var a = new Vector4f (1.1f, 2.2f, 3.5f, 4.6f);
+               var b = a.ConvertToIntTruncated ();
+               if (b.X != 1)
+                       return 1;
+               if (b.Y != 2)
+                       return 2;
+               if (b.Z != 3)
+                       return 3;
+               if (b.W != 4)
+                       return 4;
+               return 0;
+       }
+
+       class BoxedVector2d
+       {
+           public Vector2d v;
+       }
+
+       public static int test_0_vector2d_set_x () {
+               var bv = new BoxedVector2d ();
+               var xy = new Vector2d ();
+               xy.X = bv.v.X;
+
+               if (xy.X != 0)
+                       return 1;
+               if (xy.Y != 0)
+                       return 2;
+               return 0;
+       }
+
        public static int Main (String[] args) {
                return TestDriver.RunTests (typeof (SimdTests), args);
        }