Fix Mips/x86 compilers
An incorrect conversion of an #ifdef to a runtime test broke
division by literals for non-Arm targets.
Change-Id: I0065606f668df8478fb33e55077fcc5b734cb3af
diff --git a/src/compiler/codegen/GenCommon.cc b/src/compiler/codegen/GenCommon.cc
index 035617e..cc3685c 100644
--- a/src/compiler/codegen/GenCommon.cc
+++ b/src/compiler/codegen/GenCommon.cc
@@ -1803,8 +1803,9 @@
bool handleEasyDivide(CompilationUnit* cUnit, Instruction::Code dalvikOpcode,
RegLocation rlSrc, RegLocation rlDest, int lit)
{
- if (lit < 2)
+ if ((lit < 2) || ((cUnit->instructionSet != kThumb2) && !isPowerOfTwo(lit))) {
return false;
+ }
// No divide instruction for Arm, so check for more special cases
if ((cUnit->instructionSet == kThumb2) && !isPowerOfTwo(lit)) {
return smallLiteralDivide(cUnit, dalvikOpcode, rlSrc, rlDest, lit);