C
}
+struct Alpha {
+ public long a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;
+}
+
+struct Beta {
+ public Alpha a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;
+}
+
+struct Gamma {
+ public Beta a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;
+}
+
class Tests {
static int Main () {
return pass_struct3 (1, 2, 3, 4, 5, 6, 7, 8, s, 9);
}
+ // Struct with unaligned size on 64 bit machines
+ struct Struct4 {
+ public int i, j, k, l, m;
+ public int i1, i2, i3, i4, i5, i6;
+ }
+
+ static int pass_struct4 (Struct4 s) {
+ if (s.i + s.j + s.k + s.l + s.m != 15)
+ return 1;
+ else
+ return 0;
+ }
+
+ public static int test_0_struct4_args () {
+ Struct4 s = new Struct4 ();
+ s.i = 1;
+ s.j = 2;
+ s.k = 3;
+ s.l = 4;
+ s.m = 5;
+
+ return pass_struct4 (s);
+ }
+
+
+
struct AStruct {
public int i;
return 1;
}
+ struct AStruct2 {
+ public int i;
+ public int j;
+ }
+
+ static float pass_vtype_return_float (AStruct2 s) {
+ return s.i + s.j == 6 ? 1.0f : -1.0f;
+ }
+
+ public static int test_0_vtype_arg_soft_float () {
+ return pass_vtype_return_float (new AStruct2 () { i = 2, j = 4 }) > 0.0 ? 0 : 1;
+ }
+
static int range_check_strlen (int i, string s) {
if (i < 0 || i > s.Length)
return 1;
return 4;
return 0;
}
+
+ static int test_0_array_get_set_soft_float () {
+ float[,] arr = new float [2, 2];
+ arr [0, 0] = 256f;
+ return arr [0, 0] == 256f ? 0 : 1;
+ }
+
+ //repro for #506915
+ struct Bug506915 { public int val; }
+ static int test_2_ldobj_stobj_optization ()
+ {
+ int i = 99;
+ var a = new Bug506915 ();
+ var b = new Bug506915 ();
+ if (i.GetHashCode () == 99)
+ i = 44;
+ var array = new Bug506915 [2];
+ array [0].val = 2;
+ array [1] = (i == 0) ? a : array [0];
+
+ return array [1].val;
+ }
+
+ /* mcs can't compile this (#646744) */
+#if FALSE
+ static void InitMe (out Gamma noMercyWithTheStack) {
+ noMercyWithTheStack = new Gamma ();
+ }
+
+ static int FunNoInline () {
+ int x = 99;
+ if (x > 344 && x < 22)
+ return 333;
+ return x;
+ }
+
+ static float DoNothingButDontInline (float a, int b) {
+ if (b > 0)
+ return a;
+ else if (b < 0 && b > 10)
+ return 444.0f;
+ return a;
+ }
+
+ /*
+ * The local register allocator emits loadr8_membase and storer8_membase
+ * to do spilling. This code is generated after mono_arch_lowering_pass so
+ * mono_arch_output_basic_block must know how to deal with big offsets.
+ * This only happens because the call in middle forces the temp for "(float)obj"
+ * to be spilled.
+ */
+ public static int test_0_float_load_and_store_with_big_offset ()
+ {
+ object obj = 1.0f;
+ Gamma noMercyWithTheStack;
+ float res;
+
+ InitMe (out noMercyWithTheStack);
+
+ res = DoNothingButDontInline ((float)obj, FunNoInline ());
+
+ if (!(res == 1.0f))
+ return 1;
+ return 0;
+ }
+#endif
+
+ struct VTypePhi {
+ public int i;
+ }
+
+ static int vtype_phi (VTypePhi v1, VTypePhi v2, bool first) {
+ VTypePhi v = first ? v1 : v2;
+
+ return v.i;
+ }
+
+ static int test_0_vtype_phi ()
+ {
+ VTypePhi v1 = new VTypePhi () { i = 1 };
+ VTypePhi v2 = new VTypePhi () { i = 2 };
+
+ if (vtype_phi (v1, v2, true) != 1)
+ return 1;
+ if (vtype_phi (v1, v2, false) != 2)
+ return 2;
+
+ return 0;
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ static void UseValue (int index)
+ {
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ static bool IsFalse ()
+ {
+ return false;
+ }
+
+ static int test_0_llvm_moving_faulting_loads ()
+ {
+ int[] indexes = null;
+
+ if (IsFalse ()) {
+ indexes = new int[0];
+ }
+
+ while (IsFalse ()) {
+ UseValue (indexes[0]);
+ UseValue (indexes[0]);
+ }
+
+ return 0;
+ }
+
+ public static bool flag;
+
+ class B {
+
+ internal static B[] d;
+
+ static B () {
+ flag = true;
+ }
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ static int regress_679467_inner () {
+ if (flag == true)
+ return 1;
+ var o = B.d;
+ var o2 = B.d;
+ return 0;
+ }
+
+ static int test_0_multiple_cctor_calls_regress_679467 () {
+ flag = false;
+ return regress_679467_inner ();
+ }
}