Work around Jack optimizations in arm64 shifter operand test.
And also in the ror test.
Bug: 28392114
Change-Id: I66afb371de57d7742385d5e02daa2797cb8d1b22
diff --git a/test/551-checker-shifter-operand/src/Main.java b/test/551-checker-shifter-operand/src/Main.java
index edb8a68..a4561b8 100644
--- a/test/551-checker-shifter-operand/src/Main.java
+++ b/test/551-checker-shifter-operand/src/Main.java
@@ -500,9 +500,9 @@
assertIntEquals(a + $noinline$IntShl(b, 16), a + (b << 16));
assertIntEquals(a + $noinline$IntShl(b, 30), a + (b << 30));
assertIntEquals(a + $noinline$IntShl(b, 31), a + (b << 31));
- assertIntEquals(a + $noinline$IntShl(b, 32), a + (b << 32));
- assertIntEquals(a + $noinline$IntShl(b, 62), a + (b << 62));
- assertIntEquals(a + $noinline$IntShl(b, 63), a + (b << 63));
+ assertIntEquals(a + $noinline$IntShl(b, 32), a + (b << $opt$inline$IntConstant32()));
+ assertIntEquals(a + $noinline$IntShl(b, 62), a + (b << $opt$inline$IntConstant62()));
+ assertIntEquals(a + $noinline$IntShl(b, 63), a + (b << $opt$inline$IntConstant63()));
assertIntEquals(a - $noinline$IntShr(b, 1), a - (b >> 1));
assertIntEquals(a - $noinline$IntShr(b, 6), a - (b >> 6));
@@ -513,9 +513,9 @@
assertIntEquals(a - $noinline$IntShr(b, 16), a - (b >> 16));
assertIntEquals(a - $noinline$IntShr(b, 30), a - (b >> 30));
assertIntEquals(a - $noinline$IntShr(b, 31), a - (b >> 31));
- assertIntEquals(a - $noinline$IntShr(b, 32), a - (b >> 32));
- assertIntEquals(a - $noinline$IntShr(b, 62), a - (b >> 62));
- assertIntEquals(a - $noinline$IntShr(b, 63), a - (b >> 63));
+ assertIntEquals(a - $noinline$IntShr(b, 32), a - (b >> $opt$inline$IntConstant32()));
+ assertIntEquals(a - $noinline$IntShr(b, 62), a - (b >> $opt$inline$IntConstant62()));
+ assertIntEquals(a - $noinline$IntShr(b, 63), a - (b >> $opt$inline$IntConstant63()));
assertIntEquals(a ^ $noinline$IntUshr(b, 1), a ^ (b >>> 1));
assertIntEquals(a ^ $noinline$IntUshr(b, 6), a ^ (b >>> 6));
@@ -526,11 +526,17 @@
assertIntEquals(a ^ $noinline$IntUshr(b, 16), a ^ (b >>> 16));
assertIntEquals(a ^ $noinline$IntUshr(b, 30), a ^ (b >>> 30));
assertIntEquals(a ^ $noinline$IntUshr(b, 31), a ^ (b >>> 31));
- assertIntEquals(a ^ $noinline$IntUshr(b, 32), a ^ (b >>> 32));
- assertIntEquals(a ^ $noinline$IntUshr(b, 62), a ^ (b >>> 62));
- assertIntEquals(a ^ $noinline$IntUshr(b, 63), a ^ (b >>> 63));
+ assertIntEquals(a ^ $noinline$IntUshr(b, 32), a ^ (b >>> $opt$inline$IntConstant32()));
+ assertIntEquals(a ^ $noinline$IntUshr(b, 62), a ^ (b >>> $opt$inline$IntConstant62()));
+ assertIntEquals(a ^ $noinline$IntUshr(b, 63), a ^ (b >>> $opt$inline$IntConstant63()));
}
+ // Hiding constants outside the range [0, 32) used for int shifts from Jack.
+ // (Jack extracts only the low 5 bits.)
+ public static int $opt$inline$IntConstant32() { return 32; }
+ public static int $opt$inline$IntConstant62() { return 62; }
+ public static int $opt$inline$IntConstant63() { return 63; }
+
static long $noinline$LongShl(long b, long c) {
if (doThrow) throw new Error();
diff --git a/test/557-checker-instruction-simplifier-ror/src/Main.java b/test/557-checker-instruction-simplifier-ror/src/Main.java
index 310611b..6d8b74d 100644
--- a/test/557-checker-instruction-simplifier-ror/src/Main.java
+++ b/test/557-checker-instruction-simplifier-ror/src/Main.java
@@ -175,28 +175,32 @@
// (i >>> #distance) | (i << #-distance)
- /// CHECK-START: int Main.ror_int_constant_c_negc(int) instruction_simplifier (before)
+ /// CHECK-START: int Main.ror_int_constant_c_negc(int) instruction_simplifier_after_bce (before)
/// CHECK: <<ArgValue:i\d+>> ParameterValue
/// CHECK: <<Const2:i\d+>> IntConstant 2
- /// CHECK: <<ConstNeg2:i\d+>> IntConstant {{-2|30}}
+ /// CHECK: <<ConstNeg2:i\d+>> IntConstant -2
/// CHECK-DAG: <<UShr:i\d+>> UShr [<<ArgValue>>,<<Const2>>]
/// CHECK-DAG: <<Shl:i\d+>> Shl [<<ArgValue>>,<<ConstNeg2>>]
/// CHECK: <<Or:i\d+>> Or [<<UShr>>,<<Shl>>]
/// CHECK: Return [<<Or>>]
- /// CHECK-START: int Main.ror_int_constant_c_negc(int) instruction_simplifier (after)
+ /// CHECK-START: int Main.ror_int_constant_c_negc(int) instruction_simplifier_after_bce (after)
/// CHECK: <<ArgValue:i\d+>> ParameterValue
/// CHECK: <<Const2:i\d+>> IntConstant 2
/// CHECK: <<Ror:i\d+>> Ror [<<ArgValue>>,<<Const2>>]
/// CHECK: Return [<<Ror>>]
- /// CHECK-START: int Main.ror_int_constant_c_negc(int) instruction_simplifier (after)
+ /// CHECK-START: int Main.ror_int_constant_c_negc(int) instruction_simplifier_after_bce (after)
/// CHECK-NOT: UShr
/// CHECK-NOT: Shl
public static int ror_int_constant_c_negc(int value) {
- return (value >>> 2) | (value << -2);
+ return (value >>> 2) | (value << $opt$inline$IntConstantM2());
}
+ // Hiding constants outside the range [0, 32) used for int shifts from Jack.
+ // (Jack extracts only the low 5 bits.)
+ public static int $opt$inline$IntConstantM2() { return -2; }
+
// (j >>> #distance) | (j << #-distance)
/// CHECK-START: long Main.ror_long_constant_c_negc(long) instruction_simplifier (before)