Skip to content

Commit

Permalink
[AArch64] Merge duplicate extension information.
Browse files Browse the repository at this point in the history
When we moved the extension information into tablegen in llvm#90987, some
features (FEAT_DPB, FEAT_DPB2, FEAT_FLAGM2, FEAT_FRINTTS, FEAT_RCPC2)
were defined as FMVOnlyExtension despite already having an equivalent
SubtargetFeature in place. This patch is fusing these duplications.
  • Loading branch information
labrinea committed May 14, 2024
1 parent c7c5666 commit f9f60fb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
5 changes: 4 additions & 1 deletion llvm/include/llvm/TargetParser/AArch64TargetParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ inline constexpr ExtensionDependency ExtensionDependencies[] = {
{AEK_LSE, AEK_LSE128},
{AEK_PREDRES, AEK_SPECRES2},
{AEK_RAS, AEK_RASV2},
{AEK_RCPC, AEK_RCPC3},
{AEK_RCPC, AEK_RCPC2},
{AEK_RCPC2, AEK_RCPC3},
{AEK_FLAGM, AEK_FLAGM2},
{AEK_DPB, AEK_DPB2},
};
// clang-format on

Expand Down
34 changes: 19 additions & 15 deletions llvm/lib/Target/AArch64/AArch64Features.td
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,12 @@ class FMVOnlyExtension<string FMVBit, string Name, string Deps, int Priority>
}

def : FMVOnlyExtension<"FEAT_DGH", "dgh", "", 260>;
def : FMVOnlyExtension<"FEAT_DPB", "dpb", "+ccpp", 190>;
def : FMVOnlyExtension<"FEAT_DPB2", "dpb2", "+ccpp,+ccdp", 200>;
def : FMVOnlyExtension<"FEAT_EBF16", "ebf16", "+bf16", 290>;
def : FMVOnlyExtension<"FEAT_FLAGM2", "flagm2", "+flagm,+altnzcv", 30>;
def : FMVOnlyExtension<"FEAT_FRINTTS", "frintts", "+fptoint", 250>;
def : FMVOnlyExtension<"FEAT_LS64_ACCDATA", "ls64_accdata", "+ls64", 540>;
def : FMVOnlyExtension<"FEAT_LS64_V", "ls64_v", "", 530>;
def : FMVOnlyExtension<"FEAT_MEMTAG2", "memtag2", "+mte", 450>;
def : FMVOnlyExtension<"FEAT_MEMTAG3", "memtag3", "+mte", 460>;
def : FMVOnlyExtension<"FEAT_PMULL", "pmull", "+aes,+fp-armv8,+neon", 160>;
def : FMVOnlyExtension<"FEAT_RCPC2", "rcpc2", "+rcpc", 240>;
def : FMVOnlyExtension<"FEAT_RPRES", "rpres", "", 300>;
def : FMVOnlyExtension<"FEAT_SHA1", "sha1", "+fp-armv8,+neon", 120>;
def : FMVOnlyExtension<"FEAT_SSBS2", "ssbs2", "+ssbs", 500>;
Expand Down Expand Up @@ -216,8 +211,10 @@ def FeaturePAN_RWV : SubtargetFeature<
def FeaturePsUAO : SubtargetFeature< "uaops", "HasPsUAO", "true",
"Enable v8.2 UAO PState (FEAT_UAO)">;

def FeatureCCPP : SubtargetFeature<"ccpp", "HasCCPP",
"true", "Enable v8.2 data Cache Clean to Point of Persistence (FEAT_DPB)" >;
let ArchExtKindSpelling = "AEK_DPB", MArchName = "dpb" in
def FeatureCCPP : Extension<"ccpp", "CCPP",
"Enable v8.2 data Cache Clean to Point of Persistence (FEAT_DPB)", [],
"FEAT_DPB", "+ccpp", 190>;

def FeatureSVE : Extension<"sve", "SVE",
"Enable Scalable Vector Extension (SVE) instructions (FEAT_SVE)", [FeatureFullFP16],
Expand Down Expand Up @@ -491,9 +488,10 @@ def FeatureFlagM : Extension<
"FEAT_FLAGM", "+flagm", 20>;

// 8.4 RCPC enchancements: LDAPR & STLR instructions with Immediate Offset
def FeatureRCPC_IMMO : SubtargetFeature<"rcpc-immo", "HasRCPC_IMMO", "true",
let ArchExtKindSpelling = "AEK_RCPC2", MArchName = "rcpc2" in
def FeatureRCPC_IMMO : Extension<"rcpc-immo", "RCPC_IMMO",
"Enable v8.4-A RCPC instructions with Immediate Offsets (FEAT_LRCPC2)",
[FeatureRCPC]>;
[FeatureRCPC], "FEAT_RCPC2", "+rcpc", 240>;

def FeatureNoNegativeImmediates : SubtargetFeature<"no-neg-immediates",
"NegativeImmediates", "false",
Expand Down Expand Up @@ -525,12 +523,16 @@ def FeatureAggressiveFMA :
"true",
"Enable Aggressive FMA for floating-point.">;

def FeatureAltFPCmp : SubtargetFeature<"altnzcv", "HasAlternativeNZCV", "true",
"Enable alternative NZCV format for floating point comparisons (FEAT_FlagM2)">;
let ArchExtKindSpelling = "AEK_FLAGM2", MArchName = "flagm2" in
def FeatureAltFPCmp : Extension<"altnzcv", "AlternativeNZCV",
"Enable alternative NZCV format for floating point comparisons (FEAT_FlagM2)",
[FeatureFlagM], "FEAT_FLAGM2", "+flagm,+altnzcv", 30>;

def FeatureFRInt3264 : SubtargetFeature<"fptoint", "HasFRInt3264", "true",
let ArchExtKindSpelling = "AEK_FRINTTS", MArchName = "frintts" in
def FeatureFRInt3264 : Extension<"fptoint", "FRInt3264",
"Enable FRInt[32|64][Z|X] instructions that round a floating-point number to "
"an integer (in FP format) forcing it to fit into a 32- or 64-bit int (FEAT_FRINTTS)" >;
"an integer (in FP format) forcing it to fit into a 32- or 64-bit int (FEAT_FRINTTS)",
[], "FEAT_FRINTTS", "+fptoint", 250>;

def FeatureSpecRestrict : SubtargetFeature<"specrestrict", "HasSpecRestrict",
"true", "Enable architectural speculation restriction (FEAT_CSV2_2)">;
Expand All @@ -547,8 +549,10 @@ def FeaturePredRes : Extension<"predres", "PredRes",
"Enable v8.5a execution and data prediction invalidation instructions (FEAT_SPECRES)", [],
"FEAT_PREDRES", "+predres", 480>;

def FeatureCacheDeepPersist : SubtargetFeature<"ccdp", "CCDP", "true",
"Enable v8.5 Cache Clean to Point of Deep Persistence (FEAT_DPB2)" >;
let ArchExtKindSpelling = "AEK_DPB2", MArchName = "dpb2" in
def FeatureCacheDeepPersist : Extension<"ccdp", "CCDP",
"Enable v8.5 Cache Clean to Point of Deep Persistence (FEAT_DPB2)",
[FeatureCCPP], "FEAT_DPB2", "+ccpp,+ccdp", 200>;

let ArchExtKindSpelling = "AEK_NONE" in
def FeatureBranchTargetId : Extension<"bti", "BTI",
Expand Down

0 comments on commit f9f60fb

Please sign in to comment.