[compiler-rt] [llvm] [clang] [X86] Support more ISAs to enable __builtin_cpu_supports (PR #79086)

Freddy Ye via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 30 01:29:24 PST 2024


================
@@ -750,13 +750,16 @@ unsigned llvm::X86::getFeaturePriority(ProcessorFeatures Feat) {
 #ifndef NDEBUG
   // Check that priorities are set properly in the .def file. We expect that
   // "compat" features are assigned non-duplicate consecutive priorities
-  // starting from zero (0, 1, ..., num_features - 1).
+  // starting from one (1, ..., 37) and multiple zeros.
 #define X86_FEATURE_COMPAT(ENUM, STR, PRIORITY) PRIORITY,
   unsigned Priorities[] = {
 #include "llvm/TargetParser/X86TargetParser.def"
   };
   std::array<unsigned, std::size(Priorities)> HelperList;
-  std::iota(HelperList.begin(), HelperList.end(), 0);
+  const size_t MaxPriority = 37;
+  std::iota(HelperList.begin(), HelperList.begin() + MaxPriority + 1, 0);
+  for (int i = MaxPriority + 1; i != std::size(Priorities); ++i)
----------------
FreddyLeaf wrote:

5922fc9

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


More information about the cfe-commits mailing list