================ @@ -1363,19 +1363,28 @@ static llvm::X86::ProcessorFeatures getFeature(StringRef Name) { // correct, so it asserts if the value is out of range. } -unsigned X86TargetInfo::multiVersionSortPriority(StringRef Name) const { - // Valid CPUs have a 'key feature' that compares just better than its key - // feature. - using namespace llvm::X86; - CPUKind Kind = parseArchX86(Name); - if (Kind != CK_None) { - ProcessorFeatures KeyFeature = getKeyFeature(Kind); - return (getFeaturePriority(KeyFeature) << 1) + 1; - } - - // Now we know we have a feature, so get its priority and shift it a few so - // that we have sufficient room for the CPUs (above). - return getFeaturePriority(getFeature(Name)) << 1; +unsigned X86TargetInfo::getFMVPriority(ArrayRef<StringRef> Features) const { + auto getPriority = [this](StringRef Feature) -> unsigned { + if (Feature.empty()) + return 0; + + // Valid CPUs have a 'key feature' that compares just better than its key + // feature. + using namespace llvm::X86; + CPUKind Kind = parseArchX86(Feature); + if (Kind != CK_None) { + ProcessorFeatures KeyFeature = getKeyFeature(Kind); + return (getFeaturePriority(KeyFeature) << 1) + 1; + } + // Now we know we have a feature, so get its priority and shift it a few so + // that we have sufficient room for the CPUs (above). + return getFeaturePriority(getFeature(Feature)) << 1; + }; + + unsigned Priority = 0; + for (StringRef Feature : Features) + Priority = std::max(Priority, getPriority(Feature)); ---------------- labrinea wrote:
My aim was for this to be NFC. Does it look different from what TargetMVPriority did in the old code? The old multiVersionSortPriority is now the above lambda. https://github.com/llvm/llvm-project/pull/116257 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits