Add some s390 specific tests
authorNeale Ferguson <neale@mono-cvs.ximian.com>
Fri, 30 Jul 2004 23:11:29 +0000 (23:11 -0000)
committerNeale Ferguson <neale@mono-cvs.ximian.com>
Fri, 30 Jul 2004 23:11:29 +0000 (23:11 -0000)
svn path=/trunk/mono/; revision=31690

mono/arch/s390/ChangeLog [new file with mode: 0644]
mono/mini/ChangeLog
mono/mini/s390-abi.cs [new file with mode: 0644]

diff --git a/mono/arch/s390/ChangeLog b/mono/arch/s390/ChangeLog
new file mode 100644 (file)
index 0000000..6d033e7
--- /dev/null
@@ -0,0 +1,4 @@
+2004-07-30     Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com>
+
+       * s390-codegen.h: reworked macros for code generation.
+
index 11a0bc092924b011f0be67d9d4fa19bd65e898e6..d259cc24d8a32dc20074c875b13e8d5740dcf1a5 100644 (file)
@@ -1,3 +1,9 @@
+2004-07-30  Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com>
+
+       * mini-s390.c: Corrected macro in emit_float_to_int
+
+       * s390-abi.cs: Tests to exercise the s390 ABI
+
 2004-07-30  Zoltan Varga  <vargaz@freemail.hu>
 
        * exceptions-amd64.c (mono_arch_find_jit_info): Fix restoring of
