[clang] [FMV][AIX] Implement target_clones part 2 (target-features) (PR #206786)
Wael Yehia via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 30 17:08:11 PDT 2026
w2yehia wrote:
Had an offline discussion with @RolandF77 :
At the moment, each clone can have exactly one property: a cpu or a target-feature,
but in some cases this causes an error when one of the listed features requires a higher CPU than the default CPU (whether it's the compiler default or what's specified via -mcpu).
For example the following fails to compile without `-mcpu=pwr10`:
```
__attribute__((target_clones("prefixed", "default")))
int foo(void) { return 0; }
> clang --target=powerpc64-ibm-aix-xcoff t.c -S -mcpu=pwr9
error: option '-mprefixed' cannot be specified without '-mcpu=pwr10'
```
Forcing the user to specfiy a higher CPU that would affect codegen for the entire CU is undesirable.
Improvements to consider:
1) feature requiring a minimum CPU will automatically upgrade the target-cpu for the clone to the minimum needed.
or
2) allow specifying a cpu and a feature requirement per version:
```
__attribute__((target_clones("cpu=pwr10,prefixed","default")))
```
https://github.com/llvm/llvm-project/pull/206786
More information about the cfe-commits
mailing list