OSDN Git Service

Merge "ART: Remove LowestSetBit and IsPowerOfTwo"
authorAndreas Gampe <agampe@google.com>
Tue, 6 Jan 2015 16:54:43 +0000 (16:54 +0000)
committerGerrit Code Review <noreply-gerritcodereview@google.com>
Tue, 6 Jan 2015 16:54:43 +0000 (16:54 +0000)
1  2 
compiler/dex/quick/arm/int_arm.cc

@@@ -567,17 -568,9 +568,17 @@@ bool ArmMir2Lir::SmallLiteralDivRem(Ins
  
  // Try to convert *lit to 1 RegRegRegShift/RegRegShift form.
  bool ArmMir2Lir::GetEasyMultiplyOp(int lit, ArmMir2Lir::EasyMultiplyOp* op) {
 +  if (lit == 0) {
 +    // Special case for *divide-by-zero*. The ops won't actually be used to generate code, as
 +    // GenArithOpIntLit will directly generate exception-throwing code, and multiply-by-zero will
 +    // have been optimized away earlier.
 +    op->op = kOpInvalid;
 +    return true;
 +  }
 +
    if (IsPowerOfTwo(lit)) {
      op->op = kOpLsl;
-     op->shift = LowestSetBit(lit);
+     op->shift = CTZ(lit);
      return true;
    }