diff --git a/mono/mini/s390-abi.cs b/mono/mini/s390-abi.cs
new file mode 100644 (file)
index 0000000..ec404b1
--- /dev/null
@@ -0,0 +1,319 @@
+using System;
+using System.Reflection;
+
+/*
+ * Regression tests for the mono JIT.
+ *
+ * Each test needs to be of the form:
+ *
+ * static int test_<result>_<name> ();
+ *
+ * where <result> is an integer (the value that needs to be returned by
+ * the method to make it pass.
+ * <name> is a user-displayed name used to identify the test.
+ *
+ * The tests can be driven in two ways:
+ * *) running the program directly: Main() uses reflection to find and invoke
+ *     the test methods (this is useful mostly to check that the tests are correct)
+ * *) with the --regression switch of the jit (this is the preferred way since
+ *     all the tests will be run with optimizations on and off)
+ *
+ * The reflection logic could be moved to a .dll since we need at least another
+ * regression test file written in IL code to have better control on how
+ * the IL code looks.
+ */
+
+class Tests {
+
+       public struct TestStruct1 
+       {
+               public int a;
+       }
+       
+       public struct TestStruct2
+       {       
+               public int a;
+               public int b;
+       }
+
+       public struct TestStruct3
+       {
+               public int a;
+               public int b;
+               public int c;
+       }
+
+       static int Main () {
+               return TestDriver.RunTests (typeof (Tests));
+       }
+
+       static void reg_struct(TestStruct1 regStruct) 
+       {
+               regStruct.a = 1;
+       }
+
+       static int test_0_regstruct () 
+       {
+               TestStruct1 myStruct;
+               myStruct.a = 1;
+               reg_struct(myStruct);
+               if (myStruct.a == 1)
+                       return 0;
+               else
+                       return 1;
+       }
+
+       static int reg_struct_ret(TestStruct2 regStruct) 
+       {
+               return regStruct.b;
+       }
+
+       static int test_0_reg_return () 
+       {
+               TestStruct2 myStruct;
+               myStruct.a = 0;
+               myStruct.b = 42;
+               if (reg_struct_ret(myStruct) == 42)
+                       return 0;
+               return 2;
+       }
+
+       static int spill_regs (int a, int b, int c, int d, int e, int f)
+       {
+               return f;
+       }
+
+       static int test_0_spill_regs ()
+       {
+               if (spill_regs (1, 2, 3, 4, 5, 6) == 6)
+                       return 0;
+               else
+                       return 3;
+       }
+
+       static TestStruct3 spill_struct (TestStruct3 regStruct)
+       {
+               regStruct.c = 99;
+               return(regStruct);
+       }
+
+       static int spill_struct_void (TestStruct3 regStruct)
+       {
+               if (regStruct.c == 255)
+                       return 0;
+               else
+                       return 7;
+       }
+
+       static int receive_spill_struct (TestStruct2 regStruct)
+       {
+               if (regStruct.b == 181)
+                       return 0;
+               else
+                       return 8;
+       }
+
+       static int pass_spill_struct_big (int a, int b, int c, int d, int e, TestStruct3 regStruct)
+       {
+               int retVal;
+               retVal = receive_spill_struct_big(regStruct);
+               return retVal;
+       }
+
+       static int receive_spill_struct_big (TestStruct3 regStruct)
+       {
+               if (regStruct.c == 999)
+                       return 0;
+               else
+                       return 9;
+       }
+
+       static int receive_struct_spill (int a, int b, int c, int d, int e, TestStruct2 regStruct)
+       {
+               if (regStruct.b == 181)
+                       return 0;
+               else
+                       return 10;
+       }
+
+       static int receive_struct_spill_big (int a, int b, int c, int d, int e, TestStruct3 regStruct)
+       {
+               if (regStruct.c == 999)
+                       return 0;
+               else
+                       return 11;
+       }
+
+       static int pass_spill_struct (int a, int b, int c, int d, int e, TestStruct2 regStruct)
+       {
+               int retVal;
+               retVal = receive_spill_struct(regStruct);
+               return retVal;
+       }
+
+       static int pass_struct_spill (TestStruct2 regStruct)
+       {
+               int retVal;
+               retVal = receive_struct_spill(1,2,3,4,5,regStruct);
+               return retVal;
+       }
+
+       static int pass_struct_spill_big(TestStruct3 regStruct)
+       {
+               int retVal;
+               retVal = receive_struct_spill_big(1,2,3,4,5,regStruct);
+               return retVal;
+       }
+
+       static int pass_spill_struct_spill (int a, int b, int c, int d, int e, TestStruct2 regStruct)
+       {
+               int retVal;
+               retVal = receive_struct_spill(a,b,c,d,e,regStruct);
+               return retVal;
+       }
+
+       static int pass_spill_struct_spill_big(int a, int b, int c, int d, int e, TestStruct3 regStruct)
+       {
+               int retVal;
+               retVal = receive_struct_spill_big(a,b,c,d,e,regStruct);
+               return retVal;
+       }
+
+       static int test_0_spill () 
+       {
+               TestStruct3 myStruct;
+               myStruct.a = 64;        
+               myStruct.b = 255;
+               myStruct.c = 127;
+               myStruct = spill_struct(myStruct);
+               if (myStruct.c == 99)
+                       return 0;
+               return myStruct.c;
+       }
+
+       static int test_0_spill_void ()
+       {
+               TestStruct3 myStruct;
+               myStruct.a = 0;
+               myStruct.b = 127;
+               myStruct.c = 255;
+               return (spill_struct_void(myStruct));
+       }
+
+       static int spill_struct_ret (TestStruct3 regStruct)
+       {
+               return (regStruct.c);
+               
+       }
+
+       static int test_0_spill_ret ()
+       {
+               TestStruct3 myStruct;
+               myStruct.a = 0; 
+               myStruct.b = 0;
+               myStruct.c = 69;
+               if (spill_struct_ret(myStruct) == 69)
+                       return 0;
+               return 5;
+       }
+
+       static TestStruct2 struct_ret(TestStruct2 regStruct)
+       {
+               regStruct.a = -1;
+               regStruct.b = 72;
+               return(regStruct);
+       }
+
+       static int test_0_struct_ret ()
+       {
+               TestStruct2 myStruct;
+               myStruct.a = 99;
+               myStruct.b = 14;
+               myStruct = struct_ret(myStruct);
+               if (myStruct.b == 72)
+                       return 0;
+               else
+                       return myStruct.b;
+       }
+
+       static float TestSingle (float a, float b, float c)
+       {
+               return b;
+       }
+
+       static int test_0_TestSingle ()
+       {
+               float a = 3F; float b = 4.5F; float c = 900F;
+               if (TestSingle(a, b, c) == b)
+                       return 0;
+               else
+                       return 6;
+       }
+
+       static int test_0_pass_spill ()
+       {
+               TestStruct2 myStruct;
+               myStruct.a = 32;
+               myStruct.b = 181;
+               return (pass_spill_struct (1, 2, 3, 4, 5, myStruct));
+       }
+               
+       static int test_0_pass_spill_big ()
+       {
+               TestStruct3 myStruct;
+               myStruct.a = 32;
+               myStruct.b = 181;
+               myStruct.c = 999;
+               return (pass_spill_struct_big (1, 2, 3, 4, 5, myStruct));
+       }
+               
+       static int test_0_pass_struct_spill ()
+       {
+               TestStruct2 myStruct;
+               myStruct.a = 32;
+               myStruct.b = 181;
+               return (pass_struct_spill (myStruct));
+       }
+               
+       static int test_0_pass_struct_spill_big ()
+       {
+               TestStruct3 myStruct;
+               myStruct.a = 32;
+               myStruct.b = 181;
+               myStruct.c = 999;
+               return (pass_struct_spill_big (myStruct));
+       }
+               
+       static int test_0_pass_spill_struct_spill ()
+       {
+               TestStruct2 myStruct;
+               myStruct.a = 32;
+               myStruct.b = 181;
+               return (pass_spill_struct_spill (1,2,3,4,5,myStruct));
+       }
+               
+       static int test_0_pass_spill_struct_spill_big ()
+       {
+               TestStruct3 myStruct;
+               myStruct.a = 32;
+               myStruct.b = 181;
+               myStruct.c = 999;
+               return (pass_spill_struct_spill_big (1,2,3,4,5,myStruct));
+       }
+
+       static long pass_long_odd (int a, long b)
+       {
+               return (b);
+       }
+               
+       static int test_0_pass_long_odd ()
+       {
+               int a = 5;
+               long b = 9000;
+               if (pass_long_odd(a,b) == 9000)
+                       return 0;
+               else
+                       return 9;
+       }
+
+}