Merge pull request #1225 from strawd/bug22307
[mono.git] / mono / mini / objects.cs
index ae3e724f36706f47d71ff354bbbdd2cf3a64f0cc..d2ef247a130a1c046d3aaff1d71d970a94dfafa7 100644 (file)
@@ -26,6 +26,11 @@ using System.Runtime.CompilerServices;
  * the IL code looks.
  */
 
+#if MOBILE
+namespace ObjectTests
+{
+#endif
+
 struct Simple {
        public int a;
        public byte b;
@@ -114,9 +119,11 @@ struct Gamma {
 
 class Tests {
 
+#if !MOBILE
        public static int Main (string[] args) {
                return TestDriver.RunTests (typeof (Tests), args);
        }
+#endif
        
        public static int test_0_return () {
                Simple s;
@@ -1595,5 +1602,73 @@ ncells ) {
 
                return 0;
        }
+
+       enum ByteEnum : byte {
+        Zero = 0
+    }
+
+    struct BugStruct {
+        public ByteEnum f1;
+        public ByteEnum f2;
+        public ByteEnum f3;
+        public byte f4;
+        public byte f5;
+        public byte f6;
+        public byte f7;
+    }
+
+       public static int test_0_14217 () {
+               t_14217_inner (new BugStruct ());
+               return 0;
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       static void t_14217_inner (BugStruct bug) {
+    }
+
+       [StructLayout(LayoutKind.Sequential)]
+       public struct EmptyStruct {
+       }
+
+       class EmptyClass {
+               public static EmptyStruct s;
+       }
+
+       // #20349
+       static int test_0_empty_struct_as_static () {
+               var s = EmptyClass.s;
+               return 0;
+       }
+
+       // #25487
+       static int test_0_int_to_r4 () {
+               return int_to_r4_inner (255);
+       }
+
+       static int int_to_r4_inner (int value1) {
+               int sub = -value1;
+               float mult = sub * 1f;
+               if (mult != -255.0f)
+                       return 1;
+               else
+                       return 0;
+       }
+
+       struct HFA4D {
+               public double a, b, c, d;
+       }
+
+       static double arm64_hfa_on_stack_inner (double d1, double d2, double d3, double d4, double d5, double d6, double d7, double d8, HFA4D s) {
+               return s.a + s.b + s.c + s.d;
+       }
+
+       static int test_0_arm64_hfa_on_stack () {
+               var s = new HFA4D () { a = 1.0, b = 2.0, c = 3.0, d = 4.0 };
+               var res = arm64_hfa_on_stack_inner (1, 2, 3, 4, 5, 6, 7, 8, s);
+               return res == 10.0 ? 0 : 1;
+       }
 }
 
+#if MOBILE
+}
+#endif