[PATCH] D157813: [Driver][VE] Change to enable VPU flag by default

Kazushi Marukawa via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 31 08:41:55 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb6ce86002401: [Driver][VE] Change to enable VPU flag by default (authored by kaz7).

Changed prior to commit:
  https://reviews.llvm.org/D157813?vs=554742&id=555063#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157813/new/

https://reviews.llvm.org/D157813

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Arch/VE.cpp
  clang/test/Driver/ve-features.c


Index: clang/test/Driver/ve-features.c
===================================================================
--- /dev/null
+++ clang/test/Driver/ve-features.c
@@ -0,0 +1,5 @@
+// RUN: %clang --target=ve-unknown-linux-gnu -### %s 2>&1 | FileCheck %s -check-prefix=DEFAULT
+// RUN: %clang --target=ve-unknown-linux-gnu -### %s -mvevpu -mno-vevpu 2>&1 | FileCheck %s -check-prefix=NO-VEVPU
+
+// DEFAULT: "-target-feature" "+vpu"
+// NO-VEVPU: "-target-feature" "-vpu"
Index: clang/lib/Driver/ToolChains/Arch/VE.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Arch/VE.cpp
+++ clang/lib/Driver/ToolChains/Arch/VE.cpp
@@ -18,4 +18,9 @@
 using namespace llvm::opt;
 
 void ve::getVETargetFeatures(const Driver &D, const ArgList &Args,
-                             std::vector<StringRef> &Features) {}
+                             std::vector<StringRef> &Features) {
+  if (Args.hasFlag(options::OPT_mvevpu, options::OPT_mno_vevpu, true))
+    Features.push_back("+vpu");
+  else
+    Features.push_back("-vpu");
+}
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -199,6 +199,8 @@
                            DocName<"X86">;
 def m_riscv_Features_Group : OptionGroup<"<riscv features group>">,
                              Group<m_Group>, DocName<"RISC-V">;
+def m_ve_Features_Group : OptionGroup<"<ve features group>">,
+                          Group<m_Group>, DocName<"VE">;
 
 def m_libc_Group : OptionGroup<"<m libc group>">, Group<m_mips_Features_Group>,
                    Flags<[HelpHidden]>;
@@ -5845,6 +5847,13 @@
                   HelpText<"Disable generation of scatter instructions in auto-vectorization(x86 only)">;
 } // let Flags = [TargetSpecific]
 
+// VE feature flags
+let Flags = [TargetSpecific] in {
+def mvevpu : Flag<["-"], "mvevpu">, Group<m_ve_Features_Group>,
+  HelpText<"Emit VPU instructions for VE">;
+def mno_vevpu : Flag<["-"], "mno-vevpu">, Group<m_ve_Features_Group>;
+} // let Flags = [TargetSpecific]
+
 // These are legacy user-facing driver-level option spellings. They are always
 // aliases for options that are spelled using the more common Unix / GNU flag
 // style of double-dash and equals-joined flags.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157813.555063.patch
Type: text/x-patch
Size: 2355 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230831/87d41849/attachment.bin>


More information about the cfe-commits mailing list