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

Krzysztof Parzyszek via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 12 09:25:35 PDT 2018


Author: kparzysz
Date: Thu Apr 12 09:25:35 2018
New Revision: 329923

URL: http://llvm.org/viewvc/llvm-project?rev=329923&view=rev
Log:
[Hexagon] Enable auto-vectorization only when -fvectorize was given

Added:
    cfe/trunk/test/Driver/hexagon-vectorize.c
Modified:
    cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp?rev=329923&r1=329922&r2=329923&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp Thu Apr 12 09:25:35 2018
@@ -520,6 +520,13 @@ void HexagonToolChain::addClangTargetOpt
     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,

Added: cfe/trunk/test/Driver/hexagon-vectorize.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/hexagon-vectorize.c?rev=329923&view=auto
==============================================================================
--- cfe/trunk/test/Driver/hexagon-vectorize.c (added)
+++ cfe/trunk/test/Driver/hexagon-vectorize.c Thu Apr 12 09:25:35 2018
@@ -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




More information about the cfe-commits mailing list