1- From 61af6af10d10a08b81d3924fa5b35bfb548b2a05 Mon Sep 17 00:00:00 2001
1+ From 40f07cbde57022b25412cf1c9239755613500d86 Mon Sep 17 00:00:00 2001
22From: nasmnc01 <
[email protected] >
33Author: Scott Douglass <
[email protected] >
44Date: Tue, 13 Aug 2024 10:55:51 +0100
@@ -11,6 +11,11 @@ for performance gains of 1% to 2% on selected benchmarks.
1111
1212Co-authored-by: Nashe Mncube <
[email protected] >
1313---
14+ llvm/lib/Target/ARM/ARMFeatures.td | 5 +
15+ llvm/lib/Target/ARM/ARMProcessors.td | 2 +-
16+ llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp | 121 ++++++++++++++++++++
17+ llvm/lib/Target/ARM/ARMSelectionDAGInfo.h | 6 +
18+ 4 files changed, 133 insertions(+), 1 deletion(-)
1419
1520diff --git a/llvm/lib/Target/ARM/ARMFeatures.td b/llvm/lib/Target/ARM/ARMFeatures.td
1621index bb437698296c..f7fa00aba424 100644
@@ -19,14 +24,14 @@ index bb437698296c..f7fa00aba424 100644
1924@@ -510,6 +510,11 @@ def FeatureNoPostRASched : SubtargetFeature<"disable-postra-scheduler",
2025 "DisablePostRAScheduler", "true",
2126 "Don't schedule again after register allocation">;
22-
27+
2328+ def FeatureUseInlineMemcpyAsLdSt :
2429+ SubtargetFeature<"use-inline-memcpy-ldst", "UseInlineMemcpyAsLdSt",
2530+ "true", "Use memcpy inlining as LD/ST instructions">;
2631+
2732+
2833 // Armv8.5-A extensions
29-
34+
3035 // Has speculation barrier.
3136diff --git a/llvm/lib/Target/ARM/ARMProcessors.td b/llvm/lib/Target/ARM/ARMProcessors.td
3237index b94a5fc16146..ffb0c86bc687 100644
@@ -38,15 +43,15 @@ index b94a5fc16146..ffb0c86bc687 100644
3843 def ProcM7 : SubtargetFeature<"m7", "ARMProcFamily", "CortexM7",
3944- "Cortex-M7 ARM processors", []>;
4045+ "Cortex-M7 ARM processors", [FeatureUseInlineMemcpyAsLdSt]>;
41-
46+
4247 //===----------------------------------------------------------------------===//
4348 // ARM processors
4449diff --git a/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp b/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
45- index c57825949c1c..12db2ab1fca2 100644
50+ index c57825949c1c..63ae7a042886 100644
4651--- a/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
4752+++ b/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
4853@@ -12,6 +12,7 @@
49-
54+
5055 #include "ARMTargetMachine.h"
5156 #include "ARMTargetTransformInfo.h"
5257+ #include "llvm/ADT/SmallVector.h"
@@ -56,7 +61,7 @@ index c57825949c1c..12db2ab1fca2 100644
5661@@ -138,6 +139,122 @@ SDValue ARMSelectionDAGInfo::EmitSpecializedLibcall(
5762 return CallResult.second;
5863 }
59-
64+
6065+ SDValue ARMSelectionDAGInfo::EmitMemcpyAsLdSt(
6166+ SelectionDAG &DAG, SDLoc dl, const ARMSubtarget &Subtarget, SDValue Chain,
6267+ SDValue Dst, SDValue Src, uint64_t SizeVal, bool isVolatile,
@@ -179,7 +184,7 @@ index c57825949c1c..12db2ab1fca2 100644
179184@@ -192,6 +309,10 @@ SDValue ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(
180185 return EmitSpecializedLibcall(DAG, dl, Chain, Dst, Src, Size,
181186 Alignment.value(), RTLIB::MEMCPY);
182-
187+
183188+ if (Subtarget.useInlineMemcpyAsLdSt())
184189+ return EmitMemcpyAsLdSt(DAG, dl, Subtarget, Chain, Dst, Src, SizeVal,
185190+ isVolatile, DstPtrInfo, SrcPtrInfo);
@@ -194,7 +199,7 @@ index 275b1c0f8dc0..6ff422c15b12 100644
194199@@ -44,6 +44,12 @@ public:
195200 MachinePointerInfo DstPtrInfo,
196201 MachinePointerInfo SrcPtrInfo) const override;
197-
202+
198203+ SDValue EmitMemcpyAsLdSt(SelectionDAG &DAG, SDLoc dl,
199204+ const ARMSubtarget &Subtarget, SDValue Chain,
200205+ SDValue Dst, SDValue Src, uint64_t SizeVal,
@@ -204,6 +209,6 @@ index 275b1c0f8dc0..6ff422c15b12 100644
204209 SDValue
205210 EmitTargetCodeForMemmove(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain,
206211 SDValue Dst, SDValue Src, SDValue Size,
207- - -
212+ - -
2082132.34.1
209214
0 commit comments