-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Hexagon: Add libcall declarations for special memcpy #144975
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
base: users/arsenm/arm/add-libcall-definitions-eabi-memory-functions
Are you sure you want to change the base?
Hexagon: Add libcall declarations for special memcpy #144975
Conversation
HexagonSelectionDAGInfo was bypassing the ordinary RuntimeLibcallInfo handling for this case, so define a libcall for it and use it.
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-backend-hexagon @llvm/pr-subscribers-llvm-ir Author: Matt Arsenault (arsenm) ChangesHexagonSelectionDAGInfo was bypassing the ordinary RuntimeLibcallInfo Full diff: https://github.com/llvm/llvm-project/pull/144975.diff 3 Files Affected:
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<SQRT_F32>;
// This is the only fast library function for sqrtd.
def __hexagon_fast2_sqrtdf2 : RuntimeLibcallImpl<SQRT_F64>;
+def __hexagon_memcpy_likely_aligned_min32bytes_mult8bytes
+ : RuntimeLibcallImpl<HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES>;
+
//===----------------------------------------------------------------------===//
// 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<HexagonSubtarget>().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))
|
HexagonSelectionDAGInfo was bypassing the ordinary RuntimeLibcallInfo
handling for this case, so define a libcall for it and use it.