2005-02-20 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mono / mini / basic-calls.cs
index 8416205d8d4678f55d9d649502b2f465de3fa5f8..c5c7d97ca25ba3a5a4a965f03db252a2be94f18c 100644 (file)
@@ -146,6 +146,14 @@ class Tests {
                return pass_floats_doubles (100.0f, 101.0, 102.0, 103.0, 104.0, 105.0f, 106.0);
        }
 
+       static float pass_floats (float a, float b, float c, float d, float e, float f, float g, float h, float i, float j) {
+               return a + b + c + d + e + f + g + h + i + j;
+       }
+
+       static int test_55_sparc_float_argument_passing2 () {
+               return (int)pass_floats (1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f);
+       }
+
        // The first argument must be passed on a dword aligned stack location
        static int pass_byref_ints_longs (ref long a, ref int b, ref byte c, ref short d, ref long e, ref int f, ref long g) {
                return (int)(a + b + c + d + e + f + g);
@@ -161,6 +169,18 @@ class Tests {
                return pass_takeaddr_ints_longs (1, 2, 253, -253, System.Int64.MaxValue, 0, System.Int64.MinValue);
        }
 
+       static int pass_byref_floats_doubles (ref float a, ref double b, ref double c, ref double d, ref double e, ref float f, ref double g) {
+               return (int)(a + b + c + d + e + f + g);
+       }
+
+       static int pass_takeaddr_floats_doubles (float a, double b, double c, double d, double e, float f, double g) {
+               return pass_byref_floats_doubles (ref a, ref b, ref c, ref d, ref e, ref f, ref g);
+       }
+
+       static int test_721_sparc_takeaddr_argument_passing2 () {
+               return pass_takeaddr_floats_doubles (100.0f, 101.0, 102.0, 103.0, 104.0, 105.0f, 106.0);
+       }
+
        static void pass_byref_double (out double d) {
                d = 5.0;
        }
@@ -227,6 +247,71 @@ class Tests {
                }
                return 0;
        }
+       
+       static uint dum_de_dum = 1;
+       static int test_0_long_arg_opt ()
+       {
+               return Foo (0x1234567887654321, dum_de_dum);
+       }
+       
+       static int Foo (ulong x, ulong y)
+       {
+               if (x != 0x1234567887654321)
+                       return 1;
+               
+               if (y != 1)
+                       return 2;
+               
+               return 0;
+       }
+       
+       static int test_0_long_ret_opt ()
+       {
+               ulong x = X ();
+               if (x != 0x1234567887654321)
+                       return 1;
+               ulong y = Y ();
+               if (y != 1)
+                       return 2;
+               
+               return 0;
+       }
+       
+       static ulong X ()
+       {
+               return 0x1234567887654321;
+       }
+       
+       static ulong Y ()
+       {
+               return dum_de_dum;
+       }
 
+       /* from bug# 71515 */
+       static int counter = 0;
+       static bool WriteStuff () {
+               counter = 10;
+               return true;
+       }
+       static int test_0_cond_branch_side_effects () {
+               counter = 5;
+               if (WriteStuff());
+               if (counter == 10)
+                       return 0;
+               return 1;
+       }
+
+       static int first_is_zero (int v1, int v2) {
+               if (v1 != 0)
+                       return -1;
+               return v2;
+       }
+       static int test_1_handle_dup_stloc () {
+               int index = 0;
+               int val = first_is_zero (index, ++index);
+               if (val != 1)
+                       return 2;
+               return 1;
+       }
 }