[clang] 9a015ee - [AArch64] Avoid scanning feature list for target parsing

via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 2 06:56:52 PDT 2022


Author: tyb0807
Date: 2022-04-02T14:51:23+01:00
New Revision: 9a015ee1f948755d69dc2ff52e7655229e2eed47

URL: https://github.com/llvm/llvm-project/commit/9a015ee1f948755d69dc2ff52e7655229e2eed47
DIFF: https://github.com/llvm/llvm-project/commit/9a015ee1f948755d69dc2ff52e7655229e2eed47.diff

LOG: [AArch64] Avoid scanning feature list for target parsing

As discussed in https://reviews.llvm.org/D120111, this patch proposes an
alternative implementation to avoid scanning feature list for
architecture version over and over again. The insertion position for
default extensions is also captured during this single scan of the
feature list.

Differential Revision: https://reviews.llvm.org/D120864

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Arch/AArch64.cpp
    clang/test/Driver/aarch64-cpus-2.c
    clang/test/Preprocessor/aarch64-target-features.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index 1691b7faf668a..d82198ec678bf 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -347,28 +347,85 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
       Features.push_back("-crc");
   }
 
+  int V8Version = -1;
+  int V9Version = -1;
+  bool HasNoSM4 = false;
+  bool HasNoSHA3 = false;
+  bool HasNoSHA2 = false;
+  bool HasNoAES = false;
+  bool HasSM4 = false;
+  bool HasSHA3 = false;
+  bool HasSHA2 = false;
+  bool HasAES = false;
+  bool HasCrypto = false;
+  bool HasNoCrypto = false;
+  int FullFP16Pos = -1;
+  int NoFullFP16Pos = -1;
+  int FP16FMLPos = -1;
+  int NoFP16FMLPos = -1;
+  int ArchFeatPos = -1;
+
+  for (auto I = Features.begin(), E = Features.end(); I != E; I++) {
+    if (*I == "+v8a")   V8Version = 0;
+    else if (*I == "+v8.1a") V8Version = 1;
+    else if (*I == "+v8.2a") V8Version = 2;
+    else if (*I == "+v8.3a") V8Version = 3;
+    else if (*I == "+v8.4a") V8Version = 4;
+    else if (*I == "+v8.5a") V8Version = 5;
+    else if (*I == "+v8.6a") V8Version = 6;
+    else if (*I == "+v8.7a") V8Version = 7;
+    else if (*I == "+v8.8a") V8Version = 8;
+    else if (*I == "+v8.9a") V8Version = 9;
+    else if (*I == "+v9a")   V9Version = 0;
+    else if (*I == "+v9.1a") V9Version = 1;
+    else if (*I == "+v9.2a") V9Version = 2;
+    else if (*I == "+v9.3a") V9Version = 3;
+    else if (*I == "+v9.4a") V9Version = 4;
+    else if (*I == "+sm4")  HasSM4 = true;
+    else if (*I == "+sha3") HasSHA3 = true;
+    else if (*I == "+sha2") HasSHA2 = true;
+    else if (*I == "+aes")  HasAES = true;
+    else if (*I == "-sm4")  HasNoSM4 = true;
+    else if (*I == "-sha3") HasNoSHA3 = true;
+    else if (*I == "-sha2") HasNoSHA2 = true;
+    else if (*I == "-aes")  HasNoAES = true;
+    else if (*I == "+fp16fml")  FP16FMLPos = I - Features.begin();
+    else if (*I == "-fp16fml")  NoFP16FMLPos = I - Features.begin();
+    else if (*I == "-fullfp16") NoFullFP16Pos = I - Features.begin();
+    else if (*I == "+fullfp16") FullFP16Pos = I - Features.begin();
+    // Whichever option comes after (right-most option) will win
+    else if (*I == "+crypto") {
+      HasCrypto = true;
+      HasNoCrypto = false;
+    } else if (*I == "-crypto") {
+      HasCrypto = false;
+      HasNoCrypto = true;
+    }
+    // Register the iterator position if this is an architecture feature
+    if (ArchFeatPos == -1 && (V8Version != -1 || V9Version != -1))
+      ArchFeatPos = I - Features.begin();
+  }
+
   // Handle (arch-dependent) fp16fml/fullfp16 relationship.
   // FIXME: this fp16fml option handling will be reimplemented after the
   // TargetParser rewrite.
-  const auto ItRNoFullFP16 = std::find(Features.rbegin(), Features.rend(), "-fullfp16");
-  const auto ItRFP16FML = std::find(Features.rbegin(), Features.rend(), "+fp16fml");
-  if (llvm::is_contained(Features, "+v8.4a")) {
-    const auto ItRFullFP16  = std::find(Features.rbegin(), Features.rend(), "+fullfp16");
-    if (ItRFullFP16 < ItRNoFullFP16 && ItRFullFP16 < ItRFP16FML) {
+  if (V8Version >= 4) {
+    // "-fullfp16" "+fullfp16" && "+fp16fml" "+fullfp16" && no "+fullfp16" "-fp16fml" = "+fp16fml"
+    if (FullFP16Pos > NoFullFP16Pos && FullFP16Pos > FP16FMLPos && FullFP16Pos > NoFP16FMLPos)
       // Only entangled feature that can be to the right of this +fullfp16 is -fp16fml.
       // Only append the +fp16fml if there is no -fp16fml after the +fullfp16.
-      if (std::find(Features.rbegin(), ItRFullFP16, "-fp16fml") == ItRFullFP16)
-        Features.push_back("+fp16fml");
-    }
+      Features.push_back("+fp16fml");
     else
       goto fp16_fml_fallthrough;
   } else {
 fp16_fml_fallthrough:
     // In both of these cases, putting the 'other' feature on the end of the vector will
     // result in the same effect as placing it immediately after the current feature.
-    if (ItRNoFullFP16 < ItRFP16FML)
+    // "+fp16fml"  "-fullfp16" = "-fp16fml"
+    if (NoFullFP16Pos > FP16FMLPos)
       Features.push_back("-fp16fml");
-    else if (ItRNoFullFP16 > ItRFP16FML)
+    // "-fullfp16" "+fp16fml" = "+fullfp16"
+    else if (NoFullFP16Pos < FP16FMLPos)
       Features.push_back("+fullfp16");
   }
 
@@ -377,56 +434,23 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
   // Context sensitive meaning of Crypto:
   // 1) For Arch >= ARMv8.4a:  crypto = sm4 + sha3 + sha2 + aes
   // 2) For Arch <= ARMv8.3a:  crypto = sha2 + aes
-  const auto ItBegin = Features.begin();
-  const auto ItEnd = Features.end();
-  const auto ItRBegin = Features.rbegin();
-  const auto ItREnd = Features.rend();
-  const auto ItRCrypto = std::find(ItRBegin, ItREnd, "+crypto");
-  const auto ItRNoCrypto = std::find(ItRBegin, ItREnd, "-crypto");
-  const auto HasCrypto  = ItRCrypto != ItREnd;
-  const auto HasNoCrypto = ItRNoCrypto != ItREnd;
-  const ptr
diff _t PosCrypto = ItRCrypto - ItRBegin;
-  const ptr
diff _t PosNoCrypto = ItRNoCrypto - ItRBegin;
-
-  bool NoCrypto = false;
-  if (HasCrypto && HasNoCrypto) {
-    if (PosNoCrypto < PosCrypto)
-      NoCrypto = true;
-  }
-
-  if (std::find(ItBegin, ItEnd, "+v8.4a") != ItEnd ||
-      std::find(ItBegin, ItEnd, "+v8.5a") != ItEnd ||
-      std::find(ItBegin, ItEnd, "+v8.6a") != ItEnd ||
-      std::find(ItBegin, ItEnd, "+v8.7a") != ItEnd ||
-      std::find(ItBegin, ItEnd, "+v8.8a") != ItEnd ||
-      std::find(ItBegin, ItEnd, "+v9a") != ItEnd ||
-      std::find(ItBegin, ItEnd, "+v9.1a") != ItEnd ||
-      std::find(ItBegin, ItEnd, "+v9.2a") != ItEnd ||
-      std::find(ItBegin, ItEnd, "+v9.3a") != ItEnd) {
-    if (HasCrypto && !NoCrypto) {
+  if (V8Version >= 4 || V9Version >= 0) {
+    if (HasCrypto && !HasNoCrypto) {
       // Check if we have NOT disabled an algorithm with something like:
       //   +crypto, -algorithm
       // And if "-algorithm" does not occur, we enable that crypto algorithm.
-      const bool HasSM4  = (std::find(ItBegin, ItEnd, "-sm4") == ItEnd);
-      const bool HasSHA3 = (std::find(ItBegin, ItEnd, "-sha3") == ItEnd);
-      const bool HasSHA2 = (std::find(ItBegin, ItEnd, "-sha2") == ItEnd);
-      const bool HasAES  = (std::find(ItBegin, ItEnd, "-aes") == ItEnd);
-      if (HasSM4)
+      if (!HasNoSM4)
         Features.push_back("+sm4");
-      if (HasSHA3)
+      if (!HasNoSHA3)
         Features.push_back("+sha3");
-      if (HasSHA2)
+      if (!HasNoSHA2)
         Features.push_back("+sha2");
-      if (HasAES)
+      if (!HasNoAES)
         Features.push_back("+aes");
     } else if (HasNoCrypto) {
       // Check if we have NOT enabled a crypto algorithm with something like:
       //   -crypto, +algorithm
       // And if "+algorithm" does not occur, we disable that crypto algorithm.
-      const bool HasSM4  = (std::find(ItBegin, ItEnd, "+sm4") != ItEnd);
-      const bool HasSHA3 = (std::find(ItBegin, ItEnd, "+sha3") != ItEnd);
-      const bool HasSHA2 = (std::find(ItBegin, ItEnd, "+sha2") != ItEnd);
-      const bool HasAES  = (std::find(ItBegin, ItEnd, "+aes") != ItEnd);
       if (!HasSM4)
         Features.push_back("-sm4");
       if (!HasSHA3)
@@ -437,24 +461,17 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
         Features.push_back("-aes");
     }
   } else {
-    if (HasCrypto && !NoCrypto) {
-      const bool HasSHA2 = (std::find(ItBegin, ItEnd, "-sha2") == ItEnd);
-      const bool HasAES = (std::find(ItBegin, ItEnd, "-aes") == ItEnd);
-      if (HasSHA2)
+    if (HasCrypto && !HasNoCrypto) {
+      if (!HasNoSHA2)
         Features.push_back("+sha2");
-      if (HasAES)
+      if (!HasNoAES)
         Features.push_back("+aes");
     } else if (HasNoCrypto) {
-      const bool HasSHA2 = (std::find(ItBegin, ItEnd, "+sha2") != ItEnd);
-      const bool HasAES  = (std::find(ItBegin, ItEnd, "+aes") != ItEnd);
-      const bool HasV82a = (std::find(ItBegin, ItEnd, "+v8.2a") != ItEnd);
-      const bool HasV83a = (std::find(ItBegin, ItEnd, "+v8.3a") != ItEnd);
-      const bool HasV84a = (std::find(ItBegin, ItEnd, "+v8.4a") != ItEnd);
       if (!HasSHA2)
         Features.push_back("-sha2");
       if (!HasAES)
         Features.push_back("-aes");
-      if (HasV82a || HasV83a || HasV84a) {
+      if (V8Version == 2 || V8Version == 3) {
         Features.push_back("-sm4");
         Features.push_back("-sha3");
       }
@@ -463,21 +480,15 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
 
   // FIXME: these insertions should ideally be automated using default
   // extensions support from the backend target parser.
-  const char *v8691OrLater[] = {"+v8.6a", "+v8.7a", "+v8.8a",
-                                "+v9.1a", "+v9.2a", "+v9.3a"};
-  auto Pos =
-      std::find_first_of(Features.begin(), Features.end(),
-                         std::begin(v8691OrLater), std::end(v8691OrLater));
-  if (Pos != std::end(Features))
-    Pos = Features.insert(std::next(Pos), {"+i8mm", "+bf16"});
+  if (V8Version >= 6 || V9Version >= 1)
+    Features.insert(std::next(Features.begin() + ArchFeatPos),
+                    {"+i8mm", "+bf16"});
 
   // For Armv8.8-a/Armv9.3-a or later, FEAT_HBC and FEAT_MOPS are enabled by
   // default.
-  const char *v8893OrLater[] = {"+v8.8a", "+v9.3a"};
-  Pos = std::find_first_of(Features.begin(), Features.end(),
-                           std::begin(v8893OrLater), std::end(v8893OrLater));
-  if (Pos != std::end(Features))
-    Pos = Features.insert(std::next(Pos), {"+hbc", "+mops"});
+  if (V8Version >= 8 || V9Version >= 3)
+    Features.insert(std::next(Features.begin() + ArchFeatPos),
+                    {"+hbc", "+mops"});
 
   if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
                                options::OPT_munaligned_access)) {

diff  --git a/clang/test/Driver/aarch64-cpus-2.c b/clang/test/Driver/aarch64-cpus-2.c
index 43e351a27e3fe..1c4f481793173 100644
--- a/clang/test/Driver/aarch64-cpus-2.c
+++ b/clang/test/Driver/aarch64-cpus-2.c
@@ -193,6 +193,122 @@
 // RUN: %clang -target aarch64 -march=armv8.4-a+nofp16+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV84A-NO-FP16-FP16FML %s
 // GENERICV84A-NO-FP16-FP16FML: "-target-feature" "+fp16fml" "-target-feature" "+fullfp16"
 
+// RUN: %clang -target aarch64 -march=armv8.5a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-NO-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.5-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-NO-FP16FML %s
+// GENERICV85A-NO-FP16FML-NOT: "-target-feature" "{{[+-]}}fp16fml"
+// GENERICV85A-NO-FP16FML-NOT: "-target-feature" "{{[+-]}}fullfp16"
+
+// RUN: %clang -target aarch64 -march=armv8.5a+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-FP16 %s
+// RUN: %clang -target aarch64 -march=armv8.5-a+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-FP16 %s
+// GENERICV85A-FP16: "-target-feature" "+fullfp16" "-target-feature" "+fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.5a+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.5-a+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-FP16FML %s
+// GENERICV85A-FP16FML: "-target-feature" "+fp16fml" "-target-feature" "+fullfp16"
+
+// RUN: %clang -target aarch64 -march=armv8.5a+fp16+nofp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-FP16-NO-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.5-a+fp16+nofp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-FP16-NO-FP16FML %s
+// GENERICV85A-FP16-NO-FP16FML: "-target-feature" "+fullfp16" "-target-feature" "-fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.5a+nofp16fml+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-NO-FP16FML-FP16 %s
+// RUN: %clang -target aarch64 -march=armv8.5-a+nofp16fml+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-NO-FP16FML-FP16 %s
+// GENERICV85A-NO-FP16FML-FP16: "-target-feature" "+fullfp16" "-target-feature" "+fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.5a+fp16fml+nofp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-FP16FML-NO-FP16 %s
+// RUN: %clang -target aarch64 -march=armv8.5-a+fp16fml+nofp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-FP16FML-NO-FP16 %s
+// GENERICV85A-FP16FML-NO-FP16: "-target-feature" "-fullfp16" "-target-feature" "-fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.5a+nofp16+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-NO-FP16-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.5-a+nofp16+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-NO-FP16-FP16FML %s
+// GENERICV85A-NO-FP16-FP16FML: "-target-feature" "+fp16fml" "-target-feature" "+fullfp16"
+
+// RUN: %clang -target aarch64 -march=armv8.6a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-NO-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.6-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-NO-FP16FML %s
+// GENERICV86A-NO-FP16FML-NOT: "-target-feature" "{{[+-]}}fp16fml"
+// GENERICV86A-NO-FP16FML-NOT: "-target-feature" "{{[+-]}}fullfp16"
+
+// RUN: %clang -target aarch64 -march=armv8.6a+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-FP16 %s
+// RUN: %clang -target aarch64 -march=armv8.6-a+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-FP16 %s
+// GENERICV86A-FP16: "-target-feature" "+fullfp16" "-target-feature" "+fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.6a+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.6-a+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-FP16FML %s
+// GENERICV86A-FP16FML: "-target-feature" "+fp16fml" "-target-feature" "+fullfp16"
+
+// RUN: %clang -target aarch64 -march=armv8.6a+fp16+nofp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-FP16-NO-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.6-a+fp16+nofp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-FP16-NO-FP16FML %s
+// GENERICV86A-FP16-NO-FP16FML: "-target-feature" "+fullfp16" "-target-feature" "-fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.6a+nofp16fml+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-NO-FP16FML-FP16 %s
+// RUN: %clang -target aarch64 -march=armv8.6-a+nofp16fml+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-NO-FP16FML-FP16 %s
+// GENERICV86A-NO-FP16FML-FP16: "-target-feature" "+fullfp16" "-target-feature" "+fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.6a+fp16fml+nofp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-FP16FML-NO-FP16 %s
+// RUN: %clang -target aarch64 -march=armv8.6-a+fp16fml+nofp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-FP16FML-NO-FP16 %s
+// GENERICV86A-FP16FML-NO-FP16: "-target-feature" "-fullfp16" "-target-feature" "-fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.6a+nofp16+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-NO-FP16-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.6-a+nofp16+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A-NO-FP16-FP16FML %s
+// GENERICV86A-NO-FP16-FP16FML: "-target-feature" "+fp16fml" "-target-feature" "+fullfp16"
+
+// RUN: %clang -target aarch64 -march=armv8.7a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-NO-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.7-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-NO-FP16FML %s
+// GENERICV87A-NO-FP16FML-NOT: "-target-feature" "{{[+-]}}fp16fml"
+// GENERICV87A-NO-FP16FML-NOT: "-target-feature" "{{[+-]}}fullfp16"
+
+// RUN: %clang -target aarch64 -march=armv8.7a+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-FP16 %s
+// RUN: %clang -target aarch64 -march=armv8.7-a+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-FP16 %s
+// GENERICV87A-FP16: "-target-feature" "+fullfp16" "-target-feature" "+fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.7a+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.7-a+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-FP16FML %s
+// GENERICV87A-FP16FML: "-target-feature" "+fp16fml" "-target-feature" "+fullfp16"
+
+// RUN: %clang -target aarch64 -march=armv8.7a+fp16+nofp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-FP16-NO-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.7-a+fp16+nofp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-FP16-NO-FP16FML %s
+// GENERICV87A-FP16-NO-FP16FML: "-target-feature" "+fullfp16" "-target-feature" "-fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.7a+nofp16fml+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-NO-FP16FML-FP16 %s
+// RUN: %clang -target aarch64 -march=armv8.7-a+nofp16fml+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-NO-FP16FML-FP16 %s
+// GENERICV87A-NO-FP16FML-FP16: "-target-feature" "+fullfp16" "-target-feature" "+fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.7a+fp16fml+nofp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-FP16FML-NO-FP16 %s
+// RUN: %clang -target aarch64 -march=armv8.7-a+fp16fml+nofp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-FP16FML-NO-FP16 %s
+// GENERICV87A-FP16FML-NO-FP16: "-target-feature" "-fullfp16" "-target-feature" "-fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.7a+nofp16+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-NO-FP16-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.7-a+nofp16+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV87A-NO-FP16-FP16FML %s
+// GENERICV87A-NO-FP16-FP16FML: "-target-feature" "+fp16fml" "-target-feature" "+fullfp16"
+
+// RUN: %clang -target aarch64 -march=armv8.8a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-NO-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.8-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-NO-FP16FML %s
+// GENERICV88A-NO-FP16FML-NOT: "-target-feature" "{{[+-]}}fp16fml"
+// GENERICV88A-NO-FP16FML-NOT: "-target-feature" "{{[+-]}}fullfp16"
+
+// RUN: %clang -target aarch64 -march=armv8.8a+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-FP16 %s
+// RUN: %clang -target aarch64 -march=armv8.8-a+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-FP16 %s
+// GENERICV88A-FP16: "-target-feature" "+fullfp16" "-target-feature" "+fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.8a+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.8-a+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-FP16FML %s
+// GENERICV88A-FP16FML: "-target-feature" "+fp16fml" "-target-feature" "+fullfp16"
+
+// RUN: %clang -target aarch64 -march=armv8.8a+fp16+nofp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-FP16-NO-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.8-a+fp16+nofp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-FP16-NO-FP16FML %s
+// GENERICV88A-FP16-NO-FP16FML: "-target-feature" "+fullfp16" "-target-feature" "-fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.8a+nofp16fml+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-NO-FP16FML-FP16 %s
+// RUN: %clang -target aarch64 -march=armv8.8-a+nofp16fml+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-NO-FP16FML-FP16 %s
+// GENERICV88A-NO-FP16FML-FP16: "-target-feature" "+fullfp16" "-target-feature" "+fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.8a+fp16fml+nofp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-FP16FML-NO-FP16 %s
+// RUN: %clang -target aarch64 -march=armv8.8-a+fp16fml+nofp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-FP16FML-NO-FP16 %s
+// GENERICV88A-FP16FML-NO-FP16: "-target-feature" "-fullfp16" "-target-feature" "-fp16fml"
+
+// RUN: %clang -target aarch64 -march=armv8.8a+nofp16+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-NO-FP16-FP16FML %s
+// RUN: %clang -target aarch64 -march=armv8.8-a+nofp16+fp16fml -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV88A-NO-FP16-FP16FML %s
+// GENERICV88A-NO-FP16-FP16FML: "-target-feature" "+fp16fml" "-target-feature" "+fullfp16"
+
 // RUN: %clang -target aarch64 -march=armv8.5a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A %s
 // RUN: %clang -target aarch64 -march=armv8.5-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A %s
 // RUN: %clang -target aarch64 -mlittle-endian -march=armv8.5a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A %s
@@ -209,9 +325,6 @@
 // RUN: %clang -target aarch64_be -mbig-endian -march=armv8.5-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-BE %s
 // GENERICV85A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.5a"
 
-// RUN: %clang -target aarch64 -march=armv8.5-a+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV85A-FP16 %s
-// GENERICV85A-FP16: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.5a" "-target-feature" "+fullfp16"
-
 // RUN: %clang -target aarch64 -march=armv8.6a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A %s
 // RUN: %clang -target aarch64 -march=armv8.6-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A %s
 // RUN: %clang -target aarch64 -mlittle-endian -march=armv8.6a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV86A %s

diff  --git a/clang/test/Preprocessor/aarch64-target-features.c b/clang/test/Preprocessor/aarch64-target-features.c
index e947aab1efaf4..ff7e06284a072 100644
--- a/clang/test/Preprocessor/aarch64-target-features.c
+++ b/clang/test/Preprocessor/aarch64-target-features.c
@@ -294,7 +294,7 @@
 // CHECK-MCPU-CARMEL: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+v8.2a" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" "+fullfp16" "-target-feature" "+ras" "-target-feature" "+lse" "-target-feature" "+rdm" "-target-feature" "+sha2" "-target-feature" "+aes"
 
 // RUN: %clang -target x86_64-apple-macosx -arch arm64 -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH-ARM64 %s
-// CHECK-ARCH-ARM64: "-target-cpu" "apple-m1" "-target-feature" "+v8.5a" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" "+dotprod" "-target-feature" "+fp16fml" "-target-feature" "+ras" "-target-feature" "+lse" "-target-feature" "+rdm" "-target-feature" "+rcpc" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-feature" "+fullfp16" "-target-feature" "+sm4" "-target-feature" "+sha3" "-target-feature" "+sha2" "-target-feature" "+aes"
+// CHECK-ARCH-ARM64: "-target-cpu" "apple-m1" "-target-feature" "+v8.5a" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" "+dotprod" "-target-feature" "+fullfp16" "-target-feature" "+ras" "-target-feature" "+lse" "-target-feature" "+rdm" "-target-feature" "+rcpc" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-feature" "+fp16fml" "-target-feature" "+sm4" "-target-feature" "+sha3" "-target-feature" "+sha2" "-target-feature" "+aes"
 
 // RUN: %clang -target x86_64-apple-macosx -arch arm64_32 -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH-ARM64_32 %s
 // CHECK-ARCH-ARM64_32: "-target-cpu" "apple-s4" "-target-feature" "+v8.3a" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" "+fullfp16" "-target-feature" "+ras" "-target-feature" "+lse" "-target-feature" "+rdm" "-target-feature" "+rcpc" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-feature" "+sha2" "-target-feature" "+aes"


        


More information about the cfe-commits mailing list