[clang] ca13437 - [X86] Add a /tune: option for clang-cl

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 2 20:28:01 PDT 2020


Author: Craig Topper
Date: 2020-09-02T20:27:38-07:00
New Revision: ca134374b74e2c2c6e96695502f3a0974c1da4c1

URL: https://github.com/llvm/llvm-project/commit/ca134374b74e2c2c6e96695502f3a0974c1da4c1
DIFF: https://github.com/llvm/llvm-project/commit/ca134374b74e2c2c6e96695502f3a0974c1da4c1.diff

LOG: [X86] Add a /tune: option for clang-cl

We recently added support for -mtune. This patch adds /tune: so we can specify the tune CPU from clang-cl. MSVC doesn't support this but icc does.

Differential Revision: https://reviews.llvm.org/D86820

Added: 
    

Modified: 
    clang/include/clang/Driver/Options.td
    clang/test/Driver/cl-x86-flags.c

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 5a6a196191e7..912192660c14 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -4696,6 +4696,9 @@ def _SLASH_openmp : CLFlag<"openmp">, HelpText<"Enable OpenMP support">,
 def _SLASH_openmp_experimental : CLFlag<"openmp:experimental">,
   HelpText<"Enable OpenMP support with experimental SIMD support">,
   Alias<fopenmp>;
+def _SLASH_tune : CLCompileJoined<"tune:">,
+  HelpText<"Set CPU for optimization without affecting instruction set">,
+  Alias<mtune_EQ>;
 
 // Non-aliases:
 

diff  --git a/clang/test/Driver/cl-x86-flags.c b/clang/test/Driver/cl-x86-flags.c
index 595959b48828..15e3e012f2ac 100644
--- a/clang/test/Driver/cl-x86-flags.c
+++ b/clang/test/Driver/cl-x86-flags.c
@@ -128,5 +128,9 @@
 // RUN: %clang_cl -m64 -arch:avx512 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx51264 %s
 // avx51264: argument unused during compilation
 
+// RUN: %clang_cl -m64 -arch:AVX -tune:haswell --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=tune %s
+// tune: "-target-cpu" "sandybridge"
+// tune-SAME: "-tune-cpu" "haswell"
+
 void f() {
 }


        


More information about the cfe-commits mailing list