[PATCH] D156784: [AArch64][PAC] Declare FPAC subtarget feature

Anatoly Trosinenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 08:43:26 PDT 2023


atrosinenko updated this revision to Diff 557488.
atrosinenko added a comment.

Updated the patch:

- added FPAC to `Extensions` array in AArch64TargetParser.h, so it can be used in `-march=...+fpac` command line option. Adding one more feature seems mostly harmless after PR 65423 <https://github.com/llvm/llvm-project/pull/65423> was merged
- dropped changes to `clang/lib/Basic/Targets/AArch64.(h|cpp)` as I don't actually use them to set any C defines or so (I don't see any mentioning of FPAC in ACLE 2023Q2)
- not adding FPAC to `ExtensionMap` in AArch64AsmParser.cpp as it doesn't look relevant for assembler (maybe it would be relevant someday for storing the set of expected features to object files)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156784/new/

https://reviews.llvm.org/D156784

Files:
  llvm/include/llvm/TargetParser/AArch64TargetParser.h
  llvm/lib/Target/AArch64/AArch64.td
  llvm/unittests/TargetParser/TargetParserTest.cpp


Index: llvm/unittests/TargetParser/TargetParserTest.cpp
===================================================================
--- llvm/unittests/TargetParser/TargetParserTest.cpp
+++ llvm/unittests/TargetParser/TargetParserTest.cpp
@@ -1731,7 +1731,7 @@
       AArch64::AEK_B16B16,  AArch64::AEK_SMEF16F16, AArch64::AEK_CSSC,
       AArch64::AEK_RCPC3,   AArch64::AEK_THE,       AArch64::AEK_D128,
       AArch64::AEK_LSE128,  AArch64::AEK_SPECRES2,  AArch64::AEK_RASv2,
-      AArch64::AEK_ITE,     AArch64::AEK_GCS,
+      AArch64::AEK_ITE,     AArch64::AEK_GCS,       AArch64::AEK_FPAC,
   };
 
   std::vector<StringRef> Features;
@@ -1804,6 +1804,7 @@
   EXPECT_TRUE(llvm::is_contained(Features, "+specres2"));
   EXPECT_TRUE(llvm::is_contained(Features, "+ite"));
   EXPECT_TRUE(llvm::is_contained(Features, "+gcs"));
+  EXPECT_TRUE(llvm::is_contained(Features, "+fpac"));
 
   // Assuming we listed every extension above, this should produce the same
   // result. (note that AEK_NONE doesn't have a name so it won't be in the
@@ -1927,6 +1928,7 @@
       {"predres2", "nopredres2", "+specres2", "-specres2"},
       {"rasv2", "norasv2", "+rasv2", "-rasv2"},
       {"gcs", "nogcs", "+gcs", "-gcs"},
+      {"fpac", "nofpac", "+fpac", "-fpac"},
   };
 
   for (unsigned i = 0; i < std::size(ArchExt); i++) {
Index: llvm/lib/Target/AArch64/AArch64.td
===================================================================
--- llvm/lib/Target/AArch64/AArch64.td
+++ llvm/lib/Target/AArch64/AArch64.td
@@ -314,6 +314,10 @@
     "pauth", "HasPAuth", "true",
     "Enable v8.3-A Pointer Authentication extension (FEAT_PAuth)">;
 
+def FeatureFPAC : SubtargetFeature<
+    "fpac", "HasFPAC", "true",
+    "Assume AUT* instructions generate fault on invalid PAC (FEAT_FPAC)">;
+
 def FeatureJS : SubtargetFeature<
     "jsconv", "HasJS", "true",
     "Enable v8.3-A JavaScript FP conversion instructions (FEAT_JSCVT)",
Index: llvm/include/llvm/TargetParser/AArch64TargetParser.h
===================================================================
--- llvm/include/llvm/TargetParser/AArch64TargetParser.h
+++ llvm/include/llvm/TargetParser/AArch64TargetParser.h
@@ -156,7 +156,8 @@
   AEK_RASv2 =         55, // FEAT_RASv2
   AEK_ITE =           56, // FEAT_ITE
   AEK_GCS =           57, // FEAT_GCS
-  AEK_NUM_EXTENSIONS =  AEK_GCS + 1
+  AEK_FPAC =          58, // FEAT_FPAC
+  AEK_NUM_EXTENSIONS =  AEK_FPAC + 1
 };
 using ExtensionBitset = Bitset<AEK_NUM_EXTENSIONS>;
 // clang-format on
@@ -264,6 +265,7 @@
     {"tme", AArch64::AEK_TME, "+tme", "-tme", FEAT_MAX, "", 0},
     {"wfxt", AArch64::AEK_NONE, {}, {}, FEAT_WFXT, "+wfxt", 550},
     {"gcs", AArch64::AEK_GCS, "+gcs", "-gcs", FEAT_MAX, "", 0},
+    {"fpac", AArch64::AEK_FPAC, "+fpac", "-fpac", FEAT_MAX, "", 0},
     // Special cases
     {"none", AArch64::AEK_NONE, {}, {}, FEAT_MAX, "", ExtensionInfo::MaxFMVPriority},
 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156784.557488.patch
Type: text/x-patch
Size: 2885 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230929/9b0a8274/attachment.bin>


More information about the llvm-commits mailing list