summaryrefslogtreecommitdiff
path: root/src/compiler/codegen
diff options
context:
space:
mode:
author buzbee <buzbee@google.com> 2012-11-01 15:35:27 -0700
committer buzbee <buzbee@google.com> 2012-11-01 15:35:27 -0700
commit0f79d728370ab51b9b16a356b058c48330f43148 (patch)
tree308b16055cec67d4755eccdc82c26741f68114cd /src/compiler/codegen
parent5b3c889b316746ddc835289aa6600cd967f2ecfe (diff)
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
Diffstat (limited to 'src/compiler/codegen')
-rw-r--r--src/compiler/codegen/GenCommon.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/codegen/GenCommon.cc b/src/compiler/codegen/GenCommon.cc
index 035617e8f3..cc3685c6f6 100644
--- a/src/compiler/codegen/GenCommon.cc
+++ b/src/compiler/codegen/GenCommon.cc
@@ -1803,8 +1803,9 @@ int lowestSetBit(unsigned int x) {
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);