[clang] [X86][clang-cl] Add CL option /vlen (PR #166375)

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 7 04:34:32 PST 2025


================
@@ -8266,6 +8266,31 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType,
                                                      << "/kernel";
  }
 
+  if (const Arg *A = Args.getLastArg(options::OPT__SLASH_vlen,
+                                     options::OPT__SLASH_vlen_EQ_256,
+                                     options::OPT__SLASH_vlen_EQ_512)) {
+    llvm::SmallSet<std::string, 4> Arch512 = {"AVX512F", "AVX512"};
+    llvm::SmallSet<std::string, 4> Arch256 = {"AVX", "AVX2"};
+
+    StringRef Arch = Args.getLastArgValue(options::OPT__SLASH_arch);
+
+    if (A->getOption().matches(options::OPT__SLASH_vlen_EQ_512)) {
+      if (Arch512.contains(Arch.str()))
----------------
zmodem wrote:

Since the set is so small, and only used here, I think just open-coding the logic would be easier:

`if (Arch == "AVX512" || Arch == "AVX512F")`

Same for the Arch256 set below.

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


More information about the cfe-commits mailing list