r212869 - clang-cl: Make all x86 CPU feature flags available, such as -msse3

Reid Kleckner reid at kleckner.net
Fri Jul 11 17:29:05 PDT 2014

Author: rnk
Date: Fri Jul 11 19:29:05 2014
New Revision: 212869

URL: http://llvm.org/viewvc/llvm-project?rev=212869&view=rev
clang-cl: Make all x86 CPU feature flags available, such as -msse3

Ideally, we would use the /arch cl.exe flag for this stuff.
Unfortunately, MSVC supports only 5 /arch flag values, which isn't
nearly enough to cover all the CPU features that LLVM cares about.  At
the very least, we need to know about SSE3 and SSE4.1 in addition to
SSE, SSE2, AVX, and AVX2.

In the future we should add the relevant /arch mappings in addition to
these gcc-style -m flags.


Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=212869&r1=212868&r2=212869&view=diff
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Jul 11 19:29:05 2014
@@ -73,7 +73,7 @@ def g_flags_Group         : OptionGroup<
 def i_Group               : OptionGroup<"<i group>">, Group<CompileOnly_Group>;
 def clang_i_Group         : OptionGroup<"<clang i group>">, Group<i_Group>;
 def m_Group               : OptionGroup<"<m group>">, Group<CompileOnly_Group>;
-def m_x86_Features_Group  : OptionGroup<"<m x86 features group>">, Group<m_Group>;
+def m_x86_Features_Group  : OptionGroup<"<m x86 features group>">, Group<m_Group>, Flags<[CoreOption]>;
 def m_hexagon_Features_Group  : OptionGroup<"<m hexagon features group>">, Group<m_Group>;
 def m_arm_Features_Group  : OptionGroup<"<m arm features group>">, Group<m_Group>;
 def m_aarch64_Features_Group  : OptionGroup<"<m aarch64 features group>">, Group<m_Group>;

Modified: cfe/trunk/test/Driver/cl-options.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=212869&r1=212868&r2=212869&view=diff
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Fri Jul 11 19:29:05 2014
@@ -285,8 +285,10 @@
 // Xclang: "-cc1"
 // Xclang: "hellocc1"
-// We support -m32 and -m64.
-// RUN: %clang_cl /Zs /WX -m32 -m64 -### -- 2>&1 %s | FileCheck -check-prefix=MFLAGS %s
+// We support -m32 and -m64.  We support all x86 CPU feature flags in gcc's -m
+// flag space.
+// RUN: %clang_cl /Zs /WX -m32 -m64 -msse3 -msse4.1 -mavx -mno-avx \
+// RUN:     -### -- 2>&1 %s | FileCheck -check-prefix=MFLAGS %s
 // MFLAGS-NOT: argument unused during compilation
 // RTTI is on by default. /GR- controls -fno-rtti-data.

More information about the cfe-commits mailing list