diff options
| author | 2023-08-09 14:22:47 +0000 | |
|---|---|---|
| committer | 2023-08-10 08:19:37 +0000 | |
| commit | 303d061d79ffd06aec960a921012712f49df844e (patch) | |
| tree | 9d6144e0fbbc6a7cbded9704b4b3413ce5678056 | |
| parent | a1daac358c42c50c68558116fffbcf6f598622d8 (diff) | |
riscv64: Add `intrinsics_riscv64.cc`.
Test: m test-art-host-gtest
Bug: 283082089
Change-Id: I2b66387e7edec85af68d02dc7133a37cf33d46ff
| -rw-r--r-- | compiler/Android.bp | 1 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator_riscv64.cc | 2 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator_riscv64.h | 198 | ||||
| -rw-r--r-- | compiler/optimizing/intrinsics_riscv64.cc | 31 | ||||
| -rw-r--r-- | compiler/optimizing/intrinsics_riscv64.h | 18 |
5 files changed, 234 insertions, 16 deletions
diff --git a/compiler/Android.bp b/compiler/Android.bp index 848a592482..6472613cfe 100644 --- a/compiler/Android.bp +++ b/compiler/Android.bp @@ -210,6 +210,7 @@ art_cc_defaults { srcs: [ "jni/quick/riscv64/calling_convention_riscv64.cc", "optimizing/code_generator_riscv64.cc", + "optimizing/intrinsics_riscv64.cc", "utils/riscv64/assembler_riscv64.cc", "utils/riscv64/jni_macro_assembler_riscv64.cc", "utils/riscv64/managed_register_riscv64.cc", diff --git a/compiler/optimizing/code_generator_riscv64.cc b/compiler/optimizing/code_generator_riscv64.cc index b17aeab538..cdef15f785 100644 --- a/compiler/optimizing/code_generator_riscv64.cc +++ b/compiler/optimizing/code_generator_riscv64.cc @@ -3188,7 +3188,7 @@ struct IsUnimplemented { bool is_unimplemented = false; }; -#define TRUE_OVERRIDE(Name, ...) \ +#define TRUE_OVERRIDE(Name) \ template <> \ struct IsUnimplemented<Intrinsics::k##Name> { \ bool is_unimplemented = true; \ diff --git a/compiler/optimizing/code_generator_riscv64.h b/compiler/optimizing/code_generator_riscv64.h index f3b2a49c24..eea4338fe7 100644 --- a/compiler/optimizing/code_generator_riscv64.h +++ b/compiler/optimizing/code_generator_riscv64.h @@ -48,7 +48,203 @@ static constexpr FRegister kRuntimeParameterFpuRegisters[] = { static constexpr size_t kRuntimeParameterFpuRegistersLength = arraysize(kRuntimeParameterFpuRegisters); -#define UNIMPLEMENTED_INTRINSIC_LIST_RISCV64(V) ART_INTRINSICS_LIST(V) +#define UNIMPLEMENTED_INTRINSIC_LIST_RISCV64(V) \ + V(DoubleDoubleToRawLongBits) \ + V(DoubleIsInfinite) \ + V(DoubleLongBitsToDouble) \ + V(FloatFloatToRawIntBits) \ + V(FloatIsInfinite) \ + V(FloatIntBitsToFloat) \ + V(IntegerReverse) \ + V(IntegerReverseBytes) \ + V(IntegerBitCount) \ + V(IntegerDivideUnsigned) \ + V(IntegerHighestOneBit) \ + V(IntegerLowestOneBit) \ + V(IntegerNumberOfLeadingZeros) \ + V(IntegerNumberOfTrailingZeros) \ + V(LongReverse) \ + V(LongReverseBytes) \ + V(LongBitCount) \ + V(LongDivideUnsigned) \ + V(LongHighestOneBit) \ + V(LongLowestOneBit) \ + V(LongNumberOfLeadingZeros) \ + V(LongNumberOfTrailingZeros) \ + V(ShortReverseBytes) \ + V(MathFmaDouble) \ + V(MathFmaFloat) \ + V(MathCos) \ + V(MathSin) \ + V(MathAcos) \ + V(MathAsin) \ + V(MathAtan) \ + V(MathAtan2) \ + V(MathPow) \ + V(MathCbrt) \ + V(MathCosh) \ + V(MathExp) \ + V(MathExpm1) \ + V(MathHypot) \ + V(MathLog) \ + V(MathLog10) \ + V(MathNextAfter) \ + V(MathSinh) \ + V(MathTan) \ + V(MathTanh) \ + V(MathSqrt) \ + V(MathCeil) \ + V(MathFloor) \ + V(MathRint) \ + V(MathRoundDouble) \ + V(MathRoundFloat) \ + V(MathMultiplyHigh) \ + V(SystemArrayCopyByte) \ + V(SystemArrayCopyChar) \ + V(SystemArrayCopyInt) \ + V(SystemArrayCopy) \ + V(ThreadCurrentThread) \ + V(MemoryPeekByte) \ + V(MemoryPeekIntNative) \ + V(MemoryPeekLongNative) \ + V(MemoryPeekShortNative) \ + V(MemoryPokeByte) \ + V(MemoryPokeIntNative) \ + V(MemoryPokeLongNative) \ + V(MemoryPokeShortNative) \ + V(FP16Ceil) \ + V(FP16Compare) \ + V(FP16Floor) \ + V(FP16Rint) \ + V(FP16ToFloat) \ + V(FP16ToHalf) \ + V(FP16Greater) \ + V(FP16GreaterEquals) \ + V(FP16Less) \ + V(FP16LessEquals) \ + V(FP16Min) \ + V(FP16Max) \ + V(StringCompareTo) \ + V(StringEquals) \ + V(StringGetCharsNoCheck) \ + V(StringIndexOf) \ + V(StringIndexOfAfter) \ + V(StringStringIndexOf) \ + V(StringStringIndexOfAfter) \ + V(StringNewStringFromBytes) \ + V(StringNewStringFromChars) \ + V(StringNewStringFromString) \ + V(StringBufferAppend) \ + V(StringBufferLength) \ + V(StringBufferToString) \ + V(StringBuilderAppendObject) \ + V(StringBuilderAppendString) \ + V(StringBuilderAppendCharSequence) \ + V(StringBuilderAppendCharArray) \ + V(StringBuilderAppendBoolean) \ + V(StringBuilderAppendChar) \ + V(StringBuilderAppendInt) \ + V(StringBuilderAppendLong) \ + V(StringBuilderAppendFloat) \ + V(StringBuilderAppendDouble) \ + V(StringBuilderLength) \ + V(StringBuilderToString) \ + V(UnsafeCASInt) \ + V(UnsafeCASLong) \ + V(UnsafeCASObject) \ + V(UnsafeGet) \ + V(UnsafeGetVolatile) \ + V(UnsafeGetObject) \ + V(UnsafeGetObjectVolatile) \ + V(UnsafeGetLong) \ + V(UnsafeGetLongVolatile) \ + V(UnsafePut) \ + V(UnsafePutOrdered) \ + V(UnsafePutVolatile) \ + V(UnsafePutObject) \ + V(UnsafePutObjectOrdered) \ + V(UnsafePutObjectVolatile) \ + V(UnsafePutLong) \ + V(UnsafePutLongOrdered) \ + V(UnsafePutLongVolatile) \ + V(UnsafeGetAndAddInt) \ + V(UnsafeGetAndAddLong) \ + V(UnsafeGetAndSetInt) \ + V(UnsafeGetAndSetLong) \ + V(UnsafeGetAndSetObject) \ + V(JdkUnsafeCASInt) \ + V(JdkUnsafeCASLong) \ + V(JdkUnsafeCASObject) \ + V(JdkUnsafeCompareAndSetInt) \ + V(JdkUnsafeCompareAndSetLong) \ + V(JdkUnsafeCompareAndSetObject) \ + V(JdkUnsafeGet) \ + V(JdkUnsafeGetVolatile) \ + V(JdkUnsafeGetAcquire) \ + V(JdkUnsafeGetObject) \ + V(JdkUnsafeGetObjectVolatile) \ + V(JdkUnsafeGetObjectAcquire) \ + V(JdkUnsafeGetLong) \ + V(JdkUnsafeGetLongVolatile) \ + V(JdkUnsafeGetLongAcquire) \ + V(JdkUnsafePut) \ + V(JdkUnsafePutOrdered) \ + V(JdkUnsafePutRelease) \ + V(JdkUnsafePutVolatile) \ + V(JdkUnsafePutObject) \ + V(JdkUnsafePutObjectOrdered) \ + V(JdkUnsafePutObjectVolatile) \ + V(JdkUnsafePutObjectRelease) \ + V(JdkUnsafePutLong) \ + V(JdkUnsafePutLongOrdered) \ + V(JdkUnsafePutLongVolatile) \ + V(JdkUnsafePutLongRelease) \ + V(JdkUnsafeGetAndAddInt) \ + V(JdkUnsafeGetAndAddLong) \ + V(JdkUnsafeGetAndSetInt) \ + V(JdkUnsafeGetAndSetLong) \ + V(JdkUnsafeGetAndSetObject) \ + V(ReferenceGetReferent) \ + V(ReferenceRefersTo) \ + V(IntegerValueOf) \ + V(ThreadInterrupted) \ + V(ReachabilityFence) \ + V(CRC32Update) \ + V(CRC32UpdateBytes) \ + V(CRC32UpdateByteBuffer) \ + V(MethodHandleInvokeExact) \ + V(MethodHandleInvoke) \ + V(VarHandleCompareAndExchange) \ + V(VarHandleCompareAndExchangeAcquire) \ + V(VarHandleCompareAndExchangeRelease) \ + V(VarHandleCompareAndSet) \ + V(VarHandleGet) \ + V(VarHandleGetAcquire) \ + V(VarHandleGetAndAdd) \ + V(VarHandleGetAndAddAcquire) \ + V(VarHandleGetAndAddRelease) \ + V(VarHandleGetAndBitwiseAnd) \ + V(VarHandleGetAndBitwiseAndAcquire) \ + V(VarHandleGetAndBitwiseAndRelease) \ + V(VarHandleGetAndBitwiseOr) \ + V(VarHandleGetAndBitwiseOrAcquire) \ + V(VarHandleGetAndBitwiseOrRelease) \ + V(VarHandleGetAndBitwiseXor) \ + V(VarHandleGetAndBitwiseXorAcquire) \ + V(VarHandleGetAndBitwiseXorRelease) \ + V(VarHandleGetAndSet) \ + V(VarHandleGetAndSetAcquire) \ + V(VarHandleGetAndSetRelease) \ + V(VarHandleGetOpaque) \ + V(VarHandleGetVolatile) \ + V(VarHandleSet) \ + V(VarHandleSetOpaque) \ + V(VarHandleSetRelease) \ + V(VarHandleSetVolatile) \ + V(VarHandleWeakCompareAndSet) \ + V(VarHandleWeakCompareAndSetAcquire) \ + V(VarHandleWeakCompareAndSetPlain) \ + V(VarHandleWeakCompareAndSetRelease) // Method register on invoke. static const XRegister kArtMethodRegister = A0; diff --git a/compiler/optimizing/intrinsics_riscv64.cc b/compiler/optimizing/intrinsics_riscv64.cc new file mode 100644 index 0000000000..f4bcb4abb6 --- /dev/null +++ b/compiler/optimizing/intrinsics_riscv64.cc @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "intrinsics_riscv64.h" + +#include "code_generator_riscv64.h" + +namespace art HIDDEN { +namespace riscv64 { + +#define MARK_UNIMPLEMENTED(Name) UNIMPLEMENTED_INTRINSIC(RISCV64, Name) +UNIMPLEMENTED_INTRINSIC_LIST_RISCV64(MARK_UNIMPLEMENTED); +#undef MARK_UNIMPLEMENTED + +UNREACHABLE_INTRINSICS(RISCV64) + +} // namespace riscv64 +} // namespace art diff --git a/compiler/optimizing/intrinsics_riscv64.h b/compiler/optimizing/intrinsics_riscv64.h index 6c5ecafff3..3557741797 100644 --- a/compiler/optimizing/intrinsics_riscv64.h +++ b/compiler/optimizing/intrinsics_riscv64.h @@ -40,13 +40,8 @@ class IntrinsicLocationsBuilderRISCV64 final : public IntrinsicVisitor { // Define visitor methods. - // TODO(riscv64): Implement in `intrinsics_riscv64.cc`. -#define OPTIMIZING_INTRINSICS( \ - Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \ - void Visit##Name(HInvoke* invoke) override { \ - UNUSED(invoke); \ - LOG(FATAL) << "Unimplemented"; \ - } +#define OPTIMIZING_INTRINSICS(Name, ...) \ + void Visit##Name(HInvoke* invoke) override; ART_INTRINSICS_LIST(OPTIMIZING_INTRINSICS) #undef OPTIMIZING_INTRINSICS @@ -75,13 +70,8 @@ class IntrinsicCodeGeneratorRISCV64 final : public IntrinsicVisitor { // Define visitor methods. - // TODO(riscv64): Implement in `intrinsics_riscv64.cc`. -#define OPTIMIZING_INTRINSICS( \ - Name, IsStatic, NeedsEnvironmentOrCache, SideEffects, Exceptions, ...) \ - void Visit##Name(HInvoke* invoke) override { \ - UNUSED(invoke); \ - LOG(FATAL) << "Unimplemented"; \ - } +#define OPTIMIZING_INTRINSICS(Name, ...) \ + void Visit##Name(HInvoke* invoke); ART_INTRINSICS_LIST(OPTIMIZING_INTRINSICS) #undef OPTIMIZING_INTRINSICS |