+ 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;
+ }
+
+ public static unsafe int test_0_ishr_sign_extend () {
+ // Check that ishr does sign extension from bit 31 on 64 bit platforms
+ uint val = 0xF0000000u;
+
+ uint *a = &val;
+ uint ui = (uint)((int)(*a) >> 2);
+
+ if (ui != 0xfc000000)
+ return 1;
+
+ // Same with non-immediates
+ int amount = 2;
+
+ ui = (uint)((int)(*a) >> amount);
+
+ if (ui != 0xfc000000)
+ return 2;
+
+ return 0;
+ }
+
+ public static unsafe int test_0_ishr_sign_extend_cfold () {
+ int i = 32768;
+ int j = i << 16;
+ int k = j >> 16;
+
+ return k == -32768 ? 0 : 1;
+ }