From d82f788fa6b4f02069fb2e61bd101716b3221507 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Thu, 24 Aug 2023 13:32:56 +0000 Subject: riscv64: Enable Optimizing compiler for invokes. Enable InvokeVirtual, InvokeInterface, InvokeStaticOrDirect and a few other instructions. Note that this also enables some implemented intrinsics that were previously excluded. Test: aosp_cf_riscv64_phone-userdebug boots. Test: run-gtests.sh # Ignore pre-existing timeout in `TestImageLayout`. Test: testrunner.py --target --64 --ndebug --optimizing --jit # Ignore pre-existing failures (51 for --optimizing, # down from 58; 65 for --jit, down from 69). Bug: 283082089 Change-Id: I02a18e4ccf244205e78d6376cdaa6e32cf8c55e5 --- compiler/optimizing/optimizing_compiler.cc | 38 ++++++++++++++++-------------- 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'compiler/optimizing/optimizing_compiler.cc') diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 211c6417c2..911a429d0b 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -775,28 +775,30 @@ static bool CanAssembleGraphForRiscv64(HGraph* graph) { case HInstruction::kAbs: case HInstruction::kBooleanNot: case HInstruction::kMul: + case HInstruction::kNeg: + case HInstruction::kNot: + case HInstruction::kInvokeVirtual: + case HInstruction::kInvokeInterface: + case HInstruction::kCurrentMethod: break; - case HInstruction::kInvokeStaticOrDirect: { - Intrinsics intrinsic = it.Current()->AsInvokeStaticOrDirect()->GetIntrinsic(); - if (intrinsic != Intrinsics::kDoubleDoubleToRawLongBits && - intrinsic != Intrinsics::kDoubleIsInfinite && - intrinsic != Intrinsics::kDoubleLongBitsToDouble && - intrinsic != Intrinsics::kFloatFloatToRawIntBits && - intrinsic != Intrinsics::kFloatIsInfinite && - intrinsic != Intrinsics::kFloatIntBitsToFloat && - intrinsic != Intrinsics::kMemoryPeekByte && - intrinsic != Intrinsics::kMemoryPeekIntNative && - intrinsic != Intrinsics::kMemoryPeekLongNative && - intrinsic != Intrinsics::kMemoryPeekShortNative && - intrinsic != Intrinsics::kMemoryPokeByte && - intrinsic != Intrinsics::kMemoryPokeIntNative && - intrinsic != Intrinsics::kMemoryPokeLongNative && - intrinsic != Intrinsics::kMemoryPokeShortNative) { + case HInstruction::kInvokeStaticOrDirect: + if (it.Current()->AsInvokeStaticOrDirect()->GetCodePtrLocation() == + CodePtrLocation::kCallCriticalNative && + it.Current()->AsInvokeStaticOrDirect()->GetNumberOfArguments() >= 8u) { + // TODO(riscv64): If there are more than 8 FP args, some may be passed in GPRs + // and this requires a `CriticalNativeAbiFixupRiscv64` pass similar to the one + // we have for ARM. This is not yet implemented. For simplicity, we reject all + // direct @CriticalNative calls with more than 8 args. return false; } break; - } - case HInstruction::kCurrentMethod: + case HInstruction::kMin: + case HInstruction::kMax: + if (DataType::IsFloatingPointType(it.Current()->GetType())) { + // FIXME(riscv64): If one of the operands is NaN and the other is not, riscv64 + // FMIN/FMAX yield the non-NaN operand but we want the result to be the NaN operand. + return false; + } break; default: // Unimplemented instruction. -- cgit v1.2.3-59-g8ed1b