def err_drv_invalid_hvx_length : Error<
"-mhvx-length is not supported without a -mhvx/-mhvx= flag">;
+def warn_drv_vectorize_needs_hvx : Warning<
+ "auto-vectorization requires HVX, use -mhvx to enable it">,
+ InGroup<OptionIgnored>;
def err_drv_modules_validate_once_requires_timestamp : Error<
"option '-fmodules-validate-once-per-build-session' requires "
Features.push_back(UseLongCalls ? "+long-calls" : "-long-calls");
- bool HasHVX(false);
+ bool HasHVX = false;
handleHVXTargetFeatures(D, Args, Features, HasHVX);
+
+ if (HexagonToolChain::isAutoHVXEnabled(Args) && !HasHVX)
+ D.Diag(diag::warn_drv_vectorize_needs_hvx);
}
// Hexagon tools start.
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");
- }
+ if (isAutoHVXEnabled(DriverArgs)) {
+ CC1Args.push_back("-mllvm");
+ CC1Args.push_back("-hexagon-autohvx");
}
}
return ToolChain::CST_Libstdcxx;
}
+bool HexagonToolChain::isAutoHVXEnabled(const llvm::opt::ArgList &Args) {
+ if (Arg *A = Args.getLastArg(options::OPT_fvectorize,
+ options::OPT_fno_vectorize))
+ return A->getOption().matches(options::OPT_fvectorize);
+ return false;
+}
+
//
// Returns the default CPU for Hexagon. This is the default compilation target
// if no Hexagon processor is selected at the command-line.
void getHexagonLibraryPaths(const llvm::opt::ArgList &Args,
ToolChain::path_list &LibPaths) const;
+ static bool isAutoHVXEnabled(const llvm::opt::ArgList &Args);
static const StringRef GetDefaultCPU();
static const StringRef GetTargetCPUVersion(const llvm::opt::ArgList &Args);
// 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
+// RUN: %clang -target hexagon -fvectorize -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-NEEDHVX
// CHECK-DEFAULT-NOT: hexagon-autohvx
// CHECK-VECTOR: "-mllvm" "-hexagon-autohvx"
// CHECK-NOVECTOR-NOT: hexagon-autohvx
+// CHECK-NEEDHVX: warning: auto-vectorization requires HVX, use -mhvx to enable it