[clang] [X86][AVX10] Permit AVX512 options/features used together with AVX10 (PR #71318)

Shengchen Kan via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 8 17:42:36 PST 2023


================
@@ -131,35 +135,50 @@ bool X86TargetInfo::initFeatureMap(
       continue;
     }
 
-    if (Feature.substr(0, 7) == "+avx10.") {
-      HasAVX10 = true;
-      HasAVX512F = true;
-      if (Feature.substr(Feature.size() - 3, 3) == "512") {
-        HasEVEX512 = true;
-      } else if (Feature.substr(7, 2) == "1-") {
-        HasEVEX512 = false;
+    if (Feature.substr(1, 6) == "avx10.") {
+      if (Feature[0] == '+') {
+        HasAVX10 = true;
+        if (Feature.substr(Feature.size() - 3, 3) == "512")
+          HasAVX10_512 = true;
+        LastAVX10 = Feature;
+      } else if (HasAVX10 && Feature == "-avx10.1-256") {
+        HasAVX10 = false;
+        HasAVX10_512 = false;
+      } else if (HasAVX10_512 && Feature == "-avx10.1-512") {
+        HasAVX10_512 = false;
       }
+      // Postpone AVX10 features handling after AVX512 settled.
+      UpdatedAVX10FeaturesVec.push_back(Feature);
+      continue;
     } else if (!HasAVX512F && Feature.substr(0, 7) == "+avx512") {
       HasAVX512F = true;
+      LastAVX512 = Feature;
     } else if (HasAVX512F && Feature == "-avx512f") {
       HasAVX512F = false;
-    } else if (HasAVX10 && Feature == "-avx10.1-256") {
-      HasAVX10 = false;
-      HasAVX512F = false;
-    } else if (!HasEVEX512 && Feature == "+evex512") {
+    } else if (HasEVEX512 != true && Feature == "+evex512") {
----------------
KanRobert wrote:

Comparing a int value with `true` and `false` may be confusing. I suggest "std::optional<bool>"

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


More information about the cfe-commits mailing list