[clang] [llvm] [NFC][clang][FMV][TargetInfo] Refactor API for FMV feature priority. (PR #116257)
Jon Roelofs via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 15 13:08:26 PST 2024
================
@@ -48,6 +48,19 @@ std::optional<AArch64::ArchInfo> AArch64::ArchInfo::findBySubArch(StringRef SubA
return {};
}
+unsigned AArch64::getFMVPriority(ArrayRef<StringRef> Features) {
+ constexpr unsigned MaxFMVPriority = 1000;
+ unsigned Priority = 0;
+ unsigned NumFeatures = 0;
+ for (StringRef Feature : Features) {
+ if (auto Ext = parseFMVExtension(Feature)) {
+ Priority = std::max(Priority, Ext->Priority);
+ NumFeatures++;
+ }
+ }
+ return Priority + MaxFMVPriority * NumFeatures;
----------------
jroelofs wrote:
We should probably clarify and/or fix the spec, both orders seem like valid interpretations to me, as there isn't a definition for how to calculate the priority when a version has more than one feature:
> 6.4.3 Selection [^](https://arm-software.github.io/acle/main/acle.html#markdown-toc-selection)
>
> The following rules shall be followed by all implementations:
>
> 1. Implementation of the selection algorithm is platform dependent, where with platform means CPU/Vendor/OS as in the target triplet.
> 1. The selection is permanent for the lifetime of the process.
> 1. Only those versions could be considered where all dependent features are available.
>
> Rules of version selection are in order:
>
> 1. Select the most specific version else
> 1. select the version with the highest priority else
> 1. "default" is selected if no other versions are suitable.
should we ping the gcc folks and get their read on a) how it works for them now, and b) how it should work going forward?
https://github.com/llvm/llvm-project/pull/116257
More information about the cfe-commits
mailing list