diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-11-08 15:56:02 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-11-08 15:56:02 -0800 |
commit | e0268fa1035a718341c53921eee9318d4a8033cd (patch) | |
tree | 2b3eeb07928f9521498332002444dbfa44f34dfb /system/include/libcxx/support/ibm/support.h | |
parent | a11272805c16be75f5e6d00c8214afcac7ba9d05 (diff) | |
parent | ad1da1e6685d4483e096d7e0bbd8e38e686bd322 (diff) |
Merge pull request #1767 from waywardmonkeys/update-libcxx1.7.2
Update libcxx
Diffstat (limited to 'system/include/libcxx/support/ibm/support.h')
-rw-r--r-- | system/include/libcxx/support/ibm/support.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/system/include/libcxx/support/ibm/support.h b/system/include/libcxx/support/ibm/support.h new file mode 100644 index 00000000..3effbaed --- /dev/null +++ b/system/include/libcxx/support/ibm/support.h @@ -0,0 +1,54 @@ +// -*- C++ -*- +//===----------------------- support/ibm/support.h ----------------------===// +// +// 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_SUPPORT_IBM_SUPPORT_H +#define _LIBCPP_SUPPORT_IBM_SUPPORT_H + +extern "builtin" int __popcnt4(unsigned int); +extern "builtin" int __popcnt8(unsigned long long); +extern "builtin" unsigned int __cnttz4(unsigned int); +extern "builtin" unsigned int __cnttz8(unsigned long long); +extern "builtin" unsigned int __cntlz4(unsigned long long); +extern "builtin" unsigned int __cntlz8(unsigned long long); + +// Builtin functions for counting population +#define __builtin_popcount(x) __popcnt4(x) +#define __builtin_popcountll(x) __popcnt8(x) +#if defined(__64BIT__) +#define __builtin_popcountl(x) __builtin_popcountll(x) +#else +#define __builtin_popcountl(x) __builtin_popcount(x) +#endif + +// Builtin functions for counting trailing zeros +#define __builtin_ctz(x) __cnttz4(x) +#define __builtin_ctzll(x) __cnttz8(x) +#if defined(__64BIT__) +#define __builtin_ctzl(x) __builtin_ctzll(x) +#else +#define __builtin_ctzl(x) __builtin_ctz(x) +#endif + +// Builtin functions for counting leading zeros +#define __builtin_clz(x) __cntlz4(x) +#define __builtin_clzll(x) __cntlz8(x) +#if defined(__64BIT__) +#define __builtin_clzl(x) __builtin_clzll(x) +#else +#define __builtin_clzl(x) __builtin_clz(x) +#endif + +#if defined(__64BIT__) +#define __SIZE_WIDTH__ 64 +#else +#define __SIZE_WIDTH__ 32 +#endif + +#endif // _LIBCPP_SUPPORT_IBM_SUPPORT_H |