Skip to content

Commit a845b0e

Browse files
committed
Hexagon: Add libcall declarations for special memcpy
HexagonSelectionDAGInfo was bypassing the ordinary RuntimeLibcallInfo handling for this case, so define a libcall for it and use it.
1 parent bdbc320 commit a845b0e

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,9 @@ def AEABI_MEMCLR : RuntimeLibcall;
368368
def AEABI_MEMCLR4 : RuntimeLibcall;
369369
def AEABI_MEMCLR8 : RuntimeLibcall;
370370

371+
// Hexagon calls
372+
def HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES : RuntimeLibcall;
373+
371374
//--------------------------------------------------------------------
372375
// Define implementation default libcalls
373376
//--------------------------------------------------------------------
@@ -1247,6 +1250,9 @@ def __hexagon_fast2_sqrtf : RuntimeLibcallImpl<SQRT_F32>;
12471250
// This is the only fast library function for sqrtd.
12481251
def __hexagon_fast2_sqrtdf2 : RuntimeLibcallImpl<SQRT_F64>;
12491252

1253+
def __hexagon_memcpy_likely_aligned_min32bytes_mult8bytes
1254+
: RuntimeLibcallImpl<HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES>;
1255+
12501256
//===----------------------------------------------------------------------===//
12511257
// Mips16 Runtime Libcalls
12521258
//===----------------------------------------------------------------------===//

llvm/lib/IR/RuntimeLibcalls.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,10 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
616616
setLibcallImpl(RTLIB::SQRT_F32, RTLIB::__hexagon_fast2_sqrtf);
617617
else
618618
setLibcallImpl(RTLIB::SQRT_F32, RTLIB::__hexagon_sqrtf);
619+
620+
setLibcallImpl(
621+
RTLIB::HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES,
622+
RTLIB::__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes);
619623
}
620624

621625
if (TT.getArch() == Triple::ArchType::msp430)

llvm/lib/Target/Hexagon/HexagonSelectionDAGInfo.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,20 @@ SDValue HexagonSelectionDAGInfo::EmitTargetCodeForMemcpy(
4141
Entry.Node = Size;
4242
Args.push_back(Entry);
4343

44-
const char *SpecialMemcpyName =
45-
"__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes";
44+
const char *SpecialMemcpyName = TLI.getLibcallName(
45+
RTLIB::HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES);
4646
const MachineFunction &MF = DAG.getMachineFunction();
4747
bool LongCalls = MF.getSubtarget<HexagonSubtarget>().useLongCalls();
4848
unsigned Flags = LongCalls ? HexagonII::HMOTF_ConstExtended : 0;
4949

50+
CallingConv::ID CC = TLI.getLibcallCallingConv(
51+
RTLIB::HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES);
52+
5053
TargetLowering::CallLoweringInfo CLI(DAG);
5154
CLI.setDebugLoc(dl)
5255
.setChain(Chain)
5356
.setLibCallee(
54-
TLI.getLibcallCallingConv(RTLIB::MEMCPY),
55-
Type::getVoidTy(*DAG.getContext()),
57+
CC, Type::getVoidTy(*DAG.getContext()),
5658
DAG.getTargetExternalSymbol(
5759
SpecialMemcpyName, TLI.getPointerTy(DAG.getDataLayout()), Flags),
5860
std::move(Args))

0 commit comments

Comments
 (0)