namespace __llvm_libc::cpp {
-#if LLVM_LIBC_HAS_BUILTIN(__builtin_bit_cast)
+#if LIBC_HAS_BUILTIN(__builtin_bit_cast)
#define LLVM_LIBC_HAS_BUILTIN_BIT_CAST
#endif
-#if LLVM_LIBC_HAS_BUILTIN(__builtin_memcpy_inline)
+#if LIBC_HAS_BUILTIN(__builtin_memcpy_inline)
#define LLVM_LIBC_HAS_BUILTIN_MEMCPY_INLINE
#endif
return {sum, carry_out};
}
-#if LLVM_LIBC_HAS_BUILTIN(__builtin_addc)
+#if LIBC_HAS_BUILTIN(__builtin_addc)
// https://clang.llvm.org/docs/LanguageExtensions.html#multiprecision-arithmetic-builtins
template <>
return result;
}
-#endif // LLVM_LIBC_HAS_BUILTIN(__builtin_addc)
+#endif // LIBC_HAS_BUILTIN(__builtin_addc)
// Subtract with borrow
DEFINE_NAMED_PAIR_TEMPLATE(DiffBorrow, diff, borrow);
return {diff, borrow_out};
}
-#if LLVM_LIBC_HAS_BUILTIN(__builtin_subc)
+#if LIBC_HAS_BUILTIN(__builtin_subc)
// https://clang.llvm.org/docs/LanguageExtensions.html#multiprecision-arithmetic-builtins
template <>
return result;
}
-#endif // LLVM_LIBC_HAS_BUILTIN(__builtin_subc)
+#endif // LIBC_HAS_BUILTIN(__builtin_subc)
} // namespace __llvm_libc
// clang.llvm.org/docs/LanguageExtensions.html#has-builtin
#if defined(LIBC_COMPILER_IS_CLANG) || \
(defined(LIBC_COMPILER_IS_GCC) && (__GNUC__ >= 10))
-#define LLVM_LIBC_HAS_BUILTIN(BUILTIN) __has_builtin(BUILTIN)
+#define LIBC_HAS_BUILTIN(BUILTIN) __has_builtin(BUILTIN)
#else
-#define LLVM_LIBC_HAS_BUILTIN(BUILTIN) 0
+#define LIBC_HAS_BUILTIN(BUILTIN) 0
#endif
// Compiler feature-detection.
// clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension
#if defined(LIBC_COMPILER_IS_CLANG)
-#define LLVM_LIBC_HAS_FEATURE(FEATURE) __has_feature(FEATURE)
+#define LIBC_HAS_FEATURE(FEATURE) __has_feature(FEATURE)
#else
-#define LLVM_LIBC_HAS_FEATURE(FEATURE) 0
+#define LIBC_HAS_FEATURE(FEATURE) 0
#endif
#if defined(LIBC_COMPILER_IS_CLANG)
-#define LLVM_LIBC_LOOP_NOUNROLL _Pragma("nounroll")
+#define LIBC_LOOP_NOUNROLL _Pragma("nounroll")
#elif defined(LIBC_COMPILER_IS_GCC)
-#define LLVM_LIBC_LOOP_NOUNROLL _Pragma("GCC unroll 0")
+#define LIBC_LOOP_NOUNROLL _Pragma("GCC unroll 0")
#else
-#define LLVM_LIBC_LOOP_NOUNROLL
+#define LIBC_LOOP_NOUNROLL
#endif
#endif // LLVM_LIBC_SUPPORT_MACROS_COMPILER_FEATURES_H
#ifdef LIBC_HAVE_MEMORY_SANITIZER
#error "LIBC_HAVE_MEMORY_SANITIZER cannot be directly set."
#elif defined(MEMORY_SANITIZER) || defined(__SANITIZE_MEMORY__) || \
- (LLVM_LIBC_HAS_FEATURE(memory_sanitizer) && !defined(__native_client__))
+ (LIBC_HAS_FEATURE(memory_sanitizer) && !defined(__native_client__))
#define LIBC_HAVE_MEMORY_SANITIZER
#endif
#ifdef LIBC_HAVE_ADDRESS_SANITIZER
#error "LIBC_HAVE_ADDRESS_SANITIZER cannot be directly set."
#elif defined(ADDRESS_SANITIZER) || defined(__SANITIZE_ADDRESS__) || \
- LLVM_LIBC_HAS_FEATURE(address_sanitizer)
+ LIBC_HAS_FEATURE(address_sanitizer)
#define LIBC_HAVE_ADDRESS_SANITIZER
#endif
// HWAddressSanitizer (HWASan) is a fast, low memory overhead error detector.
#ifdef LIBC_HAVE_HWADDRESS_SANITIZER
#error "LIBC_HAVE_HWADDRESS_SANITIZER cannot be directly set."
-#elif LLVM_LIBC_HAS_FEATURE(hwaddress_sanitizer)
+#elif LIBC_HAS_FEATURE(hwaddress_sanitizer)
#define LIBC_HAVE_HWADDRESS_SANITIZER
#endif
[[maybe_unused]] LIBC_INLINE BcmpReturnType
inline_bcmp_embedded_tiny(CPtr p1, CPtr p2, size_t count) {
- LLVM_LIBC_LOOP_NOUNROLL
+ LIBC_LOOP_NOUNROLL
for (size_t offset = 0; offset < count; ++offset)
if (auto value = generic::Bcmp<1>::block(p1 + offset, p2 + offset))
return value;
namespace __llvm_libc {
[[maybe_unused]] LIBC_INLINE MemcmpReturnType
inline_memcmp_embedded_tiny(CPtr p1, CPtr p2, size_t count) {
- LLVM_LIBC_LOOP_NOUNROLL
+ LIBC_LOOP_NOUNROLL
for (size_t offset = 0; offset < count; ++offset)
if (auto value = generic::Memcmp<1>::block(p1 + offset, p2 + offset))
return value;
[[maybe_unused]] LIBC_INLINE void
inline_memcpy_embedded_tiny(Ptr __restrict dst, CPtr __restrict src,
size_t count) {
- LLVM_LIBC_LOOP_NOUNROLL
+ LIBC_LOOP_NOUNROLL
for (size_t offset = 0; offset < count; ++offset)
builtin::Memcpy<1>::block(dst + offset, src + offset);
}
if ((count == 0) || (dst == src))
return;
if (dst < src) {
- LLVM_LIBC_LOOP_NOUNROLL
+ LIBC_LOOP_NOUNROLL
for (size_t offset = 0; offset < count; ++offset)
builtin::Memcpy<1>::block(dst + offset, src + offset);
} else {
- LLVM_LIBC_LOOP_NOUNROLL
+ LIBC_LOOP_NOUNROLL
for (ptrdiff_t offset = count - 1; offset >= 0; --offset)
builtin::Memcpy<1>::block(dst + offset, src + offset);
}
[[maybe_unused]] LIBC_INLINE static void
inline_memset_embedded_tiny(Ptr dst, uint8_t value, size_t count) {
- LLVM_LIBC_LOOP_NOUNROLL
+ LIBC_LOOP_NOUNROLL
for (size_t offset = 0; offset < count; ++offset)
generic::Memset<1, 1>::block(dst + offset, value);
}
const size_t tail_offset = count - Size;
const auto tail_value = T::load(src + tail_offset);
size_t offset = 0;
- LLVM_LIBC_LOOP_NOUNROLL
+ LIBC_LOOP_NOUNROLL
do {
block(dst + offset, src + offset);
offset += Size;
static_assert(Size > 1, "a loop of size 1 does not need tail");
const auto head_value = T::load(src);
ptrdiff_t offset = count - Size;
- LLVM_LIBC_LOOP_NOUNROLL
+ LIBC_LOOP_NOUNROLL
do {
block(dst + offset, src + offset);
offset -= Size;
return reinterpret_cast<T *>(__builtin_assume_aligned(ptr, alignment));
}
-#if LLVM_LIBC_HAS_BUILTIN(__builtin_memcpy_inline)
+#if LIBC_HAS_BUILTIN(__builtin_memcpy_inline)
#define LLVM_LIBC_HAS_BUILTIN_MEMCPY_INLINE
#endif
-#if LLVM_LIBC_HAS_BUILTIN(__builtin_memset_inline)
+#if LIBC_HAS_BUILTIN(__builtin_memset_inline)
#define LLVM_LIBC_HAS_BUILTIN_MEMSET_INLINE
#endif
#include <stdint.h> // uintxx_t
#include <stdlib.h> // malloc/free
-#if LLVM_LIBC_HAS_FEATURE(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
+#if LIBC_HAS_FEATURE(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
#include <sanitizer/asan_interface.h>
#define ASAN_POISON_MEMORY_REGION(addr, size) \
__asan_poison_memory_region((addr), (size))