Merge "Fix build."
diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc
index 982d6d4..dd595d9 100644
--- a/compiler/optimizing/code_generator_arm.cc
+++ b/compiler/optimizing/code_generator_arm.cc
@@ -389,9 +389,6 @@
blocked_core_registers_[LR] = true;
blocked_core_registers_[PC] = true;
- // Reserve R4 for suspend check.
- blocked_core_registers_[R4] = true;
-
// Reserve thread register.
blocked_core_registers_[TR] = true;
@@ -401,6 +398,7 @@
// TODO: We currently don't use Quick's callee saved registers.
// We always save and restore R6 and R7 to make sure we can use three
// register pairs for long operations.
+ blocked_core_registers_[R4] = true;
blocked_core_registers_[R5] = true;
blocked_core_registers_[R8] = true;
blocked_core_registers_[R10] = true;
@@ -2204,12 +2202,15 @@
new (GetGraph()->GetArena()) SuspendCheckSlowPathARM(instruction, successor);
codegen_->AddSlowPath(slow_path);
- __ subs(R4, R4, ShifterOperand(1));
+ __ LoadFromOffset(
+ kLoadUnsignedHalfword, IP, TR, Thread::ThreadFlagsOffset<kArmWordSize>().Int32Value());
+ __ cmp(IP, ShifterOperand(0));
+ // TODO: Figure out the branch offsets and use cbz/cbnz.
if (successor == nullptr) {
- __ b(slow_path->GetEntryLabel(), EQ);
+ __ b(slow_path->GetEntryLabel(), NE);
__ Bind(slow_path->GetReturnLabel());
} else {
- __ b(codegen_->GetLabelOf(successor), NE);
+ __ b(codegen_->GetLabelOf(successor), EQ);
__ b(slow_path->GetEntryLabel());
}
}
diff --git a/test/422-type-conversion/src/Main.java b/test/422-type-conversion/src/Main.java
index 9974919..d2ffc5b 100644
--- a/test/422-type-conversion/src/Main.java
+++ b/test/422-type-conversion/src/Main.java
@@ -25,9 +25,33 @@
}
public static void main(String[] args) {
+ byteToLong();
+ shortToLong();
intToLong();
}
+ private static void byteToLong() {
+ assertEquals(1L, $opt$ByteToLong((byte)1));
+ assertEquals(0L, $opt$ByteToLong((byte)0));
+ assertEquals(-1L, $opt$ByteToLong((byte)-1));
+ assertEquals(51L, $opt$ByteToLong((byte)51));
+ assertEquals(-51L, $opt$ByteToLong((byte)-51));
+ assertEquals(127L, $opt$ByteToLong((byte)127)); // (2^7) - 1
+ assertEquals(-127L, $opt$ByteToLong((byte)-127)); // -(2^7) - 1
+ assertEquals(-128L, $opt$ByteToLong((byte)-128)); // -(2^7)
+ }
+
+ private static void shortToLong() {
+ assertEquals(1L, $opt$ShortToLong((short)1));
+ assertEquals(0L, $opt$ShortToLong((short)0));
+ assertEquals(-1L, $opt$ShortToLong((short)-1));
+ assertEquals(51L, $opt$ShortToLong((short)51));
+ assertEquals(-51L, $opt$ShortToLong((short)-51));
+ assertEquals(32767L, $opt$ShortToLong((short)32767)); // (2^15) - 1
+ assertEquals(-32767L, $opt$ShortToLong((short)-32767)); // -(2^15) - 1
+ assertEquals(-32768L, $opt$ShortToLong((short)-32768)); // -(2^15)
+ }
+
private static void intToLong() {
assertEquals(1L, $opt$IntToLong(1));
assertEquals(0L, $opt$IntToLong(0));
@@ -39,7 +63,18 @@
assertEquals(-2147483648L, $opt$IntToLong(-2147483648)); // -(2^31)
}
- static long $opt$IntToLong(int a){
+ static long $opt$ByteToLong(byte a) {
+ // Translates to an int-to-long Dex instruction.
+ return a;
+ }
+
+ static long $opt$ShortToLong(short a) {
+ // Translates to an int-to-long Dex instruction.
+ return a;
+ }
+
+ static long $opt$IntToLong(int a) {
+ // Translates to an int-to-long Dex instruction.
return a;
}
}