2004-02-23 Zoltan Varga <vargaz@freemail.hu>
authorZoltan Varga <vargaz@gmail.com>
Mon, 23 Feb 2004 16:09:37 +0000 (16:09 -0000)
committerZoltan Varga <vargaz@gmail.com>
Mon, 23 Feb 2004 16:09:37 +0000 (16:09 -0000)
* *.cs: New regression tests.

svn path=/trunk/mono/; revision=23371

mono/mini/ChangeLog
mono/mini/basic-calls.cs
mono/mini/basic-float.cs
mono/mini/basic.cs
mono/mini/objects.cs

index 4a5d3b8f200075a3da49f84a93859e4385162eda..9733667c3adf0460f217e61e4954d1eea6532083 100644 (file)
@@ -1,5 +1,7 @@
 2004-02-23  Zoltan Varga  <vargaz@freemail.hu>
 
+       * *.cs: New regression tests.
+
        * mini-sparc.c inssel-sparc.brg: Update after latest changes. Ongoing sparc 
        work.
 
index 233292b963a4fd8d964ae64a8fc18d360e36ea05..17e59499babd1bb85e2de86b767db6c33e5ed95c 100644 (file)
@@ -138,6 +138,20 @@ class Tests {
                return pass_floats_doubles (100.0f, 101.0, 102.0, 103.0, 104.0, 105.0f, 106.0);
        }
 
+       static int pass_byref_ints_longs (ref int a, ref long b, ref long c, ref long d, ref long e, ref int f, ref long g) {
+               return (int)(a + b + c + d + e + f + g);
+       }
+
+       static int pass_takeaddr_ints_longs (int a, long b, long c, long d, long e, int f, long g) {
+               return pass_byref_ints_longs (ref a, ref b, ref c, ref d, ref e, ref f, ref g);
+       }
+
+       // Test that arguments are moved to the stack from incoming registers
+       // when the argument must reside in the stack because its address is taken
+       static int test_1_sparc_takeaddr_argument_passing () {
+               return pass_takeaddr_ints_longs (1, 2, System.Int64.MaxValue, System.Int64.MinValue, System.Int64.MaxValue, 0, System.Int64.MinValue);
+       }
+
        static bool isnan (float f) {
                return (f != f);
        }
index 3a5661b02847e3445051dbd6fb6ad0a082d69f3f..982feee2ebad5be8328131696bc34ec82735be05 100644 (file)
@@ -64,6 +64,12 @@ class Tests {
                return (int)f;
        }
 
+       static int test_5_conv_r8 () {
+               int i = 5;
+               double f = (double)i;
+               return (int)f;
+       }
+
        static int test_5_add () {
                double a = 2.0;
                double b = 3.0;         
index 186faec43c88a36da7a19ce88c294d017be700ed..81109913856becd606044c56696879a01014cae7 100644 (file)
@@ -178,6 +178,11 @@ class Tests {
                return b % 8;
        }
 
+       static int test_4_rem_big_imm () {
+               int b = 10004;
+               return b % 10000;
+       }
+
        static int test_9_mul () {
                int b = 3;
                int a = 3;
index 7d1a9df985ebb5d5507df7982ac70220157db6d7..dca4802d72ffd0be26fadc6a5df511cff9ccdafb 100644 (file)
@@ -1,5 +1,6 @@
 using System;
 using System.Reflection;
+using System.Runtime.InteropServices;
 
 /*
  * Regression tests for the mono JIT.
@@ -30,6 +31,11 @@ struct Simple {
        public long d;
 }
 
+struct Small {
+       public byte b1;
+       public byte b2;
+}
+
 class Sample {
        public int a;
        public Sample (int v) {
@@ -37,6 +43,16 @@ class Sample {
        }
 }
 
+[StructLayout ( LayoutKind.Explicit )]
+struct StructWithBigOffsets {
+               [ FieldOffset(10000) ] public byte b;
+               [ FieldOffset(11000) ] public short s;
+               [ FieldOffset(12000) ] public uint i;
+               [ FieldOffset(13000) ] public long l;
+               [ FieldOffset(14000) ] public float f;
+               [ FieldOffset(15000) ] public double d;
+}
+
 enum SampleEnum {
        A,
        B,
@@ -169,6 +185,43 @@ class Tests {
                return 5;
        }
 
+       // Test alignment of small structs
+
+       static Small get_small (byte v) {
+               Small r = new Small ();
+       
+               r.b1 = v;
+               r.b2 = (byte)(v + 1);
+
+               return r;
+       }
+
+       static Small return_small (Small s) {
+               return s;
+       }
+
+       static int receive_small (int a, Small v, int b) {
+               if (v.b1 != 1)
+                       return 1;
+               if (v.b2 != 2)
+                       return 2;
+               return 0;
+       }
+
+       static int test_5_pass_small_struct () {
+               Small v = get_small (1);
+               if (receive_small (7, v, 9) != 0)
+                       return 0;
+               if (receive_small (7, get_small (1), 9) != 0)
+                       return 1;
+               v = return_small (v);
+               if (v.b1 != 1)
+                       return 2;
+               if (v.b2 != 2)
+                       return 3;
+               return 5;
+       }
+
        struct AStruct {
                public int i;
 
@@ -188,6 +241,31 @@ class Tests {
                return o.GetHashCode ();
        }
 
+       // Test fields with big offsets
+       static int test_1_fields_with_big_offsets () {
+               StructWithBigOffsets s = new StructWithBigOffsets ();
+               StructWithBigOffsets s2 = new StructWithBigOffsets ();
+
+               s.b = 0xde;
+               s.s = 0x12de;
+               s.i = 0xdeadbeef;
+               s.l = 0xcafebabe;
+               s.f = 3.14F;
+               s.d = 3.14;
+
+               s2.b = s.b;
+               s2.s = s.s;
+               s2.i = s.i;
+               s2.l = s.l;
+               s2.f = s.f;
+               s2.d = s.d;
+
+               if ((s2.b != 0xde) || (s2.s != 0x12de) || (s2.i != 0xdeadbeef) || (s2.l != 0xcafebabe) || (s2.f != 3.14F) || (s2.d != 3.14))
+                       return 0;
+               else
+                       return 1;
+       }
+
        class TestRegA {
 
                long buf_start;