diff options
Diffstat (limited to 'compiler/optimizing')
| -rw-r--r-- | compiler/optimizing/code_generator_arm64.cc | 39 | ||||
| -rw-r--r-- | compiler/optimizing/codegen_test.cc | 8 |
2 files changed, 38 insertions, 9 deletions
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, |