[clang] [compiler-rt] [llvm] [X86] Support APXF to enable __builtin_cpu_supports. (PR #80636)

Freddy Ye via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 6 22:46:35 PST 2024


================
@@ -1845,6 +1845,7 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features) {
   Features["prefetchi"]  = HasLeaf7Subleaf1 && ((EDX >> 14) & 1);
   Features["usermsr"]  = HasLeaf7Subleaf1 && ((EDX >> 15) & 1);
   Features["avx10.1-256"] = HasLeaf7Subleaf1 && ((EDX >> 19) & 1);
+  Features["apxf"] = HasLeaf7Subleaf1 && ((EDX >> 21) & 1);
----------------
FreddyLeaf wrote:

> My understanding is "apxf" here is used by front-end for FMV, right?

Yes, not only FMV, but also __builtin_cpu_supports.
> What would happen if there is "apxf" in the IR after this patch?

if llc read "apxf" in attribute, I think a warning will be given like:
```
'+apxf' is not a recognized feature for this target (ignoring feature)
```
But such attribute won't be generated from frontend, because we didn't add logics for "apxf" in X86TargetInfo::hasFeature.

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


More information about the cfe-commits mailing list