[PATCH] D140695: [M68k] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros
Brad Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 27 08:09:42 PST 2022
brad created this revision.
brad added reviewers: 0x59616e, myhsu, efriedma, glaubitz.
brad added a project: clang.
Herald added a project: All.
brad requested review of this revision.
Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP macros
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140695
Files:
clang/lib/Basic/Targets/M68k.cpp
clang/test/Preprocessor/predefined-arch-macros.c
Index: clang/test/Preprocessor/predefined-arch-macros.c
===================================================================
--- clang/test/Preprocessor/predefined-arch-macros.c
+++ clang/test/Preprocessor/predefined-arch-macros.c
@@ -4313,3 +4313,12 @@
// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_R600_FP64
// CHECK_R600_FP64-DAG: #define __R600__ 1
// CHECK_R600_FP64-DAG: #define __HAS_FMAF__ 1
+
+// Begin M68k tests ----------------
+
+// RUN: %clang -E -dM %s -o - 2>&1 \
+// RUN: -target m68k-unknown-linux \
+// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_M68K_GCC_ATOMICS
+// CHECK_M68K_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
+// CHECK_M68K_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
+// CHECK_M68K_GCC_ATOMICS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
Index: clang/lib/Basic/Targets/M68k.cpp
===================================================================
--- clang/lib/Basic/Targets/M68k.cpp
+++ clang/lib/Basic/Targets/M68k.cpp
@@ -113,6 +113,12 @@
default:
break;
}
+
+ if (CPU >= CK_68020) {
+ 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");
+ }
}
ArrayRef<Builtin::Info> M68kTargetInfo::getTargetBuiltins() const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140695.485378.patch
Type: text/x-patch
Size: 1372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221227/bb644877/attachment.bin>
More information about the cfe-commits
mailing list