[PATCH] D120111: [AArch64] Default HBC/MOPS features in clang

Son Tuan Vu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 20 23:29:14 PST 2022


tyb0807 marked 2 inline comments as done.
tyb0807 added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Arch/AArch64.cpp:464-473
+  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(Archs), std::end(Archs));
+                                std::begin(v8691OrLater), std::end(v8691OrLater));
   if (Pos != std::end(Features))
     Pos = Features.insert(std::next(Pos), {"+i8mm", "+bf16"});
 
----------------
nickdesaulniers wrote:
> Is it possible to re-use some of the many calls to std::find (L395-403)? Seems like we re-scan the feature list A LOT.
I cached the architecture feature when it is defined to avoid these calls to std::find.


================
Comment at: clang/lib/Driver/ToolChains/Arch/AArch64.cpp:466-474
   auto Pos = std::find_first_of(Features.begin(), Features.end(),
-                                std::begin(Archs), std::end(Archs));
+                                std::begin(v8691OrLater), std::end(v8691OrLater));
   if (Pos != std::end(Features))
     Pos = Features.insert(std::next(Pos), {"+i8mm", "+bf16"});
 
+  // For Armv8.8-a/Armv9.3-a or later, FEAT_HBC and FEAT_MOPS are enabled by
+  // default.
----------------
nickdesaulniers wrote:
> Can we reuse `ItBegin` and `ItEnd` here rather than `Features.begin()` and `Features.end()`?
This is not relevant anymore, but for the initial code, I guess we can't reuse `ItBegin/End` because `Features` has been changed since then (a lot of `push_back`). The reason why we need to keep these default features (`+hbc`, `+mops`, ...) //right after //the architecture feature is that we want to be able to disable the default features `X` if `+noX` option is given in the command line, knowing that `+noX` features will come after the architecture feature in the `Features` list.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120111



More information about the cfe-commits mailing list