diff options
| -rw-r--r-- | clang/lib/Basic/Targets.cpp | 2 | ||||
| -rw-r--r-- | clang/test/Preprocessor/predefined-arch-macros.c | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index d568486f2cd..86470b1bba2 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/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/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c index 5116a56489b..5126ef3d94c 100644 --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/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 ---------------- // |

