From: Daniel Sanders Date: Tue, 22 Dec 2015 12:59:30 +0000 (+0000) Subject: [mips] Add _GCC_HAVE_SYNC_COMPARE_AND_SWAP macros. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=28840c7e97a8697175e965a038c2b7135a2e094c;p=clang [mips] Add _GCC_HAVE_SYNC_COMPARE_AND_SWAP macros. 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 --- diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index e6864d9db8..28351a28b0 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -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 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 getGCCRegAliases() const override { static const TargetInfo::GCCRegAlias GCCRegAliases[] = { diff --git a/test/Preprocessor/predefined-macros.c b/test/Preprocessor/predefined-macros.c index 4130f7aefb..1f68a082a9 100644 --- a/test/Preprocessor/predefined-macros.c +++ b/test/Preprocessor/predefined-macros.c @@ -134,3 +134,15 @@ // 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