diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td index 71efecdf082af..2efe823a760db 100644 --- a/llvm/include/llvm/IR/RuntimeLibcalls.td +++ b/llvm/include/llvm/IR/RuntimeLibcalls.td @@ -368,6 +368,9 @@ def AEABI_MEMCLR : RuntimeLibcall; def AEABI_MEMCLR4 : RuntimeLibcall; def AEABI_MEMCLR8 : RuntimeLibcall; +// Hexagon calls +def HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES : RuntimeLibcall; + //-------------------------------------------------------------------- // Define implementation default libcalls //-------------------------------------------------------------------- @@ -1247,6 +1250,9 @@ def __hexagon_fast2_sqrtf : RuntimeLibcallImpl; // This is the only fast library function for sqrtd. def __hexagon_fast2_sqrtdf2 : RuntimeLibcallImpl; +def __hexagon_memcpy_likely_aligned_min32bytes_mult8bytes + : RuntimeLibcallImpl; + //===----------------------------------------------------------------------===// // Mips16 Runtime Libcalls //===----------------------------------------------------------------------===// diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp index 5fccb23e6c5ff..873ee6b509e2d 100644 --- a/llvm/lib/IR/RuntimeLibcalls.cpp +++ b/llvm/lib/IR/RuntimeLibcalls.cpp @@ -616,6 +616,10 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT, setLibcallImpl(RTLIB::SQRT_F32, RTLIB::__hexagon_fast2_sqrtf); else setLibcallImpl(RTLIB::SQRT_F32, RTLIB::__hexagon_sqrtf); + + setLibcallImpl( + RTLIB::HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES, + RTLIB::__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes); } if (TT.getArch() == Triple::ArchType::msp430) diff --git a/llvm/lib/Target/Hexagon/HexagonSelectionDAGInfo.cpp b/llvm/lib/Target/Hexagon/HexagonSelectionDAGInfo.cpp index 1b724e8fcae91..610a81fe45c2f 100644 --- a/llvm/lib/Target/Hexagon/HexagonSelectionDAGInfo.cpp +++ b/llvm/lib/Target/Hexagon/HexagonSelectionDAGInfo.cpp @@ -41,18 +41,20 @@ SDValue HexagonSelectionDAGInfo::EmitTargetCodeForMemcpy( Entry.Node = Size; Args.push_back(Entry); - const char *SpecialMemcpyName = - "__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes"; + const char *SpecialMemcpyName = TLI.getLibcallName( + RTLIB::HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES); const MachineFunction &MF = DAG.getMachineFunction(); bool LongCalls = MF.getSubtarget().useLongCalls(); unsigned Flags = LongCalls ? HexagonII::HMOTF_ConstExtended : 0; + CallingConv::ID CC = TLI.getLibcallCallingConv( + RTLIB::HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES); + TargetLowering::CallLoweringInfo CLI(DAG); CLI.setDebugLoc(dl) .setChain(Chain) .setLibCallee( - TLI.getLibcallCallingConv(RTLIB::MEMCPY), - Type::getVoidTy(*DAG.getContext()), + CC, Type::getVoidTy(*DAG.getContext()), DAG.getTargetExternalSymbol( SpecialMemcpyName, TLI.getPointerTy(DAG.getDataLayout()), Flags), std::move(Args))