[PATCH] D157813: [Driver][VE] Support VPU flag as a feature for VE
Kazushi Marukawa via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 30 08:42:16 PDT 2023
kaz7 updated this revision to Diff 554742.
kaz7 added a comment.
By using hasFlag, change to enable VPU flag for VE by default again.
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
@@ -202,6 +202,8 @@
Group<m_Group>, Flags<[CoreOption]>, 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]>;
@@ -5160,6 +5162,13 @@
def mno_vzeroupper : Flag<["-"], "mno-vzeroupper">, Group<m_x86_Features_Group>;
} // 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.554742.patch
Type: text/x-patch
Size: 2367 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230830/e4cabb90/attachment-0001.bin>
More information about the cfe-commits
mailing list