-
Notifications
You must be signed in to change notification settings - Fork 14.3k
XCore: Declare libcalls used for align 4 memcpy #144976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
arsenm
merged 1 commit into
main
from
users/arsenm/xcore/add-runtime-libcall-definitions-special-memcpy
Jun 27, 2025
Merged
XCore: Declare libcalls used for align 4 memcpy #144976
arsenm
merged 1 commit into
main
from
users/arsenm/xcore/add-runtime-libcall-definitions-special-memcpy
Jun 27, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Jun 20, 2025
This was referenced Jun 20, 2025
@llvm/pr-subscribers-llvm-ir Author: Matt Arsenault (arsenm) ChangesThis usage was hidden in XCoreSelectionDAGInfo and bypassed Full diff: https://github.com/llvm/llvm-project/pull/144976.diff 3 Files Affected:
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 2efe823a760db..57ad6f09e8b57 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -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
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index 873ee6b509e2d..0f92371f05529 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -627,4 +627,7 @@ 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);
}
diff --git a/llvm/lib/Target/XCore/XCoreSelectionDAGInfo.cpp b/llvm/lib/Target/XCore/XCoreSelectionDAGInfo.cpp
index bc34ab4319690..1bd92a2b49475 100644
--- a/llvm/lib/Target/XCore/XCoreSelectionDAGInfo.cpp
+++ b/llvm/lib/Target/XCore/XCoreSelectionDAGInfo.cpp
@@ -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);
|
nigelp-xmos
approved these changes
Jun 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
99598fb
to
e6005bd
Compare
a845b0e
to
2a403de
Compare
e6005bd
to
5c9eff4
Compare
2a403de
to
4632467
Compare
5c9eff4
to
6854ef6
Compare
4632467
to
d3f44e8
Compare
d3f44e8
to
944736b
Compare
Base automatically changed from
users/arsenm/hexagon/add-libcall-definitions-special-memcpy
to
main
June 27, 2025 08:46
This usage was hidden in XCoreSelectionDAGInfo and bypassed the usual libcall system, so define these for later use.
6854ef6
to
2fdc886
Compare
This was referenced Jun 27, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This usage was hidden in XCoreSelectionDAGInfo and bypassed
the usual libcall system, so define these for later use.