]> granicus.if.org Git - clang/commitdiff
Testing for the fix for bug 23429.
authorNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Thu, 14 May 2015 20:02:24 +0000 (20:02 +0000)
committerNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Thu, 14 May 2015 20:02:24 +0000 (20:02 +0000)
Follow-up to commit for revision 236848.
Just a test case for the macro definition under the right CPU/Arch.
One combination was actually missed in the initial fix:
  - powerpc64-unknown-unknown -mcpu=pwr8 (rather than -mcpu=power8).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237386 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/Preprocessor/predefined-arch-macros.c

index d568486f2cd22f7de9b023f96a9155786e6592ca..86470b1bba23816f8be33f3792b3122377f064c8 100644 (file)
@@ -1208,7 +1208,7 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts,
   if (HasHTM)
     Builder.defineMacro("__HTM__");
   if (getTriple().getArch() == llvm::Triple::ppc64le ||
-      (defs & ArchDefinePwr8)) {
+      (defs & ArchDefinePwr8) || (CPU == "pwr8")) {
     Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
     Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
     Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
index 5116a56489b38c3ab41250e4984156e153a8abd6..5126ef3d94cfe1ddc4e33780fe2440b6205eee85 100644 (file)
 //
 // CHECK_PPC_CRYPTO_M64: #define __CRYPTO__
 //
+// RUN: %clang -mcpu=pwr8 -E -dM %s -o - 2>&1 \
+// RUN:     -target powerpc64-unknown-unknown \
+// RUN:   | FileCheck %s -check-prefix=CHECK_PPC_GCC_ATOMICS
+// RUN: %clang -E -dM %s -o - 2>&1 \
+// RUN:     -target powerpc64le-unknown-linux \
+// RUN:   | FileCheck %s -check-prefix=CHECK_PPC_GCC_ATOMICS
+//
+// CHECK_PPC_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
+// CHECK_PPC_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
+// CHECK_PPC_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
+// CHECK_PPC_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
+//
+// End PPC/GCC/Linux tests ------------------
 
 // Begin Sparc/GCC/Linux tests ----------------
 //