From 42d641bfd9ef3c03c68177b2a429b20056670d86 Mon Sep 17 00:00:00 2001 From: Alexandre Rames Date: Mon, 27 Oct 2014 14:00:51 +0000 Subject: Opt compiler: Add ARM64 support for the Mul IR. Also disable compilation and use of the boot image with the optimizing compiler: this won't work with the way we're bringing up arm64 and we need to find a better solution. Bug: 18147756 Change-Id: I6ec0de73681f9226d095bc3db92338dbd46499aa --- compiler/optimizing/code_generator_arm64.cc | 39 ++++++++++++++++++++++++++++- compiler/optimizing/codegen_test.cc | 8 ------ 2 files changed, 38 insertions(+), 9 deletions(-) (limited to 'compiler/optimizing') diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index fe999c2be0..5d504c697a 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -538,7 +538,6 @@ InstructionCodeGeneratorARM64::InstructionCodeGeneratorARM64(HGraph* graph, M(DoubleConstant) \ M(Div) \ M(FloatConstant) \ - M(Mul) \ M(LoadClass) \ M(Neg) \ M(NewArray) \ @@ -986,6 +985,44 @@ void InstructionCodeGeneratorARM64::VisitLongConstant(HLongConstant* constant) { // Will be generated at use site. } +void LocationsBuilderARM64::VisitMul(HMul* mul) { + LocationSummary* locations = + new (GetGraph()->GetArena()) LocationSummary(mul, LocationSummary::kNoCall); + switch (mul->GetResultType()) { + case Primitive::kPrimInt: + case Primitive::kPrimLong: + locations->SetInAt(0, Location::RequiresRegister()); + locations->SetInAt(1, Location::RequiresRegister()); + locations->SetOut(Location::RequiresRegister()); + break; + + case Primitive::kPrimFloat: + case Primitive::kPrimDouble: + LOG(FATAL) << "Unimplemented mul type " << mul->GetResultType(); + break; + + default: + LOG(FATAL) << "Unexpected mul type " << mul->GetResultType(); + } +} + +void InstructionCodeGeneratorARM64::VisitMul(HMul* mul) { + switch (mul->GetResultType()) { + case Primitive::kPrimInt: + case Primitive::kPrimLong: + __ Mul(OutputRegister(mul), InputRegisterAt(mul, 0), InputRegisterAt(mul, 1)); + break; + + case Primitive::kPrimFloat: + case Primitive::kPrimDouble: + LOG(FATAL) << "Unimplemented mul type " << mul->GetResultType(); + break; + + default: + LOG(FATAL) << "Unexpected mul type " << mul->GetResultType(); + } +} + void LocationsBuilderARM64::VisitNewInstance(HNewInstance* instruction) { LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction, LocationSummary::kCall); diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc index 03951e29dd..803a09b733 100644 --- a/compiler/optimizing/codegen_test.cc +++ b/compiler/optimizing/codegen_test.cc @@ -408,11 +408,7 @@ MUL_TEST(INT, MulInt); MUL_TEST(LONG, MulLong); #endif -#if defined(__aarch64__) -TEST(CodegenTest, DISABLED_ReturnMulIntLit8) { -#else TEST(CodegenTest, ReturnMulIntLit8) { -#endif const uint16_t data[] = ONE_REGISTER_CODE_ITEM( Instruction::CONST_4 | 4 << 12 | 0 << 8, Instruction::MUL_INT_LIT8, 3 << 8 | 0, @@ -421,11 +417,7 @@ TEST(CodegenTest, ReturnMulIntLit8) { TestCode(data, true, 12); } -#if defined(__aarch64__) -TEST(CodegenTest, DISABLED_ReturnMulIntLit16) { -#else TEST(CodegenTest, ReturnMulIntLit16) { -#endif const uint16_t data[] = ONE_REGISTER_CODE_ITEM( Instruction::CONST_4 | 4 << 12 | 0 << 8, Instruction::MUL_INT_LIT16, 3, -- cgit v1.2.3-59-g8ed1b