XCore: Declare libcalls used for align 4 memcpy (#144976)

This usage was hidden in XCoreSelectionDAGInfo and bypassed
the usual libcall system, so define these for later use.
This commit is contained in:
Matt Arsenault
2025-06-27 17:50:01 +09:00
committed by GitHub
parent f38773e980
commit 779f7243c8
3 changed files with 20 additions and 5 deletions

View File

@@ -371,6 +371,9 @@ def AEABI_MEMCLR8 : RuntimeLibcall;
// Hexagon calls
def HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES : RuntimeLibcall;
// XCore calls
def MEMCPY_ALIGN_4 : RuntimeLibcall;
//--------------------------------------------------------------------
// Define implementation default libcalls
//--------------------------------------------------------------------
@@ -1544,6 +1547,12 @@ def _allrem : RuntimeLibcallImpl<SREM_I64>; // CallingConv::X86_StdCall
def _aullrem : RuntimeLibcallImpl<UREM_I64>; // CallingConv::X86_StdCall
def _allmul : RuntimeLibcallImpl<MUL_I64>; // CallingConv::X86_StdCall
//===----------------------------------------------------------------------===//
// XCore Runtime Libcalls
//===----------------------------------------------------------------------===//
def __memcpy_4 : RuntimeLibcallImpl<MEMCPY_ALIGN_4>;
//===----------------------------------------------------------------------===//
// ZOS Runtime Libcalls
//===----------------------------------------------------------------------===//

View File

@@ -595,6 +595,9 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
if (TT.isSystemZ() && TT.isOSzOS())
setZOSLibCallNameOverrides();
if (TT.getArch() == Triple::ArchType::xcore)
setLibcallImpl(RTLIB::MEMCPY_ALIGN_4, RTLIB::__memcpy_4);
}
bool RuntimeLibcallsInfo::darwinHasExp10(const Triple &TT) {

View File

@@ -39,14 +39,17 @@ SDValue XCoreSelectionDAGInfo::EmitTargetCodeForMemcpy(
Entry.Node = Src; Args.push_back(Entry);
Entry.Node = Size; Args.push_back(Entry);
const char *MemcpyAlign4Name = TLI.getLibcallName(RTLIB::MEMCPY_ALIGN_4);
CallingConv::ID CC = TLI.getLibcallCallingConv(RTLIB::MEMCPY_ALIGN_4);
TargetLowering::CallLoweringInfo CLI(DAG);
CLI.setDebugLoc(dl)
.setChain(Chain)
.setLibCallee(TLI.getLibcallCallingConv(RTLIB::MEMCPY),
Type::getVoidTy(*DAG.getContext()),
DAG.getExternalSymbol(
"__memcpy_4", TLI.getPointerTy(DAG.getDataLayout())),
std::move(Args))
.setLibCallee(
CC, Type::getVoidTy(*DAG.getContext()),
DAG.getExternalSymbol(MemcpyAlign4Name,
TLI.getPointerTy(DAG.getDataLayout())),
std::move(Args))
.setDiscardResult();
std::pair<SDValue,SDValue> CallResult = TLI.LowerCallTo(CLI);