diff options
author | Calin Juravle <calin@google.com> | 2014-11-06 17:09:03 +0000 |
---|---|---|
committer | Calin Juravle <calin@google.com> | 2014-11-06 17:21:16 +0000 |
commit | 865fc88fdfd006ce0362c2c0d55c66a7bffdab61 (patch) | |
tree | 35670296d924c9619a18a4149134e069de6ae48d /compiler/optimizing/builder.cc | |
parent | d375fabd9e8cbb805fd12a33d94aa0729432ff3a (diff) | |
download | android_art-865fc88fdfd006ce0362c2c0d55c66a7bffdab61.tar.gz android_art-865fc88fdfd006ce0362c2c0d55c66a7bffdab61.tar.bz2 android_art-865fc88fdfd006ce0362c2c0d55c66a7bffdab61.zip |
[optimizing compiler] Add DIV_INT_2ADDR
Change-Id: I38fc7e216f820d8ccc8bbf8b8e7a67b75fb9de87
Diffstat (limited to 'compiler/optimizing/builder.cc')
-rw-r--r-- | compiler/optimizing/builder.cc | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index e43841a03d..6ee236ea29 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -537,16 +537,16 @@ bool HGraphBuilder::BuildStaticFieldAccess(const Instruction& instruction, return true; } -void HGraphBuilder::BuildCheckedDiv(const Instruction& instruction, +void HGraphBuilder::BuildCheckedDiv(uint16_t out_reg, + uint16_t first_reg, + uint16_t second_reg, uint32_t dex_offset, Primitive::Type type, bool second_is_lit) { DCHECK(type == Primitive::kPrimInt); - HInstruction* first = LoadLocal(instruction.VRegB(), type); - HInstruction* second = second_is_lit - ? GetIntConstant(instruction.VRegC()) - : LoadLocal(instruction.VRegC(), type); + HInstruction* first = LoadLocal(first_reg, type); + HInstruction* second = second_is_lit ? GetIntConstant(second_reg) : LoadLocal(second_reg, type); if (!second->IsIntConstant() || (second->AsIntConstant()->GetValue() == 0)) { second = new (arena_) HDivZeroCheck(second, dex_offset); Temporaries temps(graph_, 1); @@ -555,7 +555,7 @@ void HGraphBuilder::BuildCheckedDiv(const Instruction& instruction, } current_block_->AddInstruction(new (arena_) HDiv(type, first, second)); - UpdateLocal(instruction.VRegA(), current_block_->GetLastInstruction()); + UpdateLocal(out_reg, current_block_->GetLastInstruction()); } void HGraphBuilder::BuildArrayAccess(const Instruction& instruction, @@ -977,7 +977,8 @@ bool HGraphBuilder::AnalyzeDexInstruction(const Instruction& instruction, uint32 } case Instruction::DIV_INT: { - BuildCheckedDiv(instruction, dex_offset, Primitive::kPrimInt, false); + BuildCheckedDiv(instruction.VRegA(), instruction.VRegB(), instruction.VRegC(), + dex_offset, Primitive::kPrimInt, false); break; } @@ -1046,6 +1047,12 @@ bool HGraphBuilder::AnalyzeDexInstruction(const Instruction& instruction, uint32 break; } + case Instruction::DIV_INT_2ADDR: { + BuildCheckedDiv(instruction.VRegA(), instruction.VRegA(), instruction.VRegB(), + dex_offset, Primitive::kPrimInt, false); + break; + } + case Instruction::DIV_FLOAT_2ADDR: { Binop_12x<HDiv>(instruction, Primitive::kPrimFloat); break; @@ -1088,7 +1095,8 @@ bool HGraphBuilder::AnalyzeDexInstruction(const Instruction& instruction, uint32 case Instruction::DIV_INT_LIT16: case Instruction::DIV_INT_LIT8: { - BuildCheckedDiv(instruction, dex_offset, Primitive::kPrimInt, true); + BuildCheckedDiv(instruction.VRegA(), instruction.VRegB(), instruction.VRegC(), + dex_offset, Primitive::kPrimInt, true); break; } |