[clang] [llvm] [AArch64][Driver] Better handling of target feature dependencies (PR #78270)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 16 05:06:47 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 032c832719b5b2c44b78359ed54b91964ef15b79 ebd6e9a2a9b80ca492f294b9f8468c20fb30005a -- clang/lib/Basic/Targets/AArch64.cpp clang/lib/Driver/ToolChains/Arch/AArch64.cpp clang/test/Driver/aarch64-bf16.c clang/test/Driver/aarch64-cortex-a510.c clang/test/Driver/aarch64-cortex-a710.c clang/test/Driver/aarch64-cortex-x2.c clang/test/Driver/aarch64-d128.c clang/test/Driver/aarch64-fp16.c clang/test/Driver/aarch64-implied-sme-features.c clang/test/Driver/aarch64-implied-sve-features.c clang/test/Driver/aarch64-ite.c clang/test/Driver/aarch64-lrcpc3.c clang/test/Driver/aarch64-ls64.c clang/test/Driver/aarch64-lse128.c clang/test/Driver/aarch64-march.c clang/test/Driver/aarch64-mgeneral_regs_only.c clang/test/Driver/aarch64-mte.c clang/test/Driver/aarch64-perfmon.c clang/test/Driver/aarch64-predres.c clang/test/Driver/aarch64-rand.c clang/test/Driver/aarch64-ras.c clang/test/Driver/aarch64-rdm.c clang/test/Driver/aarch64-ssbs.c clang/test/Driver/aarch64-sve2.c clang/test/Driver/aarch64-the.c clang/test/Driver/aarch64-v81a.c clang/test/Driver/aarch64-v82a.c clang/test/Driver/aarch64-v83a.c clang/test/Driver/aarch64-v84a.c clang/test/Driver/aarch64-v85a.c clang/test/Driver/aarch64-v86a.c clang/test/Driver/aarch64-v87a.c clang/test/Driver/aarch64-v88a.c clang/test/Driver/aarch64-v89a.c clang/test/Driver/aarch64-v91a.c clang/test/Driver/aarch64-v92a.c clang/test/Driver/aarch64-v93a.c clang/test/Driver/aarch64-v94a.c clang/test/Driver/aarch64-v95a.c clang/test/Driver/arm-sb.c clang/test/Preprocessor/aarch64-target-features.c llvm/include/llvm/TargetParser/AArch64TargetParser.h llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp llvm/lib/TargetParser/AArch64TargetParser.cpp llvm/unittests/TargetParser/TargetParserTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index 5037b669da..85f053dc8b 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -203,9 +203,11 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
   if (!WaMArch.empty())
     success = getAArch64ArchFeaturesFromMarch(D, WaMArch, Args, Extensions);
   else if ((A = Args.getLastArg(options::OPT_march_EQ)))
-    success = getAArch64ArchFeaturesFromMarch(D, A->getValue(), Args, Extensions);
+    success =
+        getAArch64ArchFeaturesFromMarch(D, A->getValue(), Args, Extensions);
   else if ((A = Args.getLastArg(options::OPT_mcpu_EQ)))
-    success = getAArch64ArchFeaturesFromMcpu(D, A->getValue(), Args, Extensions);
+    success =
+        getAArch64ArchFeaturesFromMcpu(D, A->getValue(), Args, Extensions);
   else if (isCPUDeterminedByTriple(Triple))
     success = getAArch64ArchFeaturesFromMcpu(
         D, getAArch64TargetCPU(Args, Triple, A), Args, Extensions);
diff --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h
index 0ab218f15d..f84bd26329 100644
--- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h
+++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h
@@ -353,49 +353,28 @@ struct ExtensionDependency {
 };
 
 inline constexpr ExtensionDependency ExtensionDependencies[] = {
-  {AEK_FP, AEK_FP16},
-  {AEK_FP, AEK_SIMD},
-  {AEK_FP, AEK_JSCVT},
-  {AEK_FP, AEK_FP8},
-  {AEK_SIMD, AEK_CRYPTO},
-  {AEK_SIMD, AEK_AES},
-  {AEK_SIMD, AEK_SHA2},
-  {AEK_SIMD, AEK_SHA3},
-  {AEK_SIMD, AEK_SM4},
-  {AEK_SIMD, AEK_RDM},
-  {AEK_SIMD, AEK_DOTPROD},
-  {AEK_SIMD, AEK_FCMA},
-  {AEK_FP16, AEK_FP16FML},
-  {AEK_FP16, AEK_SVE},
-  {AEK_BF16, AEK_SME},
-  {AEK_BF16, AEK_B16B16},
-  {AEK_SVE, AEK_SVE2},
-  {AEK_SVE, AEK_F32MM},
-  {AEK_SVE, AEK_F64MM},
-  {AEK_SVE2, AEK_SVE2p1},
-  {AEK_SVE2, AEK_SVE2BITPERM},
-  {AEK_SVE2, AEK_SVE2AES},
-  {AEK_SVE2, AEK_SVE2SHA3},
-  {AEK_SVE2, AEK_SVE2SM4},
-  {AEK_SVE2, AEK_SMEFA64},
-  {AEK_SVE2, AEK_SMEFA64},
-  {AEK_SME, AEK_SME2},
-  {AEK_SME, AEK_SMEF16F16},
-  {AEK_SME, AEK_SMEF64F64},
-  {AEK_SME, AEK_SMEI16I64},
-  {AEK_SME, AEK_SMEFA64},
-  {AEK_SME2, AEK_SME2p1},
-  {AEK_SME2, AEK_SSVE_FP8FMA},
-  {AEK_SME2, AEK_SSVE_FP8DOT2},
-  {AEK_SME2, AEK_SSVE_FP8DOT4},
-  {AEK_SME2, AEK_SMEF8F16},
-  {AEK_SME2, AEK_SMEF8F32},
-  {AEK_FP8, AEK_SMEF8F16},
-  {AEK_FP8, AEK_SMEF8F32},
-  {AEK_LSE, AEK_LSE128},
-  {AEK_PREDRES, AEK_SPECRES2},
-  {AEK_RAS, AEK_RASv2},
-  {AEK_RCPC, AEK_RCPC3},
+    {AEK_FP, AEK_FP16},           {AEK_FP, AEK_SIMD},
+    {AEK_FP, AEK_JSCVT},          {AEK_FP, AEK_FP8},
+    {AEK_SIMD, AEK_CRYPTO},       {AEK_SIMD, AEK_AES},
+    {AEK_SIMD, AEK_SHA2},         {AEK_SIMD, AEK_SHA3},
+    {AEK_SIMD, AEK_SM4},          {AEK_SIMD, AEK_RDM},
+    {AEK_SIMD, AEK_DOTPROD},      {AEK_SIMD, AEK_FCMA},
+    {AEK_FP16, AEK_FP16FML},      {AEK_FP16, AEK_SVE},
+    {AEK_BF16, AEK_SME},          {AEK_BF16, AEK_B16B16},
+    {AEK_SVE, AEK_SVE2},          {AEK_SVE, AEK_F32MM},
+    {AEK_SVE, AEK_F64MM},         {AEK_SVE2, AEK_SVE2p1},
+    {AEK_SVE2, AEK_SVE2BITPERM},  {AEK_SVE2, AEK_SVE2AES},
+    {AEK_SVE2, AEK_SVE2SHA3},     {AEK_SVE2, AEK_SVE2SM4},
+    {AEK_SVE2, AEK_SMEFA64},      {AEK_SVE2, AEK_SMEFA64},
+    {AEK_SME, AEK_SME2},          {AEK_SME, AEK_SMEF16F16},
+    {AEK_SME, AEK_SMEF64F64},     {AEK_SME, AEK_SMEI16I64},
+    {AEK_SME, AEK_SMEFA64},       {AEK_SME2, AEK_SME2p1},
+    {AEK_SME2, AEK_SSVE_FP8FMA},  {AEK_SME2, AEK_SSVE_FP8DOT2},
+    {AEK_SME2, AEK_SSVE_FP8DOT4}, {AEK_SME2, AEK_SMEF8F16},
+    {AEK_SME2, AEK_SMEF8F32},     {AEK_FP8, AEK_SMEF8F16},
+    {AEK_FP8, AEK_SMEF8F32},      {AEK_LSE, AEK_LSE128},
+    {AEK_PREDRES, AEK_SPECRES2},  {AEK_RAS, AEK_RASv2},
+    {AEK_RCPC, AEK_RCPC3},
 };
 
 enum ArchProfile { AProfile = 'A', RProfile = 'R', InvalidProfile = '?' };
diff --git a/llvm/unittests/TargetParser/TargetParserTest.cpp b/llvm/unittests/TargetParser/TargetParserTest.cpp
index af0302a7bf..f41b856da7 100644
--- a/llvm/unittests/TargetParser/TargetParserTest.cpp
+++ b/llvm/unittests/TargetParser/TargetParserTest.cpp
@@ -8,8 +8,8 @@
 
 #include "llvm/TargetParser/TargetParser.h"
 #include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/Support/ARMBuildAttributes.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/FormatVariadic.h"

``````````

</details>


https://github.com/llvm/llvm-project/pull/78270


More information about the cfe-commits mailing list