Skip to content

Commit dd8b0fe

Browse files
committed
[ARM][AArch64] generate subtarget feature flags
This patch aims to reduce a lot of the boilerplate around adding new subtarget features. From the SubtargetFeatures tablegen definitions, a series of calls to the macro GET_SUBTARGETINFO_MACRO are generated in ARM/AArch64GenSubtargetInfo.inc. ARMSubtarget/AArch64Subtarget can then use this macro to define bool members and the corresponding getter methods. Some naming inconsistencies have been fixed to allow this, and one unused member removed. This implementation only applies to boolean members; in future both BitVector and enum members could also be generated. Differential Revision: https://reviews.llvm.org/D120906
1 parent 4455c5c commit dd8b0fe

File tree

7 files changed

+181
-808
lines changed

7 files changed

+181
-808
lines changed

llvm/lib/Target/AArch64/AArch64.td

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ def FeatureZCRegMove : SubtargetFeature<"zcm", "HasZeroCycleRegMove", "true",
154154
def FeatureZCZeroingGP : SubtargetFeature<"zcz-gp", "HasZeroCycleZeroingGP", "true",
155155
"Has zero-cycle zeroing instructions for generic registers">;
156156

157+
// It is generally beneficial to rewrite "fmov s0, wzr" to "movi d0, #0".
158+
// as movi is more efficient across all cores. Newer cores can eliminate
159+
// fmovs early and there is no difference with movi, but this not true for
160+
// all implementations.
157161
def FeatureNoZCZeroingFP : SubtargetFeature<"no-zcz-fp", "HasZeroCycleZeroingFP", "false",
158162
"Has no zero-cycle zeroing instructions for FP registers">;
159163

@@ -168,7 +172,7 @@ def FeatureZCZeroingFPWorkaround : SubtargetFeature<"zcz-fp-workaround",
168172
"The zero-cycle floating-point zeroing instruction has a bug">;
169173

170174
def FeatureStrictAlign : SubtargetFeature<"strict-align",
171-
"StrictAlign", "true",
175+
"RequiresStrictAlign", "true",
172176
"Disallow all unaligned memory "
173177
"access">;
174178

@@ -190,24 +194,24 @@ def FeaturePredictableSelectIsExpensive : SubtargetFeature<
190194
"Prefer likely predicted branches over selects">;
191195

192196
def FeatureCustomCheapAsMoveHandling : SubtargetFeature<"custom-cheap-as-move",
193-
"CustomAsCheapAsMove", "true",
197+
"HasCustomCheapAsMoveHandling", "true",
194198
"Use custom handling of cheap instructions">;
195199

196200
def FeatureExynosCheapAsMoveHandling : SubtargetFeature<"exynos-cheap-as-move",
197-
"ExynosAsCheapAsMove", "true",
201+
"HasExynosCheapAsMoveHandling", "true",
198202
"Use Exynos specific handling of cheap instructions",
199203
[FeatureCustomCheapAsMoveHandling]>;
200204

201205
def FeaturePostRAScheduler : SubtargetFeature<"use-postra-scheduler",
202206
"UsePostRAScheduler", "true", "Schedule again after register allocation">;
203207

204208
def FeatureSlowMisaligned128Store : SubtargetFeature<"slow-misaligned-128store",
205-
"Misaligned128StoreIsSlow", "true", "Misaligned 128 bit stores are slow">;
209+
"IsMisaligned128StoreSlow", "true", "Misaligned 128 bit stores are slow">;
206210

207211
def FeatureSlowPaired128 : SubtargetFeature<"slow-paired-128",
208-
"Paired128IsSlow", "true", "Paired 128 bit loads and stores are slow">;
212+
"IsPaired128Slow", "true", "Paired 128 bit loads and stores are slow">;
209213

210-
def FeatureSlowSTRQro : SubtargetFeature<"slow-strqro-store", "STRQroIsSlow",
214+
def FeatureSlowSTRQro : SubtargetFeature<"slow-strqro-store", "IsSTRQroSlow",
211215
"true", "STR of Q register with register offset is slow">;
212216

213217
def FeatureAlternateSExtLoadCVTF32Pattern : SubtargetFeature<

0 commit comments

Comments
 (0)