Skip to content

Commit d14d840

Browse files
committed
Hexagon: Add runtime libcall entries for volatile memcpy call
This pass currently doesn't have TargetLoweringInfo, but technically it should verify the call is available from a future RuntimeLibcallsInfo analysis.
1 parent c33ccfa commit d14d840

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ def AEABI_MEMCLR8 : RuntimeLibcall;
446446

447447
// Hexagon calls
448448
def HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES : RuntimeLibcall;
449+
def HEXAGON_VOLATILE_MEMCPY : RuntimeLibcall;
449450

450451
// XCore calls
451452
def MEMCPY_ALIGN_4 : RuntimeLibcall;
@@ -1875,6 +1876,8 @@ def __hexagon_fast2_sqrtdf2 : RuntimeLibcallImpl<FAST_SQRT_F64>;
18751876

18761877
def __hexagon_memcpy_likely_aligned_min32bytes_mult8bytes
18771878
: RuntimeLibcallImpl<HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES>;
1879+
1880+
def hexagon_memcpy_forward_vp4cp4n2 : RuntimeLibcallImpl<HEXAGON_VOLATILE_MEMCPY>;
18781881
}
18791882

18801883
def isHexagon : RuntimeLibcallPredicate<"TT.getArch() == Triple::hexagon">;

llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "llvm/IR/Module.h"
4343
#include "llvm/IR/PassManager.h"
4444
#include "llvm/IR/PatternMatch.h"
45+
#include "llvm/IR/RuntimeLibcalls.h"
4546
#include "llvm/IR/Type.h"
4647
#include "llvm/IR/User.h"
4748
#include "llvm/IR/Value.h"
@@ -2246,6 +2247,11 @@ bool HexagonLoopIdiomRecognize::processCopyingStore(Loop *CurLoop,
22462247
Type *PtrTy = PointerType::get(Ctx, 0);
22472248
Type *VoidTy = Type::getVoidTy(Ctx);
22482249
Module *M = Func->getParent();
2250+
2251+
// FIXME: This should check if the call is supported
2252+
StringRef HexagonVolatileMemcpyName =
2253+
RuntimeLibcallsInfo::getLibcallImplName(
2254+
RTLIB::impl_hexagon_memcpy_forward_vp4cp4n2);
22492255
FunctionCallee Fn = M->getOrInsertFunction(
22502256
HexagonVolatileMemcpyName, VoidTy, PtrTy, PtrTy, Int32Ty);
22512257

0 commit comments

Comments
 (0)