]> granicus.if.org Git - clang/commitdiff
[mips] Add _GCC_HAVE_SYNC_COMPARE_AND_SWAP macros.
authorDaniel Sanders <daniel.sanders@imgtec.com>
Tue, 22 Dec 2015 12:59:30 +0000 (12:59 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Tue, 22 Dec 2015 12:59:30 +0000 (12:59 +0000)
This fixes the 'pure virtual function called' failure with ThreadPool in a
clang-built clang. This fixes the llvm-mips-linux builder.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256240 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/Preprocessor/predefined-macros.c

index e6864d9db8b0e51c2cca3a955997bf92bd4aca05..28351a28b0ed56ed768e8960ec3f0f610f977a74 100644 (file)
@@ -6585,6 +6585,12 @@ public:
 
     Builder.defineMacro("_MIPS_ARCH", "\"" + CPU + "\"");
     Builder.defineMacro("_MIPS_ARCH_" + StringRef(CPU).upper());
+
+    // These shouldn't be defined for MIPS-I but there's no need to check
+    // for that since MIPS-I isn't supported.
+    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> getTargetBuiltins() const override {
@@ -6959,6 +6965,8 @@ public:
     }
     else
       llvm_unreachable("Invalid ABI for Mips64.");
+
+    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
   }
   ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
     static const TargetInfo::GCCRegAlias GCCRegAliases[] = {
index 4130f7aefb5abbc5be5e5501a53a2e12909a3e76..1f68a082a9144e7b8fc31d74e063bcf6f7c95f41 100644 (file)
 // RUN: %clang_cc1 %s -E -dM -o - -triple armv6 -target-cpu cortex-m0 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-SYNC_CAS_ARMv6
 // CHECK-SYNC_CAS_ARMv6-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP
+//
+// RUN: %clang_cc1 %s -E -dM -o - -triple mips -target-cpu mips2 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-SYNC_CAS_MIPS \
+// RUN:         --check-prefix=CHECK-SYNC_CAS_MIPS32
+// RUN: %clang_cc1 %s -E -dM -o - -triple mips64 -target-cpu mips3 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-SYNC_CAS_MIPS \
+// RUN:         --check-prefix=CHECK-SYNC_CAS_MIPS64
+// CHECK-SYNC_CAS_MIPS:       __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
+// CHECK-SYNC_CAS_MIPS:       __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
+// CHECK-SYNC_CAS_MIPS:       __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
+// CHECK-SYNC_CAS_MIPS32-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
+// CHECK-SYNC_CAS_MIPS64:     __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8