[cfe-commits] r140673 - in /cfe/trunk: lib/Basic/Targets.cpp test/Preprocessor/init.c test/Preprocessor/predefined-arch-macros.c

Chandler Carruth chandlerc at gmail.com
Tue Sep 27 21:59:25 CDT 2011


Author: chandlerc
Date: Tue Sep 27 21:59:25 2011
New Revision: 140673

URL: http://llvm.org/viewvc/llvm-project?rev=140673&view=rev
Log:
Begin fixing Clang's predefined macros for various architectures. This
is *very* much a WIP that I'll be refining over the next several
commits, but I need to get this checkpoint in place for sanity.

This also adds a much more comprehensive test for architecture macros,
which is roughly generated by inspecting the behavior of a trunk build
of GCC. It still requires some massaging, but eventually I'll even check
in the script that generates these so that others can use it to append
more tests for more architectures, etc.

Next up is a bunch of simplification of the Targets.cpp code, followed
by a lot more test cases once we can reject invalid architectures.

Added:
    cfe/trunk/test/Preprocessor/predefined-arch-macros.c
Modified:
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=140673&r1=140672&r2=140673&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Sep 27 21:59:25 2011
@@ -1165,6 +1165,9 @@
   bool HasAES;
   bool HasAVX;
 
+  // FIXME: Make this an enum and parse into the enum when set.
+  std::string CPU;
+
 public:
   X86TargetInfo(const std::string& triple)
     : TargetInfo(triple), SSELevel(NoSSE), MMX3DNowLevel(NoMMX3DNow),
@@ -1208,6 +1211,11 @@
   virtual const char* getABI() const {
     return MMX3DNowLevel == NoMMX3DNow ? "no-mmx" : "";
   }
+  virtual bool setCPU(const std::string &Name) {
+    // FIXME: Reject invalid CPU names.
+    CPU = Name;
+    return true;
+  }
 };
 
 void X86TargetInfo::getDefaultFeatures(const std::string &CPU,
@@ -1405,8 +1413,8 @@
     Features.erase(it);
 }
 
