return b / 2;
}
+ public static int test_2_div_fold4 () {
+ int b = -8;
+ return -(b / 4);
+ }
+
+ public static int test_2_div_fold16 () {
+ int b = 32;
+ return b / 16;
+ }
+
public static int test_719177_div_destreg () {
int year = 1970;
return ((365* (year-1)) + ((year-1)/4));
return (int)res;
}
- public static int test_0_add_ovf () {
+ public static int test_0_add_ovf1 () {
int i, j, k;
checked {
if (k != System.Int32.MinValue)
return 1;
+ return 0;
+ }
+
+ public static int test_0_add_ovf2 () {
+ int i, j, k;
checked {
i = System.Int32.MaxValue;
if (k != System.Int32.MaxValue)
return 2;
+ return 0;
+ }
+
+ public static int test_0_add_ovf3 () {
+ int i, j, k;
checked {
i = System.Int32.MinValue;
if (k != -1)
return 3;
+ return 0;
+ }
+
+ public static int test_0_add_ovf4 () {
+ int i, j, k;
checked {
i = System.Int32.MaxValue;
if (k != -1)
return 4;
+ return 0;
+ }
+
+ public static int test_0_add_ovf5 () {
+ int i, j, k;
checked {
i = System.Int32.MinValue + 1234;
if (k != System.Int32.MinValue)
return 5;
+ return 0;
+ }
+
+ public static int test_0_add_ovf6 () {
+ int i, j, k;
checked {
i = System.Int32.MaxValue - 1234;
return number == n ? 0 : 1;
}
- public static int test_0_sub_ovf () {
+ public static int test_0_sub_ovf1 () {
int i, j, k;
checked {
if (k != System.Int32.MinValue)
return 1;
+ return 0;
+ }
+
+ public static int test_0_sub_ovf2 () {
+ int i, j, k;
+
checked {
i = System.Int32.MaxValue;
j = 0;
if (k != System.Int32.MaxValue)
return 2;
+ return 0;
+ }
+
+ public static int test_0_sub_ovf3 () {
+ int i, j, k;
+
checked {
i = System.Int32.MinValue;
j = System.Int32.MinValue + 1234;
if (k != -1234)
return 3;
+ return 0;
+ }
+
+ public static int test_0_sub_ovf4 () {
+ int i, j, k;
+
checked {
i = System.Int32.MaxValue;
j = 1234;
if (k != System.Int32.MaxValue - 1234)
return 4;
+ return 0;
+ }
+
+ public static int test_0_sub_ovf5 () {
+ int i, j, k;
+
checked {
i = System.Int32.MaxValue - 1234;
j = -1234;
if (k != System.Int32.MaxValue)
return 5;
+ return 0;
+ }
+
+ public static int test_0_sub_ovf6 () {
+ int i, j, k;
+
checked {
i = System.Int32.MinValue + 1234;
j = 1234;
return 1;
else
return 0;
- }
+ }
+
+ public static int test_127_iconv_to_i1 () {
+ int i = 0x100017f;
+ sbyte s = (sbyte)i;
+
+ return s;
+ }
+
+ public static int test_384_iconv_to_i2 () {
+ int i = 0x1000180;
+ short s = (short)i;
+
+ return s;
+ }
public static int test_15_for_loop () {
int i;
return 0;
}
-
- static byte b;
- public 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;
- }
+
public static int test_0_cmp_regvar_zero ()
{
int n = 10;
return 0;
}
+ public static int test_5_div_un_cfold ()
+ {
+ uint i = 10;
+ uint j = 2;
+
+ return (int)(i / j);
+ }
+
+ public static int test_1_rem_un_cfold ()
+ {
+ uint i = 11;
+ uint j = 2;
+
+ return (int)(i % j);
+ }
+
+ public static int test_0_div_opt () {
+ int i;
+
+ // Avoid cfolding this
+ i = 0;
+ for (int j = 0; j < 1234567; ++j)
+ i ++;
+ if ((i / 2) != 617283)
+ return 1;
+ if ((i / 4) != 308641)
+ return 2;
+ if ((i / 8) != 154320)
+ return 3;
+ if ((i / 16) != 77160)
+ return 4;
+
+ // Avoid cfolding this
+ i = 0;
+ for (int j = 0; j < 1234567; ++j)
+ i --;
+ if ((i / 2) != -617283)
+ return 5;
+ if ((i / 4) != -308641)
+ return 6;
+ if ((i / 8) != -154320)
+ return 7;
+ if ((i / 16) != -77160)
+ return 8;
+
+ return 0;
+ }
+
+ public static int test_0_rem_opt () {
+ int i;
+
+ // Avoid cfolding this
+ i = 0;
+ for (int j = 0; j < 29; ++j)
+ i ++;
+ if ((i % 2) != 1)
+ return 1;
+ if ((i % 4) != 1)
+ return 2;
+ if ((i % 8) != 5)
+ return 3;
+ if ((i % 16) != 13)
+ return 4;
+
+ // Avoid cfolding this
+ i = 0;
+ for (int j = 0; j < 29; ++j)
+ i --;
+ if ((i % 2) != -1)
+ return 5;
+ if ((i % 4) != -1)
+ return 6;
+ if ((i % 8) != -5)
+ return 7;
+ if ((i % 16) != -13)
+ return 8;
+
+ return 0;
+ }
+
+ public static int cmov (int i) {
+ int j = 0;
+
+ if (i > 0)
+ j = 1;
+
+ return j;
+ }
+
+ public static int cmov2 (int i) {
+ int j = 0;
+
+ if (i <= 0)
+ ;
+ else
+ j = 1;
+
+ return j;
+ }
+
+ public static int test_0_branch_to_cmov_opt () {
+ if (cmov (0) != 0)
+ return 1;
+ if (cmov (1) != 1)
+ return 2;
+ if (cmov2 (0) != 0)
+ return 1;
+ if (cmov2 (1) != 1)
+ return 2;
+ return 0;
+ }
}