diff options
| -rw-r--r-- | compiler/optimizing/intrinsics_mips64.cc | 218 | ||||
| -rw-r--r-- | runtime/arch/mips64/entrypoints_init_mips64.cc | 19 |
2 files changed, 219 insertions, 18 deletions
diff --git a/compiler/optimizing/intrinsics_mips64.cc b/compiler/optimizing/intrinsics_mips64.cc index 21c5074a1c..08b6fef1a7 100644 --- a/compiler/optimizing/intrinsics_mips64.cc +++ b/compiler/optimizing/intrinsics_mips64.cc @@ -2072,28 +2072,210 @@ void IntrinsicCodeGeneratorMIPS64::VisitLongLowestOneBit(HInvoke* invoke) { GenLowestOneBit(invoke->GetLocations(), Primitive::kPrimLong, GetAssembler()); } +static void CreateFPToFPCallLocations(ArenaAllocator* arena, HInvoke* invoke) { + LocationSummary* locations = new (arena) LocationSummary(invoke, + LocationSummary::kCallOnMainOnly, + kIntrinsified); + InvokeRuntimeCallingConvention calling_convention; + + locations->SetInAt(0, Location::FpuRegisterLocation(calling_convention.GetFpuRegisterAt(0))); + locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimDouble)); +} + +static void CreateFPFPToFPCallLocations(ArenaAllocator* arena, HInvoke* invoke) { + LocationSummary* locations = new (arena) LocationSummary(invoke, + LocationSummary::kCallOnMainOnly, + kIntrinsified); + InvokeRuntimeCallingConvention calling_convention; + + locations->SetInAt(0, Location::FpuRegisterLocation(calling_convention.GetFpuRegisterAt(0))); + locations->SetInAt(1, Location::FpuRegisterLocation(calling_convention.GetFpuRegisterAt(1))); + locations->SetOut(calling_convention.GetReturnLocation(Primitive::kPrimDouble)); +} + +static void GenFPToFPCall(HInvoke* invoke, + CodeGeneratorMIPS64* codegen, + QuickEntrypointEnum entry) { + LocationSummary* locations = invoke->GetLocations(); + FpuRegister in = locations->InAt(0).AsFpuRegister<FpuRegister>(); + DCHECK_EQ(in, F12); + FpuRegister out = locations->Out().AsFpuRegister<FpuRegister>(); + DCHECK_EQ(out, F0); + + codegen->InvokeRuntime(entry, invoke, invoke->GetDexPc()); +} + +static void GenFPFPToFPCall(HInvoke* invoke, + CodeGeneratorMIPS64* codegen, + QuickEntrypointEnum entry) { + LocationSummary* locations = invoke->GetLocations(); + FpuRegister in0 = locations->InAt(0).AsFpuRegister<FpuRegister>(); + DCHECK_EQ(in0, F12); + FpuRegister in1 = locations->InAt(1).AsFpuRegister<FpuRegister>(); + DCHECK_EQ(in1, F13); + FpuRegister out = locations->Out().AsFpuRegister<FpuRegister>(); + DCHECK_EQ(out, F0); + + codegen->InvokeRuntime(entry, invoke, invoke->GetDexPc()); +} + +// static double java.lang.Math.cos(double a) +void IntrinsicLocationsBuilderMIPS64::VisitMathCos(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathCos(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickCos); +} + +// static double java.lang.Math.sin(double a) +void IntrinsicLocationsBuilderMIPS64::VisitMathSin(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathSin(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickSin); +} + +// static double java.lang.Math.acos(double a) +void IntrinsicLocationsBuilderMIPS64::VisitMathAcos(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathAcos(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickAcos); +} + +// static double java.lang.Math.asin(double a) +void IntrinsicLocationsBuilderMIPS64::VisitMathAsin(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathAsin(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickAsin); +} + +// static double java.lang.Math.atan(double a) +void IntrinsicLocationsBuilderMIPS64::VisitMathAtan(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathAtan(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickAtan); +} + +// static double java.lang.Math.atan2(double y, double x) +void IntrinsicLocationsBuilderMIPS64::VisitMathAtan2(HInvoke* invoke) { + CreateFPFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathAtan2(HInvoke* invoke) { + GenFPFPToFPCall(invoke, codegen_, kQuickAtan2); +} + +// static double java.lang.Math.cbrt(double a) +void IntrinsicLocationsBuilderMIPS64::VisitMathCbrt(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathCbrt(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickCbrt); +} + +// static double java.lang.Math.cosh(double x) +void IntrinsicLocationsBuilderMIPS64::VisitMathCosh(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathCosh(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickCosh); +} + +// static double java.lang.Math.exp(double a) +void IntrinsicLocationsBuilderMIPS64::VisitMathExp(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathExp(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickExp); +} + +// static double java.lang.Math.expm1(double x) +void IntrinsicLocationsBuilderMIPS64::VisitMathExpm1(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathExpm1(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickExpm1); +} + +// static double java.lang.Math.hypot(double x, double y) +void IntrinsicLocationsBuilderMIPS64::VisitMathHypot(HInvoke* invoke) { + CreateFPFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathHypot(HInvoke* invoke) { + GenFPFPToFPCall(invoke, codegen_, kQuickHypot); +} + +// static double java.lang.Math.log(double a) +void IntrinsicLocationsBuilderMIPS64::VisitMathLog(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathLog(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickLog); +} + +// static double java.lang.Math.log10(double x) +void IntrinsicLocationsBuilderMIPS64::VisitMathLog10(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathLog10(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickLog10); +} + +// static double java.lang.Math.nextAfter(double start, double direction) +void IntrinsicLocationsBuilderMIPS64::VisitMathNextAfter(HInvoke* invoke) { + CreateFPFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathNextAfter(HInvoke* invoke) { + GenFPFPToFPCall(invoke, codegen_, kQuickNextAfter); +} + +// static double java.lang.Math.sinh(double x) +void IntrinsicLocationsBuilderMIPS64::VisitMathSinh(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathSinh(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickSinh); +} + +// static double java.lang.Math.tan(double a) +void IntrinsicLocationsBuilderMIPS64::VisitMathTan(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathTan(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickTan); +} + +// static double java.lang.Math.tanh(double x) +void IntrinsicLocationsBuilderMIPS64::VisitMathTanh(HInvoke* invoke) { + CreateFPToFPCallLocations(arena_, invoke); +} + +void IntrinsicCodeGeneratorMIPS64::VisitMathTanh(HInvoke* invoke) { + GenFPToFPCall(invoke, codegen_, kQuickTanh); +} + UNIMPLEMENTED_INTRINSIC(MIPS64, ReferenceGetReferent) UNIMPLEMENTED_INTRINSIC(MIPS64, SystemArrayCopyChar) UNIMPLEMENTED_INTRINSIC(MIPS64, SystemArrayCopy) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathCos) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathSin) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathAcos) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathAsin) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathAtan) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathAtan2) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathCbrt) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathCosh) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathExp) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathExpm1) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathHypot) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathLog) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathLog10) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathNextAfter) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathSinh) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathTan) -UNIMPLEMENTED_INTRINSIC(MIPS64, MathTanh) - UNIMPLEMENTED_INTRINSIC(MIPS64, StringStringIndexOf); UNIMPLEMENTED_INTRINSIC(MIPS64, StringStringIndexOfAfter); UNIMPLEMENTED_INTRINSIC(MIPS64, StringBufferAppend); diff --git a/runtime/arch/mips64/entrypoints_init_mips64.cc b/runtime/arch/mips64/entrypoints_init_mips64.cc index bc17d47366..135cdc125c 100644 --- a/runtime/arch/mips64/entrypoints_init_mips64.cc +++ b/runtime/arch/mips64/entrypoints_init_mips64.cc @@ -91,6 +91,25 @@ void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { qpoints->pShrLong = nullptr; qpoints->pUshrLong = nullptr; + // More math. + qpoints->pCos = cos; + qpoints->pSin = sin; + qpoints->pAcos = acos; + qpoints->pAsin = asin; + qpoints->pAtan = atan; + qpoints->pAtan2 = atan2; + qpoints->pCbrt = cbrt; + qpoints->pCosh = cosh; + qpoints->pExp = exp; + qpoints->pExpm1 = expm1; + qpoints->pHypot = hypot; + qpoints->pLog = log; + qpoints->pLog10 = log10; + qpoints->pNextAfter = nextafter; + qpoints->pSinh = sinh; + qpoints->pTan = tan; + qpoints->pTanh = tanh; + // Intrinsics qpoints->pIndexOf = art_quick_indexof; qpoints->pStringCompareTo = art_quick_string_compareto; |