Merge "ART: Instanceof returns true if ref == 0 on x86-64"
diff --git a/compiler/dex/quick/x86/int_x86.cc b/compiler/dex/quick/x86/int_x86.cc
index ad18585..b342813 100644
--- a/compiler/dex/quick/x86/int_x86.cc
+++ b/compiler/dex/quick/x86/int_x86.cc
@@ -2352,6 +2352,11 @@
/* kArg0 is ref, kArg2 is class. If ref==null, use directly as bool result. */
RegLocation rl_result = GetReturn(kRefReg);
+ // On x86-64 kArg0 is not EAX, so we have to copy ref from kArg0 to EAX.
+ if (Gen64Bit()) {
+ OpRegCopy(rl_result.reg, TargetReg(kArg0));
+ }
+
// For 32-bit, SETcc only works with EAX..EDX.
DCHECK_LT(rl_result.reg.GetRegNum(), 4);