* *.cs: New regression tests.
svn path=/trunk/mono/; revision=23371
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.
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);
}
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;
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;
using System;
using System.Reflection;
+using System.Runtime.InteropServices;
/*
* Regression tests for the mono JIT.
public long d;
}
+struct Small {
+ public byte b1;
+ public byte b2;
+}
+
class Sample {
public int a;
public Sample (int v) {
}
}
+[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,
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;
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;