From 847d2d454944bc56fccb8fbd344e91b6ec678a22 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Mon, 18 Feb 2013 12:11:32 +0000 Subject: [PATCH] AArch64: add atomic support parameters to TargetInfo This allows Clang to detect and deal wih __atomic_* operations properly on AArch64. Previously we produced an error when encountering them at high optimisation levels. llvm-svn: 175438 --- clang/lib/Basic/Targets.cpp | 4 ++++ clang/test/Sema/atomic-ops.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 6f8dfe9b65d6..eaf2e7d05e6e 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -3167,6 +3167,10 @@ public: WCharType = UnsignedInt; LongDoubleFormat = &llvm::APFloat::IEEEquad; + // AArch64 backend supports 64-bit operations at the moment. In principle + // 128-bit is possible if register-pairs are used. + MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; + TheCXXABI.set(TargetCXXABI::GenericAArch64); } virtual void getTargetDefines(const LangOptions &Opts, diff --git a/clang/test/Sema/atomic-ops.c b/clang/test/Sema/atomic-ops.c index 2a935918ac08..a33ff2b19c04 100644 --- a/clang/test/Sema/atomic-ops.c +++ b/clang/test/Sema/atomic-ops.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -verify -fsyntax-only -triple=i686-linux-gnu -std=c11 +// RUN: %clang_cc1 %s -verify -fsyntax-only -triple=aarch64-linux-gnu -std=c11 // Basic parsing/Sema tests for __c11_atomic_* @@ -17,7 +18,11 @@ _Static_assert(__GCC_ATOMIC_WCHAR_T_LOCK_FREE == 2, ""); _Static_assert(__GCC_ATOMIC_SHORT_LOCK_FREE == 2, ""); _Static_assert(__GCC_ATOMIC_INT_LOCK_FREE == 2, ""); _Static_assert(__GCC_ATOMIC_LONG_LOCK_FREE == 2, ""); +#ifdef __i386__ _Static_assert(__GCC_ATOMIC_LLONG_LOCK_FREE == 1, ""); +#else +_Static_assert(__GCC_ATOMIC_LLONG_LOCK_FREE == 2, ""); +#endif _Static_assert(__GCC_ATOMIC_POINTER_LOCK_FREE == 2, ""); _Static_assert(__c11_atomic_is_lock_free(1), "");