[PATCH] D128787: [AArch64] Make FeatureFuseAdrpAdd a tune feature

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 29 00:50:10 PDT 2022


MaskRay created this revision.
MaskRay added reviewers: alexander-shaposhnikov, peter.smith, Wilco1, abdulras, paquette, t.p.northover, dmgreen.
Herald added subscribers: StephenFan, hiraditya, kristof.beyls.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Update D120104 <https://reviews.llvm.org/D120104> to add FeatureFuseAdrpAdd to Processor#TuneFeatures
instead of Processor#Features, similar to FeatureFuseAES, and matching
Tune*.

This enable FeatureFuseAdrpAdd for `clang -mcpu=xxx -mtune=generic` even
if xxx does not set FeatureFuseAdrpAdd.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128787

Files:
  llvm/lib/Target/AArch64/AArch64.td
  llvm/test/CodeGen/AArch64/misched-fusion-lit.ll


Index: llvm/test/CodeGen/AArch64/misched-fusion-lit.ll
===================================================================
--- llvm/test/CodeGen/AArch64/misched-fusion-lit.ll
+++ llvm/test/CodeGen/AArch64/misched-fusion-lit.ll
@@ -22,6 +22,19 @@
 ; CHECKFUSE-NEXT: add {{x[0-9]+}}, [[R]], :lo12:litp
 }
 
+define dso_local i8* @litp_tune_generic(i32 %a, i32 %b) "tune-cpu"="generic" {
+entry:
+  %add = add nsw i32 %b, %a
+  %idx.ext = sext i32 %add to i64
+  %add.ptr = getelementptr i8, i8* bitcast (i8* (i32, i32)* @litp_tune_generic to i8*), i64 %idx.ext
+  store i8* %add.ptr, i8** @g, align 8
+  ret i8* %add.ptr
+
+; CHECK-LABEL: litp_tune_generic:
+; CHECK:         adrp [[R:x[0-9]+]], litp_tune_generic
+; CHECK-NEXT:    add {{x[0-9]+}}, [[R]], :lo12:litp_tune_generic
+}
+
 define dso_local i32 @liti(i32 %a, i32 %b) {
 entry:
   %add = add i32 %a, -262095121
Index: llvm/lib/Target/AArch64/AArch64.td
===================================================================
--- llvm/lib/Target/AArch64/AArch64.td
+++ llvm/lib/Target/AArch64/AArch64.td
@@ -1092,12 +1092,11 @@
   // affect code generated by the compiler and can be used only by explicitly
   // mentioning the new system register names in assembly. FeatureFuseAdrpAdd is
   // enabled under Generic to allow linker merging optimizations.
-  list<SubtargetFeature> Generic = [FeatureFPARMv8, FeatureNEON, FeatureETE,
-                                    FeatureFuseAdrpAdd];
+  list<SubtargetFeature> Generic = [FeatureFPARMv8, FeatureNEON, FeatureETE];
 }
 
 def : ProcessorModel<"generic", CortexA55Model, ProcessorFeatures.Generic,
-                     [FeatureFuseAES, FeaturePostRAScheduler]>;
+                     [FeatureFuseAdrpAdd, FeatureFuseAES, FeaturePostRAScheduler]>;
 def : ProcessorModel<"cortex-a35", CortexA53Model, ProcessorFeatures.A53,
                      [TuneA35]>;
 def : ProcessorModel<"cortex-a34", CortexA53Model, ProcessorFeatures.A53,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128787.440883.patch
Type: text/x-patch
Size: 1940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220629/34af528a/attachment.bin>


More information about the llvm-commits mailing list