Implement integer negation.
Change-Id: I435fb7791ed7f57db7a27fba1fc4b66abf14cb6f
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index dd8fc85..c2e03cb 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -1659,7 +1659,15 @@
void MethodCompiler::EmitInsn_Neg(uint32_t dex_pc,
Instruction const* insn,
JType op_jty) {
- // UNIMPLEMENTED(WARNING);
+
+ Instruction::DecodedInstruction dec_insn(insn);
+
+ DCHECK(op_jty == kInt || op_jty == kLong) << op_jty;
+
+ llvm::Value* src_value = EmitLoadDalvikReg(dec_insn.vB_, op_jty, kAccurate);
+ llvm::Value* result_value = irb_.CreateNeg(src_value);
+ EmitStoreDalvikReg(dec_insn.vA_, op_jty, kAccurate, result_value);
+
irb_.CreateBr(GetNextBasicBlock(dex_pc));
}