From: Nemanja Ivanovic Date: Thu, 14 May 2015 20:02:24 +0000 (+0000) Subject: Testing for the fix for bug 23429. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c100914b44653d763fff69f1c9cb91131c54d361;p=clang Testing for the fix for bug 23429. 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 --- diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index d568486f2c..86470b1bba 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -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"); diff --git a/test/Preprocessor/predefined-arch-macros.c b/test/Preprocessor/predefined-arch-macros.c index 5116a56489..5126ef3d94 100644 --- a/test/Preprocessor/predefined-arch-macros.c +++ b/test/Preprocessor/predefined-arch-macros.c @@ -1675,6 +1675,19 @@ // // 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 ---------------- //