[PATCH] D83079: [clang] Default target features implied by `-march` on AArch64.

Sander de Smalen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 2 14:36:21 PDT 2020


sdesmalen added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Arch/AArch64.cpp:118
+  case llvm::AArch64::ArchKind::ARMV8_6A:
+    Features.push_back("+i8mm");
+    Features.push_back("+bf16");
----------------
Looking at what Clang emits for e.g. `-march=armv8.5-a`, it just adds a target-feature `+v8.5a`. The definitions in `llvm/lib/Target/AArch64/AArch64.td`. suggests that LLVM is already able to infer all supported features from that. e.g.
```
def HasV8_4aOps : SubtargetFeature<
   :
   :

def HasV8_5aOps : SubtargetFeature<
  "v8.5a", "HasV8_5aOps", "true", "Support ARM v8.5a instructions",
  [HasV8_4aOps, FeatureAltFPCmp, FeatureFRInt3264, FeatureSpecRestrict,
   FeatureSSBS, FeatureSB, FeaturePredRes, FeatureCacheDeepPersist,
   FeatureBranchTargetId]>;

def HasV8_6aOps : SubtargetFeature<
  "v8.6a", "HasV8_6aOps", "true", "Support ARM v8.6a instructions",

  [HasV8_5aOps, FeatureAMVS, FeatureBF16, FeatureFineGrainedTraps,
   FeatureEnhancedCounterVirtualization, FeatureMatMulInt8]>;
```
So I don't think you necessarily have to decompose the architecture version into target-features in the Clang driver as well. For Clang it matters that the right set of feature macros are defined so that the ACLE header file exposes the correct set of functions for the given architecture version. At least for the SVE ACLE that is just a small handful of features.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83079





More information about the cfe-commits mailing list