-/// X86TargetInfo::getTargetDefines - Return a set of the X86-specific #defines
-/// that are not tied to a specific subtarget.
+/// X86TargetInfo::getTargetDefines - Return the set of the X86-specific macro
+/// definitions for this particular subtarget.
 void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
                                      MacroBuilder &Builder) const {
   // Target identification.
@@ -1429,12 +1437,99 @@
 
   // Target properties.
   Builder.defineMacro("__LITTLE_ENDIAN__");
+  Builder.defineMacro("__REGISTER_PREFIX__", "");
 
   // Subtarget options.
-  Builder.defineMacro("__nocona");
-  Builder.defineMacro("__nocona__");
-  Builder.defineMacro("__tune_nocona__");
-  Builder.defineMacro("__REGISTER_PREFIX__", "");
+  // FIXME: We should build an enum for the CPUs to switch on as we do it in
+  // multiple places.
+  // FIXME: We are hard-coding the tune parameters based on the CPU, but they
+  // truly should be based on -mtune options.
+  if (CPU == "i386") {
+    // The rest are coming from the i386 define above.
+    Builder.defineMacro("__tune_i386__");
+  } else if (CPU == "i486" || CPU == "winchip-c6" || CPU == "winchip2" ||
+      CPU == "c3") {
+    Builder.defineMacro("__i486");
+    Builder.defineMacro("__i486__");
+    Builder.defineMacro("__tune_i486__");
+  } else if (CPU == "i586" || CPU == "pentium" || CPU == "pentium-mmx") {
+    Builder.defineMacro("__i586");
+    Builder.defineMacro("__i586__");
+    Builder.defineMacro("__tune_i586__");
+    Builder.defineMacro("__pentium");
+    Builder.defineMacro("__pentium__");
+    Builder.defineMacro("__tune_pentium__");
+    if (CPU == "pentium-mmx") {
+      Builder.defineMacro("__pentium_mmx__");
+      Builder.defineMacro("__tune_pentium_mmx__");
+    }
+  } else if (CPU == "i686" || CPU == "pentiumpro" || CPU == "pentium2" ||
+             CPU == "pentium3" || CPU == "pentium3m" || CPU == "pentium-m" ||
+             CPU == "c3-2") {
+    Builder.defineMacro("__i686");
+    Builder.defineMacro("__i686__");
+    // Strangely, __tune_i686__ isn't defined by GCC when CPU == i686.
+    Builder.defineMacro("__pentiumpro");
+    Builder.defineMacro("__pentiumpro__");
+    if (CPU != "i686") {
+      Builder.defineMacro("__tune_i686__");
+      Builder.defineMacro("__tune_pentiumpro__");
+      if (CPU == "pentium2" || CPU == "c3-2") {
+        Builder.defineMacro("__tune_pentium2__");
+      } else if (CPU == "pentium3") {
+        Builder.defineMacro("__tune_pentium2__");
+        Builder.defineMacro("__tune_pentium3__");
+      }
+    }
+  } else if (CPU == "pentium4" || CPU == "pentium4m") {
+    Builder.defineMacro("__pentium4");
+    Builder.defineMacro("__pentium4__");
+    Builder.defineMacro("__tune_pentium4__");
+  } else if (CPU == "yonah" || CPU == "prescott" || CPU == "nocona") {
+    Builder.defineMacro("__nocona");
+    Builder.defineMacro("__nocona__");
+    Builder.defineMacro("__tune_nocona__");
+  } else if (CPU == "core2" || CPU == "penryn") {
+    Builder.defineMacro("__core2");
+    Builder.defineMacro("__core2__");
+    Builder.defineMacro("__tune_core2__");
+  } else if (CPU == "atom") {
+    Builder.defineMacro("__atom");
+    Builder.defineMacro("__atom__");
+    Builder.defineMacro("__tune_atom__");
+  } else if (CPU == "corei7" || CPU == "corei7-avx" || CPU == "core-avx-i") {
+    Builder.defineMacro("__corei7");
+    Builder.defineMacro("__corei7__");
+    Builder.defineMacro("__tune_corei7__");
+  } else if (CPU == "k6" || CPU == "k6-2" || CPU == "k6-3") {
+    Builder.defineMacro("__k6");
+    Builder.defineMacro("__k6__");
+    Builder.defineMacro("__tune_k6__");
+    if (CPU == "k6-2") {
+      Builder.defineMacro("__k6_2__");
+      Builder.defineMacro("__tune_k6_2__");
+    } else if (CPU == "k6-3" || MMX3DNowLevel == AMD3DNow) {
+      Builder.defineMacro("__k6_3__");
+      Builder.defineMacro("__tune_k6_3__");
+    }
+  } else if (CPU == "athlon" || CPU == "athlon-tbird" || CPU == "athlon-4" ||
+             CPU == "athlon-xp" || CPU == "athlon-mp") {
+    Builder.defineMacro("__athlon");
+    Builder.defineMacro("__athlon__");
+    Builder.defineMacro("__tune_athlon__");
+    if (SSELevel != NoSSE)
+      Builder.defineMacro("__athlon_sse__");
+  } else if (CPU == "k8" || CPU == "k8-sse3" || CPU == "x86-64" ||
+             CPU == "opteron" || CPU == "opteron-sse3" || CPU == "athlon64" ||
+             CPU == "athlon64-sse3" || CPU == "athlon-fx") {
+    Builder.defineMacro("__k8");
+    Builder.defineMacro("__k8__");
+    Builder.defineMacro("__tune_k8__");
+  } else if (CPU == "geode") {
+    Builder.defineMacro("__geode");
+    Builder.defineMacro("__geode__");
+    Builder.defineMacro("__tune_geode__");
+  }
 
   // Define __NO_MATH_INLINES on linux/x86 so that we don't get inline
   // functions in glibc header files that use FP Stack inline asm which the

Modified: cfe/trunk/test/Preprocessor/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=140673&r1=140672&r2=140673&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Tue Sep 27 21:59:25 2011
@@ -410,9 +410,6 @@
 // I386:#define __WINT_WIDTH__ 32
 // I386:#define __i386 1
 // I386:#define __i386__ 1
-// I386:#define __nocona 1
-// I386:#define __nocona__ 1
-// I386:#define __tune_nocona__ 1
 // I386:#define i386 1
 //
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-pc-linux-gnu < /dev/null | FileCheck -check-prefix I386-LINUX %s
@@ -508,9 +505,6 @@
 // I386-LINUX:#define __WINT_WIDTH__ 32
 // I386-LINUX:#define __i386 1
 // I386-LINUX:#define __i386__ 1
-// I386-LINUX:#define __nocona 1
-// I386-LINUX:#define __nocona__ 1
-// I386-LINUX:#define __tune_nocona__ 1
 // I386-LINUX:#define i386 1
 //
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -check-prefix MSP430 %s
@@ -1183,9 +1177,6 @@
 // X86_64:#define __WINT_WIDTH__ 32
 // X86_64:#define __amd64 1
 // X86_64:#define __amd64__ 1
-// X86_64:#define __nocona 1
-// X86_64:#define __nocona__ 1
-// X86_64:#define __tune_nocona__ 1
 // X86_64:#define __x86_64 1
 // X86_64:#define __x86_64__ 1
 //
@@ -1289,9 +1280,6 @@
 // X86_64-LINUX:#define __WINT_WIDTH__ 32
 // X86_64-LINUX:#define __amd64 1
 // X86_64-LINUX:#define __amd64__ 1
-// X86_64-LINUX:#define __nocona 1
-// X86_64-LINUX:#define __nocona__ 1
-// X86_64-LINUX:#define __tune_nocona__ 1
 // X86_64-LINUX:#define __x86_64 1
 // X86_64-LINUX:#define __x86_64__ 1
 //

Added: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/predefined-arch-macros.c?rev=140673&view=auto
==============================================================================
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c (added)
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c Tue Sep 27 21:59:25 2011
@@ -0,0 +1,415 @@
+// These tests are generated by running utils/generate_arch_predefine_tests.sh
+// to observe GCC's behavior (or some other system compiler's behavior).
+//
+// RUN: %clang -march=i386 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_I386_M32
+// CHECK_I386_M32: #define __i386 1
+// CHECK_I386_M32: #define __i386__ 1
+// CHECK_I386_M32: #define __tune_i386__ 1
+// CHECK_I386_M32: #define i386 1
+//
+// RUN: %clang -march=i486 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_I486_M32
+// CHECK_I486_M32: #define __i386 1
+// CHECK_I486_M32: #define __i386__ 1
+// CHECK_I486_M32: #define __i486 1
+// CHECK_I486_M32: #define __i486__ 1
+// CHECK_I486_M32: #define __tune_i486__ 1
+// CHECK_I486_M32: #define i386 1
+//
+// RUN: %clang -march=i586 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_I586_M32
+// CHECK_I586_M32: #define __i386 1
+// CHECK_I586_M32: #define __i386__ 1
+// CHECK_I586_M32: #define __i586 1
+// CHECK_I586_M32: #define __i586__ 1
+// CHECK_I586_M32: #define __pentium 1
+// CHECK_I586_M32: #define __pentium__ 1
+// CHECK_I586_M32: #define __tune_i586__ 1
+// CHECK_I586_M32: #define __tune_pentium__ 1
+// CHECK_I586_M32: #define i386 1
+//
+// RUN: %clang -march=pentium -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_PENTIUM_M32
+// CHECK_PENTIUM_M32: #define __i386 1
+// CHECK_PENTIUM_M32: #define __i386__ 1
+// CHECK_PENTIUM_M32: #define __i586 1
+// CHECK_PENTIUM_M32: #define __i586__ 1
+// CHECK_PENTIUM_M32: #define __pentium 1
+// CHECK_PENTIUM_M32: #define __pentium__ 1
+// CHECK_PENTIUM_M32: #define __tune_i586__ 1
+// CHECK_PENTIUM_M32: #define __tune_pentium__ 1
+// CHECK_PENTIUM_M32: #define i386 1
+//
+// RUN: %clang -march=pentium-mmx -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_PENTIUM_MMX_M32
+// CHECK_PENTIUM_MMX_M32: #define __i386 1
+// CHECK_PENTIUM_MMX_M32: #define __i386__ 1
+// CHECK_PENTIUM_MMX_M32: #define __i586 1
+// CHECK_PENTIUM_MMX_M32: #define __i586__ 1
+// CHECK_PENTIUM_MMX_M32: #define __pentium 1
+// CHECK_PENTIUM_MMX_M32: #define __pentium__ 1
+// CHECK_PENTIUM_MMX_M32: #define __pentium_mmx__ 1
+// CHECK_PENTIUM_MMX_M32: #define __tune_i586__ 1
+// CHECK_PENTIUM_MMX_M32: #define __tune_pentium__ 1
+// CHECK_PENTIUM_MMX_M32: #define __tune_pentium_mmx__ 1
+// CHECK_PENTIUM_MMX_M32: #define i386 1
+//
+// RUN: %clang -march=winchip-c6 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_WINCHIP_C6_M32
+// CHECK_WINCHIP_C6_M32: #define __i386 1
+// CHECK_WINCHIP_C6_M32: #define __i386__ 1
+// CHECK_WINCHIP_C6_M32: #define __i486 1
+// CHECK_WINCHIP_C6_M32: #define __i486__ 1
+// CHECK_WINCHIP_C6_M32: #define __tune_i486__ 1
+// CHECK_WINCHIP_C6_M32: #define i386 1
+//
+// RUN: %clang -march=winchip2 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_WINCHIP2_M32
+// CHECK_WINCHIP2_M32: #define __i386 1
+// CHECK_WINCHIP2_M32: #define __i386__ 1
+// CHECK_WINCHIP2_M32: #define __i486 1
+// CHECK_WINCHIP2_M32: #define __i486__ 1
+// CHECK_WINCHIP2_M32: #define __tune_i486__ 1
+// CHECK_WINCHIP2_M32: #define i386 1
+//
+// RUN: %clang -march=c3 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_C3_M32
+// CHECK_C3_M32: #define __i386 1
+// CHECK_C3_M32: #define __i386__ 1
+// CHECK_C3_M32: #define __i486 1
+// CHECK_C3_M32: #define __i486__ 1
+// CHECK_C3_M32: #define __tune_i486__ 1
+// CHECK_C3_M32: #define i386 1
+//
+// RUN: %clang -march=c3-2 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_C3_2_M32
+// CHECK_C3_2_M32: #define __i386 1
+// CHECK_C3_2_M32: #define __i386__ 1
+// CHECK_C3_2_M32: #define __i686 1
+// CHECK_C3_2_M32: #define __i686__ 1
+// CHECK_C3_2_M32: #define __pentiumpro 1
+// CHECK_C3_2_M32: #define __pentiumpro__ 1
+// CHECK_C3_2_M32: #define __tune_i686__ 1
+// CHECK_C3_2_M32: #define __tune_pentium2__ 1
+// CHECK_C3_2_M32: #define __tune_pentiumpro__ 1
+// CHECK_C3_2_M32: #define i386 1
+//
+// RUN: %clang -march=i686 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_I686_M32
+// CHECK_I686_M32: #define __i386 1
+// CHECK_I686_M32: #define __i386__ 1
+// CHECK_I686_M32: #define __i686 1
+// CHECK_I686_M32: #define __i686__ 1
+// CHECK_I686_M32: #define __pentiumpro 1
+// CHECK_I686_M32: #define __pentiumpro__ 1
+// CHECK_I686_M32: #define i386 1
+//
+// RUN: %clang -march=pentiumpro -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_PENTIUMPRO_M32
+// CHECK_PENTIUMPRO_M32: #define __i386 1
+// CHECK_PENTIUMPRO_M32: #define __i386__ 1
+// CHECK_PENTIUMPRO_M32: #define __i686 1
+// CHECK_PENTIUMPRO_M32: #define __i686__ 1
+// CHECK_PENTIUMPRO_M32: #define __pentiumpro 1
+// CHECK_PENTIUMPRO_M32: #define __pentiumpro__ 1
+// CHECK_PENTIUMPRO_M32: #define __tune_i686__ 1
+// CHECK_PENTIUMPRO_M32: #define __tune_pentiumpro__ 1
+// CHECK_PENTIUMPRO_M32: #define i386 1
+//
+// RUN: %clang -march=pentium2 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_PENTIUM2_M32
+// CHECK_PENTIUM2_M32: #define __i386 1
+// CHECK_PENTIUM2_M32: #define __i386__ 1
+// CHECK_PENTIUM2_M32: #define __i686 1
+// CHECK_PENTIUM2_M32: #define __i686__ 1
+// CHECK_PENTIUM2_M32: #define __pentiumpro 1
+// CHECK_PENTIUM2_M32: #define __pentiumpro__ 1
+// CHECK_PENTIUM2_M32: #define __tune_i686__ 1
+// CHECK_PENTIUM2_M32: #define __tune_pentium2__ 1
+// CHECK_PENTIUM2_M32: #define __tune_pentiumpro__ 1
+// CHECK_PENTIUM2_M32: #define i386 1
+//
+// RUN: %clang -march=pentium3 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_PENTIUM3_M32
+// CHECK_PENTIUM3_M32: #define __i386 1
+// CHECK_PENTIUM3_M32: #define __i386__ 1
+// CHECK_PENTIUM3_M32: #define __i686 1
+// CHECK_PENTIUM3_M32: #define __i686__ 1
+// CHECK_PENTIUM3_M32: #define __pentiumpro 1
+// CHECK_PENTIUM3_M32: #define __pentiumpro__ 1
+// CHECK_PENTIUM3_M32: #define __tune_i686__ 1
+// CHECK_PENTIUM3_M32: #define __tune_pentium2__ 1
+// CHECK_PENTIUM3_M32: #define __tune_pentium3__ 1
+// CHECK_PENTIUM3_M32: #define __tune_pentiumpro__ 1
+// CHECK_PENTIUM3_M32: #define i386 1
+//
+// RUN: %clang -march=pentium3m -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_PENTIUM3M_M32
+// CHECK_PENTIUM3M_M32: #define __i386 1
+// CHECK_PENTIUM3M_M32: #define __i386__ 1
+// CHECK_PENTIUM3M_M32: #define __i686 1
+// CHECK_PENTIUM3M_M32: #define __i686__ 1
+// CHECK_PENTIUM3M_M32: #define __pentiumpro 1
+// CHECK_PENTIUM3M_M32: #define __pentiumpro__ 1
+// CHECK_PENTIUM3M_M32: #define __tune_i686__ 1
+// CHECK_PENTIUM3M_M32: #define __tune_pentiumpro__ 1
+// CHECK_PENTIUM3M_M32: #define i386 1
+//
+// RUN: %clang -march=pentium-m -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_PENTIUM_M_M32
+// CHECK_PENTIUM_M_M32: #define __i386 1
+// CHECK_PENTIUM_M_M32: #define __i386__ 1
+// CHECK_PENTIUM_M_M32: #define __i686 1
+// CHECK_PENTIUM_M_M32: #define __i686__ 1
+// CHECK_PENTIUM_M_M32: #define __pentiumpro 1
+// CHECK_PENTIUM_M_M32: #define __pentiumpro__ 1
+// CHECK_PENTIUM_M_M32: #define __tune_i686__ 1
+// CHECK_PENTIUM_M_M32: #define __tune_pentiumpro__ 1
+// CHECK_PENTIUM_M_M32: #define i386 1
+//
+// RUN: %clang -march=pentium4 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_PENTIUM4_M32
+// CHECK_PENTIUM4_M32: #define __i386 1
+// CHECK_PENTIUM4_M32: #define __i386__ 1
+// CHECK_PENTIUM4_M32: #define __pentium4 1
+// CHECK_PENTIUM4_M32: #define __pentium4__ 1
+// CHECK_PENTIUM4_M32: #define __tune_pentium4__ 1
+// CHECK_PENTIUM4_M32: #define i386 1
+//
+// RUN: %clang -march=pentium4m -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_PENTIUM4M_M32
+// CHECK_PENTIUM4M_M32: #define __i386 1
+// CHECK_PENTIUM4M_M32: #define __i386__ 1
+// CHECK_PENTIUM4M_M32: #define __pentium4 1
+// CHECK_PENTIUM4M_M32: #define __pentium4__ 1
+// CHECK_PENTIUM4M_M32: #define __tune_pentium4__ 1
+// CHECK_PENTIUM4M_M32: #define i386 1
+//
+// RUN: %clang -march=prescott -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_PRESCOTT_M32
+// CHECK_PRESCOTT_M32: #define __i386 1
+// CHECK_PRESCOTT_M32: #define __i386__ 1
+// CHECK_PRESCOTT_M32: #define __nocona 1
+// CHECK_PRESCOTT_M32: #define __nocona__ 1
+// CHECK_PRESCOTT_M32: #define __tune_nocona__ 1
+// CHECK_PRESCOTT_M32: #define i386 1
+//
+// RUN: %clang -march=nocona -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_NOCONA_M32
+// CHECK_NOCONA_M32: #define __i386 1
+// CHECK_NOCONA_M32: #define __i386__ 1
+// CHECK_NOCONA_M32: #define __nocona 1
+// CHECK_NOCONA_M32: #define __nocona__ 1
+// CHECK_NOCONA_M32: #define __tune_nocona__ 1
+// CHECK_NOCONA_M32: #define i386 1
+//
+// RUN: %clang -march=core2 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_CORE2_M32
+// CHECK_CORE2_M32: #define __core2 1
+// CHECK_CORE2_M32: #define __core2__ 1
+// CHECK_CORE2_M32: #define __i386 1
+// CHECK_CORE2_M32: #define __i386__ 1
+// CHECK_CORE2_M32: #define __tune_core2__ 1
+// CHECK_CORE2_M32: #define i386 1
+//
+// RUN: %clang -march=corei7 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_COREI7_M32
+// CHECK_COREI7_M32: #define __corei7 1
+// CHECK_COREI7_M32: #define __corei7__ 1
+// CHECK_COREI7_M32: #define __i386 1
+// CHECK_COREI7_M32: #define __i386__ 1
+// CHECK_COREI7_M32: #define __tune_corei7__ 1
+// CHECK_COREI7_M32: #define i386 1
+//
+// RUN: %clang -march=corei7-avx -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_COREI7_AVX_M32
+// CHECK_COREI7_AVX_M32: #define __corei7 1
+// CHECK_COREI7_AVX_M32: #define __corei7__ 1
+// CHECK_COREI7_AVX_M32: #define __i386 1
+// CHECK_COREI7_AVX_M32: #define __i386__ 1
+// CHECK_COREI7_AVX_M32: #define __tune_corei7__ 1
+// CHECK_COREI7_AVX_M32: #define i386 1
+//
+// RUN: %clang -march=core-avx-i -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_CORE_AVX_I_M32
+// CHECK_CORE_AVX_I_M32: #define __corei7 1
+// CHECK_CORE_AVX_I_M32: #define __corei7__ 1
+// CHECK_CORE_AVX_I_M32: #define __i386 1
+// CHECK_CORE_AVX_I_M32: #define __i386__ 1
+// CHECK_CORE_AVX_I_M32: #define __tune_corei7__ 1
+// CHECK_CORE_AVX_I_M32: #define i386 1
+//
+// RUN: %clang -march=atom -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_ATOM_M32
+// CHECK_ATOM_M32: #define __atom 1
+// CHECK_ATOM_M32: #define __atom__ 1
+// CHECK_ATOM_M32: #define __i386 1
+// CHECK_ATOM_M32: #define __i386__ 1
+// CHECK_ATOM_M32: #define __tune_atom__ 1
+// CHECK_ATOM_M32: #define i386 1
+//
+// RUN: %clang -march=geode -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_GEODE_M32
+// CHECK_GEODE_M32: #define __geode 1
+// CHECK_GEODE_M32: #define __geode__ 1
+// CHECK_GEODE_M32: #define __i386 1
+// CHECK_GEODE_M32: #define __i386__ 1
+// CHECK_GEODE_M32: #define __tune_geode__ 1
+// CHECK_GEODE_M32: #define i386 1
+//
+// RUN: %clang -march=k6 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_K6_M32
+// CHECK_K6_M32: #define __i386 1
+// CHECK_K6_M32: #define __i386__ 1
+// CHECK_K6_M32: #define __k6 1
+// CHECK_K6_M32: #define __k6__ 1
+// CHECK_K6_M32: #define __tune_k6__ 1
+// CHECK_K6_M32: #define i386 1
+//
+// RUN: %clang -march=k6-2 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_K6_2_M32
+// CHECK_K6_2_M32: #define __i386 1
+// CHECK_K6_2_M32: #define __i386__ 1
+// CHECK_K6_2_M32: #define __k6 1
+// CHECK_K6_2_M32: #define __k6_2__ 1
+// CHECK_K6_2_M32: #define __k6__ 1
+// CHECK_K6_2_M32: #define __tune_k6_2__ 1
+// CHECK_K6_2_M32: #define __tune_k6__ 1
+// CHECK_K6_2_M32: #define i386 1
+//
+// RUN: %clang -march=k6-3 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_K6_3_M32
+// CHECK_K6_3_M32: #define __i386 1
+// CHECK_K6_3_M32: #define __i386__ 1
+// CHECK_K6_3_M32: #define __k6 1
+// CHECK_K6_3_M32: #define __k6_3__ 1
+// CHECK_K6_3_M32: #define __k6__ 1
+// CHECK_K6_3_M32: #define __tune_k6_3__ 1
+// CHECK_K6_3_M32: #define __tune_k6__ 1
+// CHECK_K6_3_M32: #define i386 1
+//
+// RUN: %clang -march=athlon -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_ATHLON_M32
+// CHECK_ATHLON_M32: #define __athlon 1
+// CHECK_ATHLON_M32: #define __athlon__ 1
+// CHECK_ATHLON_M32: #define __i386 1
+// CHECK_ATHLON_M32: #define __i386__ 1
+// CHECK_ATHLON_M32: #define __tune_athlon__ 1
+// CHECK_ATHLON_M32: #define i386 1
+//
+// RUN: %clang -march=athlon-tbird -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_ATHLON_TBIRD_M32
+// CHECK_ATHLON_TBIRD_M32: #define __athlon 1
+// CHECK_ATHLON_TBIRD_M32: #define __athlon__ 1
+// CHECK_ATHLON_TBIRD_M32: #define __i386 1
+// CHECK_ATHLON_TBIRD_M32: #define __i386__ 1
+// CHECK_ATHLON_TBIRD_M32: #define __tune_athlon__ 1
+// CHECK_ATHLON_TBIRD_M32: #define i386 1
+//
+// RUN: %clang -march=athlon-4 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_ATHLON_4_M32
+// CHECK_ATHLON_4_M32: #define __athlon 1
+// CHECK_ATHLON_4_M32: #define __athlon__ 1
+// CHECK_ATHLON_4_M32: #define __athlon_sse__ 1
+// CHECK_ATHLON_4_M32: #define __i386 1
+// CHECK_ATHLON_4_M32: #define __i386__ 1
+// CHECK_ATHLON_4_M32: #define __tune_athlon__ 1
+// FIXME: This should be defined!
+// CHECK_ATHLON_4_M32-NOT: #define __tune_athlon_sse__ 1
+// CHECK_ATHLON_4_M32: #define i386 1
+//
+// RUN: %clang -march=athlon-xp -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_ATHLON_XP_M32
+// CHECK_ATHLON_XP_M32: #define __athlon 1
+// CHECK_ATHLON_XP_M32: #define __athlon__ 1
+// CHECK_ATHLON_XP_M32: #define __athlon_sse__ 1
+// CHECK_ATHLON_XP_M32: #define __i386 1
+// CHECK_ATHLON_XP_M32: #define __i386__ 1
+// CHECK_ATHLON_XP_M32: #define __tune_athlon__ 1
+// FIXME: This should be defined!
+// CHECK_ATHLON_XP_M32-NOT: #define __tune_athlon_sse__ 1
+// CHECK_ATHLON_XP_M32: #define i386 1
+//
+// RUN: %clang -march=athlon-mp -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_ATHLON_MP_M32
+// CHECK_ATHLON_MP_M32: #define __athlon 1
+// CHECK_ATHLON_MP_M32: #define __athlon__ 1
+// CHECK_ATHLON_MP_M32: #define __athlon_sse__ 1
+// CHECK_ATHLON_MP_M32: #define __i386 1
+// CHECK_ATHLON_MP_M32: #define __i386__ 1
+// CHECK_ATHLON_MP_M32: #define __tune_athlon__ 1
+// FIXME: This should be defined!
+// CHECK_ATHLON_MP_M32-NOT: #define __tune_athlon_sse__ 1
+// CHECK_ATHLON_MP_M32: #define i386 1
+//
+// RUN: %clang -march=x86-64 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_X86_64_M32
+// CHECK_X86_64_M32: #define __i386 1
+// CHECK_X86_64_M32: #define __i386__ 1
+// CHECK_X86_64_M32: #define __k8 1
+// CHECK_X86_64_M32: #define __k8__ 1
+// CHECK_X86_64_M32: #define i386 1
+//
+// RUN: %clang -march=k8 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_K8_M32
+// CHECK_K8_M32: #define __i386 1
+// CHECK_K8_M32: #define __i386__ 1
+// CHECK_K8_M32: #define __k8 1
+// CHECK_K8_M32: #define __k8__ 1
+// CHECK_K8_M32: #define __tune_k8__ 1
+// CHECK_K8_M32: #define i386 1
+//
+// RUN: %clang -march=k8-sse3 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_K8_SSE3_M32
+// CHECK_K8_SSE3_M32: #define __i386 1
+// CHECK_K8_SSE3_M32: #define __i386__ 1
+// CHECK_K8_SSE3_M32: #define __k8 1
+// CHECK_K8_SSE3_M32: #define __k8__ 1
+// CHECK_K8_SSE3_M32: #define __tune_k8__ 1
+// CHECK_K8_SSE3_M32: #define i386 1
+//
+// RUN: %clang -march=opteron -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_OPTERON_M32
+// CHECK_OPTERON_M32: #define __i386 1
+// CHECK_OPTERON_M32: #define __i386__ 1
+// CHECK_OPTERON_M32: #define __k8 1
+// CHECK_OPTERON_M32: #define __k8__ 1
+// CHECK_OPTERON_M32: #define __tune_k8__ 1
+// CHECK_OPTERON_M32: #define i386 1
+//
+// RUN: %clang -march=opteron-sse3 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_OPTERON_SSE3_M32
+// CHECK_OPTERON_SSE3_M32: #define __i386 1
+// CHECK_OPTERON_SSE3_M32: #define __i386__ 1
+// CHECK_OPTERON_SSE3_M32: #define __k8 1
+// CHECK_OPTERON_SSE3_M32: #define __k8__ 1
+// CHECK_OPTERON_SSE3_M32: #define __tune_k8__ 1
+// CHECK_OPTERON_SSE3_M32: #define i386 1
+//
+// RUN: %clang -march=athlon64 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_ATHLON64_M32
+// CHECK_ATHLON64_M32: #define __i386 1
+// CHECK_ATHLON64_M32: #define __i386__ 1
+// CHECK_ATHLON64_M32: #define __k8 1
+// CHECK_ATHLON64_M32: #define __k8__ 1
+// CHECK_ATHLON64_M32: #define __tune_k8__ 1
+// CHECK_ATHLON64_M32: #define i386 1
+//
+// RUN: %clang -march=athlon64-sse3 -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_ATHLON64_SSE3_M32
+// CHECK_ATHLON64_SSE3_M32: #define __i386 1
+// CHECK_ATHLON64_SSE3_M32: #define __i386__ 1
+// CHECK_ATHLON64_SSE3_M32: #define __k8 1
+// CHECK_ATHLON64_SSE3_M32: #define __k8__ 1
+// CHECK_ATHLON64_SSE3_M32: #define __tune_k8__ 1
+// CHECK_ATHLON64_SSE3_M32: #define i386 1
+//
+// RUN: %clang -march=athlon-fx -m32 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK_ATHLON_FX_M32
+// CHECK_ATHLON_FX_M32: #define __i386 1
+// CHECK_ATHLON_FX_M32: #define __i386__ 1
+// CHECK_ATHLON_FX_M32: #define __k8 1
+// CHECK_ATHLON_FX_M32: #define __k8__ 1
+// CHECK_ATHLON_FX_M32: #define __tune_k8__ 1
+// CHECK_ATHLON_FX_M32: #define i386 1




More information about the cfe-commits mailing list