[Hexagon] Enable auto-vectorization only when -fvectorize was given

llvm-svn: 329923
This commit is contained in:
Krzysztof Parzyszek 2018-04-12 16:25:35 +00:00
parent 8aa6cd5cb9
commit e4b0b6e374
2 changed files with 14 additions and 0 deletions

View File

@ -520,6 +520,13 @@ void HexagonToolChain::addClangTargetOptions(const ArgList &DriverArgs,
CC1Args.push_back("-target-feature");
CC1Args.push_back("+reserved-r19");
}
if (Arg *A = DriverArgs.getLastArg(options::OPT_fvectorize,
options::OPT_fno_vectorize)) {
if (A->getOption().matches(options::OPT_fvectorize)) {
CC1Args.push_back("-mllvm");
CC1Args.push_back("-hexagon-autohvx");
}
}
}
void HexagonToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,

View File

@ -0,0 +1,7 @@
// RUN: %clang -target hexagon -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT
// RUN: %clang -target hexagon -fvectorize -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-VECTOR
// RUN: %clang -target hexagon -fvectorize -fno-vectorize -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-NOVECTOR
// CHECK-DEFAULT-NOT: hexagon-autohvx
// CHECK-VECTOR: "-mllvm" "-hexagon-autohvx"
// CHECK-NOVECTOR-NOT: hexagon-autohvx