summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/builder.cc
diff options
context:
space:
mode:
authorCalin Juravle <calin@google.com>2014-11-06 17:28:21 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-11-06 17:28:22 +0000
commit9b6c62b82e3d40d70d541920d5f7f81ad517bc01 (patch)
treec75397fca9adddde7f6d3ab0fbc30bdaa7e443c4 /compiler/optimizing/builder.cc
parente257d2c27f5565fb55de9122e093371ea2671271 (diff)
parent865fc88fdfd006ce0362c2c0d55c66a7bffdab61 (diff)
downloadandroid_art-9b6c62b82e3d40d70d541920d5f7f81ad517bc01.tar.gz
android_art-9b6c62b82e3d40d70d541920d5f7f81ad517bc01.tar.bz2
android_art-9b6c62b82e3d40d70d541920d5f7f81ad517bc01.zip
Merge "[optimizing compiler] Add DIV_INT_2ADDR"
Diffstat (limited to 'compiler/optimizing/builder.cc')
-rw-r--r--compiler/optimizing/builder.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc
index 6eff23acba..1820a6a57c 100644
--- a/compiler/optimizing/builder.cc
+++ b/compiler/optimizing/builder.cc
@@ -545,16 +545,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);
@@ -563,7 +563,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,
@@ -985,7 +985,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;
}
@@ -1054,6 +1055,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;
@@ -1096,7 +1103,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;
}