[clang] b6ce860 - [Driver][VE] Change to enable VPU flag by default
Kazushi Marukawa via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 31 08:41:44 PDT 2023
Author: Kazushi (Jam) Marukawa
Date: 2023-09-01T00:41:38+09:00
New Revision: b6ce860024013397982cdd26b762df8182b14df9
URL: https://github.com/llvm/llvm-project/commit/b6ce860024013397982cdd26b762df8182b14df9
DIFF: https://github.com/llvm/llvm-project/commit/b6ce860024013397982cdd26b762df8182b14df9.diff
LOG: [Driver][VE] Change to enable VPU flag by default
Change to enable VPU flag for VE by default in order to support vector
intrinsics from clang.
Reviewed By: efocht, MaskRay
Differential Revision: https://reviews.llvm.org/D157813
Added:
clang/test/Driver/ve-features.c
Modified:
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Arch/VE.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index b8b02af9f35f0c..3d73e24a4dc5af 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -199,6 +199,8 @@ def m_x86_Features_Group : OptionGroup<"<x86 features group>">,
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 @@ def mno_scatter : Flag<["-"], "mno-scatter">, Group<m_x86_Features_Group>,
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.
diff --git a/clang/lib/Driver/ToolChains/Arch/VE.cpp b/clang/lib/Driver/ToolChains/Arch/VE.cpp
index 97d74eb4e5efd0..b19760898c6477 100644
--- a/clang/lib/Driver/ToolChains/Arch/VE.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/VE.cpp
@@ -18,4 +18,9 @@ using namespace clang;
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");
+}
diff --git a/clang/test/Driver/ve-features.c b/clang/test/Driver/ve-features.c
new file mode 100644
index 00000000000000..5e233b0893a3cf
--- /dev/null
+++ b/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"
More information about the cfe-commits
mailing list