[clang] [Clang] Bring initFeatureMap back to AArch64TargetInfo. (PR #96832)

weiwei chen via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 27 10:58:55 PDT 2024


weiweichen wrote:

> The only thing `AArch64TargetInfo::initFeatureMap` adds is features from the selected CPU. IMHO this was not an appropriate place to be doing that. Since #94279 the CPU features are added either by `AArch64TargetInfo::parseTargetAttr` when dealing with `__attribute(target(...))`, and by `getAArch64ArchFeaturesFromMcpu` if you are in the clang driver dealing with `-mcpu`. Basically anywhere you see `AArch64::ExtensionSet::addCPUDefaults` used. This approach properly handles feature dependencies, which the old `AArch64TargetInfo::initFeatureMap` approach did not.
> 
> What inputs are you giving when you create the `TargetInfo`? What features do you expect to see that are missing? A concrete example would help to understand.


We are using `llvm::sys::getDefaultTargetTriple()` and `llvm::sys::getHostCPUName()` to get TargetInfo, and was getting 👇 features before the aarch64 PR landed. (We still get features correctly for other backends).

```
+aes +bf16 +complxnum +crc +dotprod +fp-armv8 +fp16fml +fullfp16 +i8mm +jsconv +lse +neon +pauth +rand +ras +rcpc +rdm +sha2 +sha3 +sm4 +spe +ssbs +sve
```

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


More information about the cfe-commits mailing list