[PATCH] D123296: [llvm][AArch64] Generate getExtensionFeatures from the list of extensions

David Spickett via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 7 03:32:00 PDT 2022


DavidSpickett added reviewers: amilendra, tmatheson.
DavidSpickett added a comment.

The background here is that I want to automate what I did in https://reviews.llvm.org/D121999 and thought I could do that by passing 0xf...f to getExtensionFeatures.

I thought there might be some reason to not list them all but considering that things like mte were missing I don't think there is. More likely that any time we were adding something like +mte we went through a different function in the target parser.



================
Comment at: clang/test/Preprocessor/aarch64-target-features.c:288
+// CHECK-MCPU-CORTEX-A73: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+v8a" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" "+fp-armv8" "-target-feature" "+neon"
+// CHECK-MCPU-CORTEX-R82: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+v8r" "-target-feature" "+crc" "-target-feature" "+lse" "-target-feature" "+rdm" "-target-feature" "+dotprod" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+fp16fml" "-target-feature" "+ras" "-target-feature" "+rcpc" "-target-feature" "+ssbs" "-target-feature" "+sb" "-target-feature" "+fullfp16"
+// CHECK-MCPU-M3: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+v8a" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" "+fp-armv8" "-target-feature" "+neon"
----------------
Some of the ordering has changed and that means some tests look for new features. The CPU already had these features, the test just didn't check for them before and now they've been inserted into what it's looking for.

We could change all these to look for the exact feature set but to be conservative I stuck to re-ordering them and adding just enough to get them passing again.


================
Comment at: llvm/lib/Support/AArch64TargetParser.cpp:69
+  if (Extensions & ID) {                                                       \
+    const char *feature = FEATURE;                                             \
+    /* INVALID and NONE have no feature name. */                               \
----------------
This looks a bit strange but you can't do:
```
Features.push_back(FEATURE);
```
Because you get:
```
Features.push_back(nullptr);
```
Which calls a deleted constructor, and we don't want empty feature strings in any case.

So that's why I assign it to something so that the `push_back` line can still be compiled.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123296



More information about the cfe-commits mailing list