Skip to content

Commit b6ce860

Browse files
committed
[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
1 parent 12da8ef commit b6ce860

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ def m_x86_Features_Group : OptionGroup<"<x86 features group>">,
199199
DocName<"X86">;
200200
def m_riscv_Features_Group : OptionGroup<"<riscv features group>">,
201201
Group<m_Group>, DocName<"RISC-V">;
202+
def m_ve_Features_Group : OptionGroup<"<ve features group>">,
203+
Group<m_Group>, DocName<"VE">;
202204

203205
def m_libc_Group : OptionGroup<"<m libc group>">, Group<m_mips_Features_Group>,
204206
Flags<[HelpHidden]>;
@@ -5845,6 +5847,13 @@ def mno_scatter : Flag<["-"], "mno-scatter">, Group<m_x86_Features_Group>,
58455847
HelpText<"Disable generation of scatter instructions in auto-vectorization(x86 only)">;
58465848
} // let Flags = [TargetSpecific]
58475849

5850+
// VE feature flags
5851+
let Flags = [TargetSpecific] in {
5852+
def mvevpu : Flag<["-"], "mvevpu">, Group<m_ve_Features_Group>,
5853+
HelpText<"Emit VPU instructions for VE">;
5854+
def mno_vevpu : Flag<["-"], "mno-vevpu">, Group<m_ve_Features_Group>;
5855+
} // let Flags = [TargetSpecific]
5856+
58485857
// These are legacy user-facing driver-level option spellings. They are always
58495858
// aliases for options that are spelled using the more common Unix / GNU flag
58505859
// style of double-dash and equals-joined flags.

clang/lib/Driver/ToolChains/Arch/VE.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ using namespace clang;
1818
using namespace llvm::opt;
1919

2020
void ve::getVETargetFeatures(const Driver &D, const ArgList &Args,
21-
std::vector<StringRef> &Features) {}
21+
std::vector<StringRef> &Features) {
22+
if (Args.hasFlag(options::OPT_mvevpu, options::OPT_mno_vevpu, true))
23+
Features.push_back("+vpu");
24+
else
25+
Features.push_back("-vpu");
26+
}

clang/test/Driver/ve-features.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %clang --target=ve-unknown-linux-gnu -### %s 2>&1 | FileCheck %s -check-prefix=DEFAULT
2+
// RUN: %clang --target=ve-unknown-linux-gnu -### %s -mvevpu -mno-vevpu 2>&1 | FileCheck %s -check-prefix=NO-VEVPU
3+
4+
// DEFAULT: "-target-feature" "+vpu"
5+
// NO-VEVPU: "-target-feature" "-vpu"

0 commit comments

Comments
 (0)