[clang] 5fe1713 - [Sparc] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros on SPARCv9
Brad Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 10 21:05:11 PDT 2020
Author: Brad Smith
Date: 2020-08-11T00:04:24-04:00
New Revision: 5fe171321c018a811debc306a776dbdf27a306dd
URL: https://github.com/llvm/llvm-project/commit/5fe171321c018a811debc306a776dbdf27a306dd
DIFF: https://github.com/llvm/llvm-project/commit/5fe171321c018a811debc306a776dbdf27a306dd.diff
LOG: [Sparc] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros on SPARCv9
Added:
Modified:
clang/lib/Basic/Targets/Sparc.cpp
clang/test/Preprocessor/predefined-arch-macros.c
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/Sparc.cpp b/clang/lib/Basic/Targets/Sparc.cpp
index 13aa964d4716..48f36c5ba1c6 100644
--- a/clang/lib/Basic/Targets/Sparc.cpp
+++ b/clang/lib/Basic/Targets/Sparc.cpp
@@ -240,6 +240,11 @@ void SparcV9TargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__sparc_v9__");
Builder.defineMacro("__sparcv9__");
}
+
+ 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");
+ Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
}
void SparcV9TargetInfo::fillValidCPUList(
diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c
index e457a0479b33..abab9274ffbb 100644
--- a/clang/test/Preprocessor/predefined-arch-macros.c
+++ b/clang/test/Preprocessor/predefined-arch-macros.c
@@ -3174,6 +3174,14 @@
// CHECK_SPARCV9: #define __sparcv9 1
// CHECK_SPARCV9: #define __sparcv9__ 1
+// RUN: %clang -E -dM %s -o - 2>&1 \
+// RUN: -target sparcv9-unknown-linux \
+// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SPARCV9_GCC_ATOMICS
+// CHECK_SPARCV9_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
+// CHECK_SPARCV9_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
+// CHECK_SPARCV9_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
+// CHECK_SPARCV9_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
+
// Begin SystemZ/GCC/Linux tests ----------------
// RUN: %clang -march=arch8 -E -dM %s -o - 2>&1 \
More information about the cfe-commits
mailing list