diff options
| author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2018-04-12 16:25:35 +0000 |
|---|---|---|
| committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2018-04-12 16:25:35 +0000 |
| commit | e4b0b6e374194d36562549cc188edc0c695272fa (patch) | |
| tree | 92d7e81f3c7b87843ace0898a71758175f9ab2c4 | |
| parent | 8aa6cd5cb99901219ac7461b1c74784179007913 (diff) | |
| download | bcm5719-llvm-e4b0b6e374194d36562549cc188edc0c695272fa.tar.gz bcm5719-llvm-e4b0b6e374194d36562549cc188edc0c695272fa.zip | |
[Hexagon] Enable auto-vectorization only when -fvectorize was given
llvm-svn: 329923
| -rw-r--r-- | clang/lib/Driver/ToolChains/Hexagon.cpp | 7 | ||||
| -rw-r--r-- | clang/test/Driver/hexagon-vectorize.c | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp index 25a911f4b2c..6402a8288ba 100644 --- a/clang/lib/Driver/ToolChains/Hexagon.cpp +++ b/clang/lib/Driver/ToolChains/Hexagon.cpp @@ -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, diff --git a/clang/test/Driver/hexagon-vectorize.c b/clang/test/Driver/hexagon-vectorize.c new file mode 100644 index 00000000000..d6a537ee8c5 --- /dev/null +++ b/clang/test/Driver/hexagon-vectorize.c @@ -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 |

