diff options
author | Roland Levillain <rpl@google.com> | 2014-10-20 16:36:47 +0100 |
---|---|---|
committer | Roland Levillain <rpl@google.com> | 2014-10-21 13:48:32 +0100 |
commit | 88cb1755e1d6acaed0f66ce65d7a2a4465053342 (patch) | |
tree | 6ffdd07aa75a38eae9376bd95d0991a789cd624c /compiler/optimizing/builder.cc | |
parent | 1e642b5e5b2958ffc1653f5f42f2d091bbd8549e (diff) | |
download | art-88cb1755e1d6acaed0f66ce65d7a2a4465053342.tar.gz art-88cb1755e1d6acaed0f66ce65d7a2a4465053342.tar.bz2 art-88cb1755e1d6acaed0f66ce65d7a2a4465053342.zip |
Implement int negate instruction in the optimizing compiler.
- Add support for the neg-int (integer two's complement
negate) instruction in the optimizing compiler.
- Add a HNeg node type for control-flow graphs and an
intermediate HUnaryOperation base class.
- Generate ARM, x86 and x86-64 code for integer HNeg nodes.
Change-Id: I72fd3e1e5311a75c38a8cb665a9211a20325a42e
Diffstat (limited to 'compiler/optimizing/builder.cc')
-rw-r--r-- | compiler/optimizing/builder.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index 2648d4d67..2f1a092ea 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -267,6 +267,13 @@ HBasicBlock* HGraphBuilder::FindBlockStartingAt(int32_t index) const { } template<typename T> +void HGraphBuilder::Unop_12x(const Instruction& instruction, Primitive::Type type) { + HInstruction* first = LoadLocal(instruction.VRegB(), type); + current_block_->AddInstruction(new (arena_) T(type, first)); + UpdateLocal(instruction.VRegA(), current_block_->GetLastInstruction()); +} + +template<typename T> void HGraphBuilder::Binop_23x(const Instruction& instruction, Primitive::Type type) { HInstruction* first = LoadLocal(instruction.VRegB(), type); HInstruction* second = LoadLocal(instruction.VRegC(), type); @@ -678,6 +685,11 @@ bool HGraphBuilder::AnalyzeDexInstruction(const Instruction& instruction, uint32 break; } + case Instruction::NEG_INT: { + Unop_12x<HNeg>(instruction, Primitive::kPrimInt); + break; + } + case Instruction::ADD_INT: { Binop_23x<HAdd>(instruction, Primitive::kPrimInt); break; |