[clang] [flang]Add vscale argument parsing (PR #67676)

Mats Petersson via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 29 08:43:19 PDT 2023


================
@@ -170,6 +169,38 @@ void Flang::addPicOptions(const ArgList &Args, ArgStringList &CmdArgs) const {
   }
 }
 
+void Flang::AddAArch64TargetArgs(const ArgList &Args,
+                                 ArgStringList &CmdArgs) const {
+  // Handle -msve_vector_bits=<bits>
+  if (Arg *A = Args.getLastArg(options::OPT_msve_vector_bits_EQ)) {
+    StringRef Val = A->getValue();
+    const Driver &D = getToolChain().getDriver();
+    if (Val.equals("128") || Val.equals("256") || Val.equals("512") ||
+        Val.equals("1024") || Val.equals("2048") || Val.equals("128+") ||
+        Val.equals("256+") || Val.equals("512+") || Val.equals("1024+") ||
+        Val.equals("2048+")) {
+      unsigned Bits = 0;
+      if (Val.endswith("+"))
+        Val = Val.substr(0, Val.size() - 1);
----------------
Leporacanthicus wrote:

That's copied directly from clang, and I think it's better to keep them identical [although I did modify the [[maybe_unused]] from (void) in the check if the conversion worked.

[There's about 200 lines AROUND this bit, that does a bunch of other target-specific stuff for aarch64, so I can't just call the clang version of this code]

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


More information about the cfe-commits mailing list