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 {
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 {
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits