[clang] [X86][RFC] Support AVX10 options (PR #67278)

Phoebe Wang via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 18 00:31:08 PDT 2023


================
@@ -130,17 +131,35 @@ bool X86TargetInfo::initFeatureMap(
       continue;
     }
 
-    if (!HasAVX512F && Feature.substr(0, 7) == "+avx512")
+    if (Feature.substr(0, 7) == "+avx10.") {
+      HasAVX10 = true;
       HasAVX512F = true;
-    if (HasAVX512F && Feature == "-avx512f")
+      if (Feature.substr(Feature.size() - 3, 3) == "512") {
+        HasEVEX512 = true;
+      } else if (Feature.substr(7, 2) == "1-") {
+        HasEVEX512 = false;
+      }
+    } else if (!HasAVX512F && Feature.substr(0, 7) == "+avx512") {
+      HasAVX512F = true;
+    } else if (HasAVX512F && Feature == "-avx512f") {
+      HasAVX512F = false;
+    } else if (HasAVX10 && Feature == "-avx10.1-256") {
+      HasAVX10 = false;
       HasAVX512F = false;
-    if (HasEVEX512 && Feature == "-evex512")
+    } else if (!HasEVEX512 && Feature == "+evex512") {
+      HasEVEX512 = true;
+    } else if (HasEVEX512 && Feature == "-avx10.1-512") {
----------------
phoebewang wrote:

Yes and no.
We have already filtered this case (and cases like this in prior features) in the driver. Only the last argument will be passed to Clang if there are both positive and negative set in command line. So it won't turn into `+avx10.1-256`.
Function attrribute is another story, we seldom use negative features in function attrribute, and if we use, yes, it will enable features it implies. I think it makes sense that the attrribute turns off itself rather than features command line enabled. See a precedent https://godbolt.org/z/xKWfvEWY7

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


More information about the cfe-commits mailing list