[llvm] [AArch64][SME] Allow memory operations lowering to custom SME functions. (PR #79263)
Dinar Temirbulatov via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 25 02:43:17 PDT 2024
================
@@ -76,15 +82,85 @@ SDValue AArch64SelectionDAGInfo::EmitMOPS(AArch64ISD::NodeType SDOpcode,
}
}
+SDValue AArch64SelectionDAGInfo::EmitSpecializedLibcall(
+ SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, SDValue Src,
+ SDValue Size, RTLIB::Libcall LC) const {
+ const AArch64Subtarget &STI =
+ DAG.getMachineFunction().getSubtarget<AArch64Subtarget>();
+ const AArch64TargetLowering *TLI = STI.getTargetLowering();
+ TargetLowering::ArgListTy Args;
+ TargetLowering::ArgListEntry DstEntry;
+ SDValue Symbol;
+ DstEntry.Ty = PointerType::getUnqual(*DAG.getContext());
+ DstEntry.Node = Dst;
+ Args.push_back(DstEntry);
+ EVT Ty = TLI->getPointerTy(DAG.getDataLayout());
+ PointerType *RetTy;
+
+ if (!LowerToSMERoutines)
+ return SDValue();
+
+ switch (LC) {
+ case RTLIB::MEMCPY: {
+ TargetLowering::ArgListEntry Entry;
+ Entry.Ty = PointerType::getUnqual(*DAG.getContext());
+ Symbol = DAG.getExternalSymbol("__arm_sc_memcpy", Ty);
+ Entry.Node = Src;
+ Args.push_back(Entry);
+ RetTy = PointerType::getUnqual(*DAG.getContext());
+ break;
+ }
+ case RTLIB::MEMMOVE: {
+ TargetLowering::ArgListEntry Entry;
+ Entry.Ty = PointerType::getUnqual(*DAG.getContext());
+ Symbol = DAG.getExternalSymbol("__arm_sc_memmove", Ty);
+ Entry.Node = Src;
+ Args.push_back(Entry);
+ RetTy = PointerType::getUnqual(*DAG.getContext());
+ break;
+ }
+ case RTLIB::MEMSET: {
+ TargetLowering::ArgListEntry Entry;
+ Entry.Ty = Type::getInt32Ty(*DAG.getContext());
+ Symbol = DAG.getExternalSymbol("__arm_sc_memset", Ty);
+ Src = DAG.getZExtOrTrunc(Src, DL, MVT::i32);
+ Entry.Node = Src;
+ Args.push_back(Entry);
+ RetTy = PointerType::getUnqual(*DAG.getContext());
+ break;
+ }
+ default:
+ return SDValue();
+ }
+ TargetLowering::ArgListEntry SizeEntry;
+ SizeEntry.Node = Size;
+ SizeEntry.Ty = PointerType::getUnqual(*DAG.getContext());
----------------
dtemirbulatov wrote:
Done.
https://github.com/llvm/llvm-project/pull/79263
More information about the llvm-commits
mailing list