From 6edfb88a439f007e5b22f06389ff65fb20a8900a Mon Sep 17 00:00:00 2001
From: David Fang <fang@csl.cornell.edu>
Date: Wed, 15 Jan 2014 21:27:34 -0800
Subject: [PATCH 3003/3003] implement atomic<> using mutex/lock_guard for 64b
ops on 32b PPC not pretty, not fast, but passes atomic tests
include/__atomic_locked | 240 ++++++++++++++++++++++++++++++++++++++++++++++++
include/atomic | 46 ++++++++++
2 files changed, 286 insertions(+)
create mode 100644 include/__atomic_locked
diff --git llvm_master/projects/libcxx/include/__atomic_locked macports_master/projects/libcxx/include/__atomic_locked
index 000000000..f10dd747e
+++ macports_master/projects/libcxx/include/__atomic_locked
+//===--------------------------- __atomic_locked --------------------------===//
+// The LLVM Compiler Infrastructure
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//===----------------------------------------------------------------------===//
+#ifndef _LIBCPP_ATOMIC_LOCKED
+#define _LIBCPP_ATOMIC_LOCKED
+#include <__mutex_base> // for mutex and lock_guard
+ This provides slow-but-usable lock-based atomic access to
+ structures for which atomic lock-free functions are missing.
+ This is motivated by the desire for 64b atomic operations
+ on 32b PowerPC architectures.
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+_LIBCPP_BEGIN_NAMESPACE_STD
+template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
+struct __atomic_mutex_locked // false
+ mutable _Atomic(_Tp) __a_;
+ typedef lock_guard<mutex> lock_type;
+ _Tp& na(void) const { return reinterpret_cast<_Tp&>(__a_); }
+ volatile _Tp& na(void) const volatile { return reinterpret_cast<volatile _Tp&>(__a_); }
+ _LIBCPP_INLINE_VISIBILITY
+ bool is_lock_free() const volatile _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY
+ bool is_lock_free() const _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY