return b / 2;
}
+ static int test_719177_div_destreg () {
+ int year = 1970;
+ return ((365* (year-1)) + ((year-1)/4));
+ }
+
static int test_1_remun_imm () {
uint b = 13;
return (int)(b % 3);
}
static int test_2_bigremun_imm () {
- uint b = (uint)-2;
- return (int)(b % 3);
+ unchecked {
+ uint b = (uint)-2;
+ return (int)(b % 3);
+ }
}
static int test_2_rem () {
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;
return (int)res;
}
+ static int test_0_add_un_ovf () {
+ uint n = (uint)134217728 * 16;
+ uint number = checked (n + (uint)0);
+
+ return number == n ? 0 : 1;
+ }
+
static int test_3_or () {
int b = 2;
int a = 3;
return b << 3;
}
+ static int test_524288_shift_imm_large () {
+ int b = 2;
+ return b << 18;
+ }
+
static int test_12_shift_imm_inv () {
int b = 2;
return 3 << 2;
}
static int test_0_bigunrshift_imm () {
- uint b = (uint)-1;
- b = b >> 1;
- if (b != 0x7fffffff)
- return 1;
- return 0;
+ unchecked {
+ uint b = (uint)-1;
+ b = b >> 1;
+ if (b != 0x7fffffff)
+ return 1;
+ return 0;
+ }
}
static int test_0_bigrshift_imm () {
}
static int test_0_bigunrshift () {
- uint b = (uint)-1;
- int a = 1;
- b = b >> a;
- if (b != 0x7fffffff)
- return 1;
- return 0;
+ unchecked {
+ uint b = (uint)-1;
+ int a = 1;
+ b = b >> a;
+ if (b != 0x7fffffff)
+ return 1;
+ return 0;
+ }
}
static int test_0_bigrshift () {
}
return a + b + c;
}
+
+ static int test_0_short_sign_extend () {
+ int t1 = 0xffeedd;
+ short s1 = (short)t1;
+ int t2 = s1;
+
+ if ((uint)t2 != 0xffffeedd)
+ return 1;
+ else
+ return 0;
+ }
static int test_15_for_loop () {
int i;
c = -128;
b = (sbyte)c;
}
-
+
return 0;
}
Int16 b = (Int16)c;
c = -32768;
b = (Int16)c;
+ unchecked {
+ uint u = 0xfffffffd;
+ c = (int)u;
+ }
+ b = (Int16)c;
}
return 0;
return 0;
}
+ static unsafe int test_0_pin_string () {
+ string x = "xxx";
+ fixed (char *c = x) {
+ if (*c != 'x')
+ return 1;
+ }
+ return 0;
+ }
+
static int test_3_shift_regalloc () {
int shift = 8;
int orig = 1;
return 1;
return 0;
}
+
+ static int test_1_a_eq_b_plus_a () {
+ int a = 0, b = 1;
+ a = b + a;
+ return a;
+ }
+
+ static int test_0_comp () {
+ int a = 0;
+ int b = -1;
+ int error = 1;
+ bool val;
+
+ val = a < b;
+ if (val)
+ return error;
+ error++;
+
+ val = a > b;
+ if (!val)
+ return error;
+ error ++;
+
+ val = a == b;
+ if (val)
+ return error;
+ error ++;
+
+ val = a == a;
+ if (!val)
+ return error;
+ error ++;
+
+ return 0;
+ }
+
+ static int test_0_comp_unsigned () {
+ uint a = 1;
+ uint b = 0xffffffff;
+ int error = 1;
+ bool val;
+
+ val = a < b;
+ if (!val)
+ return error;
+ error++;
+
+ val = a <= b;
+ if (!val)
+ return error;
+ error++;
+
+ val = a == b;
+ if (val)
+ return error;
+ error++;
+
+ val = a >= b;
+ if (val)
+ return error;
+ error++;
+
+ val = a > b;
+ if (val)
+ return error;
+ error++;
+
+ val = b < a;
+ if (val)
+ return error;
+ error++;
+
+ val = b <= a;
+ if (val)
+ return error;
+ error++;
+
+ val = b == a;
+ if (val)
+ return error;
+ error++;
+
+ val = b > a;
+ if (!val)
+ return error;
+ error++;
+
+ val = b >= a;
+ if (!val)
+ return error;
+ error++;
+
+ return 0;
+ }
+
+ static int test_16_cmov ()
+ {
+ int n = 0;
+ if (n == 0)
+ n = 16;
+
+ return n;
+ }
+
+ static int my_flags;
+ static int test_0_and_cmp ()
+ {
+
+ /* various forms of test [mem], imm */
+
+ my_flags = 0x01020304;
+
+ if ((my_flags & 0x01020304) == 0)
+ return 1;
+
+ if ((my_flags & 0x00000304) == 0)
+ return 2;
+
+ if ((my_flags & 0x00000004) == 0)
+ return 3;
+
+ if ((my_flags & 0x00000300) == 0)
+ return 4;
+
+ if ((my_flags & 0x00020000) == 0)
+ return 5;
+
+ if ((my_flags & 0x01000000) == 0)
+ return 6;
+
+ /* test esi, imm */
+ int local = 0x01020304;
+
+ if ((local & 0x01020304) == 0)
+ return 7;
+
+ if ((local & 0x00000304) == 0)
+ return 8;
+
+ if ((local & 0x00000004) == 0)
+ return 9;
+
+ if ((local & 0x00000300) == 0)
+ return 10;
+
+ if ((local & 0x00020000) == 0)
+ return 11;
+
+ if ((local & 0x01000000) == 0)
+ return 12;
+
+ return 0;
+ }
+
+ static int test_0_cne ()
+ {
+ int x = 0;
+ int y = 1;
+
+ bool b = x != y;
+ bool bb = x != x;
+
+ if (!b)
+ return 1;
+ if (bb)
+ return 2;
+
+ return 0;
+ }
+
+ static byte b;
+ static int test_0_byte_compares ()
+ {
+ b = 0xff;
+ if (b == -1)
+ return 1;
+ b = 0;
+ if (!(b < System.Byte.MaxValue))
+ return 2;
+
+ if (!(b <= System.Byte.MaxValue))
+ return 3;
+
+ return 0;
+ }
+ static int test_0_cmp_regvar_zero ()
+ {
+ int n = 10;
+
+ if (!(n > 0 && n >= 0 && n != 0))
+ return 1;
+ if (n < 0 || n <= 0 || n == 0)
+ return 1;
+
+ return 0;
+ }
}