[clang] [llvm] [AArch64][FMV] Add missing feature dependencies and detect at runtime. (PR #119231)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 05:26:55 PST 2024


================
@@ -61,13 +61,13 @@ unsigned AArch64::getFMVPriority(ArrayRef<StringRef> Features) {
   return Priority + MaxFMVPriority * NumFeatures;
 }
 
-uint64_t AArch64::getCpuSupportsMask(ArrayRef<StringRef> FeatureStrs) {
-  uint64_t FeaturesMask = 0;
-  for (const StringRef &FeatureStr : FeatureStrs) {
-    if (auto Ext = parseFMVExtension(FeatureStr))
-      FeaturesMask |= (1ULL << Ext->Bit);
-  }
-  return FeaturesMask;
+uint64_t AArch64::getCpuSupportsMask(ArrayRef<StringRef> Features) {
+  ExtensionSet FeatureBits;
+  for (StringRef Feature : Features)
+    if (auto Ext = parseFMVExtension(Feature))
+      if (Ext->ID)
+        FeatureBits.enable(*Ext->ID);
----------------
sdesmalen-arm wrote:

Not sure if it's me, but I find the wording/lingo used for these interfaces, variables and types rather confusing.
* `FeatureBits` seems to suggest it is a bitmask that relates to features.
* Then its type `ExtensionSet` suggests it's about extensions.
* The parsed extension, enables an `ArchKind` (along with all transitively implied `ArchKind`s).
* Finally, the function returns a bit mask which according to the description expresses which CPUFeatures are set.
The description of `getCpuSupportsMask` is even more confusing:

```
For given feature names, return a bitmask corresponding to the entries of
AArch64::CPUFeatures. The values in CPUFeatures are not bitmasks
themselves, they are sequential (0, 1, 2, 3, ...).
```

What is CPUFeatures? Is this an enum? Are those values define publicly in the ACLE/ABI?

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


More information about the llvm-commits mailing list