Add support for adding two integers in optimizing compiler.
Change-Id: I5524e193cd07f2692a57c6b4f8069904471b2928
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc
index db77fee..64ecdb5 100644
--- a/compiler/optimizing/builder.cc
+++ b/compiler/optimizing/builder.cc
@@ -211,6 +211,38 @@
break;
}
+ case Instruction::ADD_INT: {
+ HInstruction* first = LoadLocal(instruction.VRegB());
+ HInstruction* second = LoadLocal(instruction.VRegC());
+ current_block_->AddInstruction(new (arena_) HAdd(Primitive::kPrimInt, first, second));
+ UpdateLocal(instruction.VRegA(), current_block_->GetLastInstruction());
+ break;
+ }
+
+ case Instruction::ADD_INT_2ADDR: {
+ HInstruction* first = LoadLocal(instruction.VRegA());
+ HInstruction* second = LoadLocal(instruction.VRegB());
+ current_block_->AddInstruction(new (arena_) HAdd(Primitive::kPrimInt, first, second));
+ UpdateLocal(instruction.VRegA(), current_block_->GetLastInstruction());
+ break;
+ }
+
+ case Instruction::ADD_INT_LIT16: {
+ HInstruction* first = LoadLocal(instruction.VRegB());
+ HInstruction* second = GetConstant(instruction.VRegC_22s());
+ current_block_->AddInstruction(new (arena_) HAdd(Primitive::kPrimInt, first, second));
+ UpdateLocal(instruction.VRegA(), current_block_->GetLastInstruction());
+ break;
+ }
+
+ case Instruction::ADD_INT_LIT8: {
+ HInstruction* first = LoadLocal(instruction.VRegB());
+ HInstruction* second = GetConstant(instruction.VRegC_22b());
+ current_block_->AddInstruction(new (arena_) HAdd(Primitive::kPrimInt, first, second));
+ UpdateLocal(instruction.VRegA(), current_block_->GetLastInstruction());
+ break;
+ }
+
case Instruction::NOP:
break;