Fix x86 compilation of aget-wide when src and dest regs are the same.
The base register was being overwritten by half of the result, so now a
temp is allocated to hold the address that is loaded from.
Change-Id: I5efd45f06538f6b7d691c942c9e602b321a090ba
diff --git a/src/compiler/codegen/GenCommon.cc b/src/compiler/codegen/GenCommon.cc
index 2209084..e9c348a 100644
--- a/src/compiler/codegen/GenCommon.cc
+++ b/src/compiler/codegen/GenCommon.cc
@@ -1501,11 +1501,12 @@
lenOffset, mir, kThrowArrayBounds);
}
if ((size == kLong) || (size == kDouble)) {
+ int regAddr = oatAllocTemp(cUnit);
+ newLIR5(cUnit, kX86Lea32RA, regAddr, rlArray.lowReg, rlIndex.lowReg, scale, dataOffset);
+ oatFreeTemp(cUnit, rlArray.lowReg);
+ oatFreeTemp(cUnit, rlIndex.lowReg);
rlResult = oatEvalLoc(cUnit, rlDest, regClass, true);
- loadBaseIndexedDisp(cUnit, NULL, rlArray.lowReg, rlIndex.lowReg, scale,
- dataOffset, rlResult.lowReg, rlResult.highReg, size,
- INVALID_SREG);
-
+ loadPair(cUnit, regAddr, rlResult.lowReg, rlResult.highReg);
storeValueWide(cUnit, rlDest, rlResult);
} else {
rlResult = oatEvalLoc(cUnit, rlDest, regClass, true);