Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc++] Refactoring __sync_* builtins; NFC (Reland)
Summary: Wrap __sync_* builtins with __libcpp_ functions to facility future customizations as atomic operations are unavailable on some targets. Reviewers: danalbert, EricWF, jroelofs Subscribers: joerg, llvm-commits Differential Revision: https://reviews.llvm.org/D34918 llvm-svn: 307595
- Loading branch information
Weiming Zhao
committed
Jul 10, 2017
1 parent
50daf5f
commit f7850fa
Showing
5 changed files
with
47 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// -*- C++ -*- | ||
//===------------------------ __atomic_support -----------------------------===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is dual licensed under the MIT and the University of Illinois Open | ||
// Source Licenses. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef _LIBCPP___ATOMIC_SUPPORT | ||
#define _LIBCPP___ATOMIC_SUPPORT | ||
|
||
#include <__config> | ||
|
||
template<typename T> | ||
T __libcpp_sync_add_and_fetch(T *ptr, T value) { | ||
return __sync_add_and_fetch(ptr, value); | ||
} | ||
|
||
template<typename T> | ||
T __libcpp_sync_fetch_and_add(T *ptr, T value) { | ||
return __sync_fetch_and_add(ptr, value); | ||
} | ||
|
||
template<typename T> | ||
T __libcpp_sync_lock_test_and_set(T *ptr, T value) { | ||
return __sync_lock_test_and_set(ptr, value); | ||
} | ||
|
||
#endif //_LIBCPP___ATOMIC_SUPPORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters