diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt --- a/libc/src/__support/CMakeLists.txt +++ b/libc/src/__support/CMakeLists.txt @@ -6,6 +6,12 @@ blockstore.h ) +add_header_library( + builtin_wrappers + HDRS + builtin_wrappers.h +) + add_header_library( common HDRS @@ -62,7 +68,7 @@ libc.include.errno libc.src.__support.CPP.limits libc.src.__support.FPUtil.fp_bits - libc.src.__support.FPUtil.builtin_wrappers + libc.src.__support.builtin_wrappers libc.src.errno.errno ) diff --git a/libc/src/__support/FPUtil/CMakeLists.txt b/libc/src/__support/FPUtil/CMakeLists.txt --- a/libc/src/__support/FPUtil/CMakeLists.txt +++ b/libc/src/__support/FPUtil/CMakeLists.txt @@ -1,9 +1,3 @@ -add_header_library( - builtin_wrappers - HDRS - builtin_wrappers.h -) - add_header_library( fenv_impl HDRS @@ -37,7 +31,7 @@ DEPENDS .platform_defs .float_properties - .builtin_wrappers + libc.src.__support.builtin_wrappers libc.src.__support.CPP.bit libc.src.__support.CPP.type_traits libc.src.__support.common @@ -119,7 +113,7 @@ .basic_operations .fenv_impl .fp_bits - .builtin_wrappers + libc.src.__support.builtin_wrappers libc.src.__support.CPP.bit libc.src.__support.CPP.type_traits libc.src.__support.uint128 diff --git a/libc/src/__support/FPUtil/FPBits.h b/libc/src/__support/FPUtil/FPBits.h --- a/libc/src/__support/FPUtil/FPBits.h +++ b/libc/src/__support/FPUtil/FPBits.h @@ -13,7 +13,7 @@ #include "src/__support/CPP/bit.h" #include "src/__support/CPP/type_traits.h" -#include "src/__support/FPUtil/builtin_wrappers.h" +#include "src/__support/builtin_wrappers.h" #include "src/__support/common.h" #include "FloatProperties.h" @@ -183,7 +183,7 @@ inline static constexpr FPBits make_value(UIntType number, int ep) { FPBits result; // offset: +1 for sign, but -1 for implicit first bit - int lz = fputil::unsafe_clz(number) - FloatProp::EXPONENT_WIDTH; + int lz = unsafe_clz(number) - FloatProp::EXPONENT_WIDTH; number <<= lz; ep -= lz; diff --git a/libc/src/__support/FPUtil/Hypot.h b/libc/src/__support/FPUtil/Hypot.h --- a/libc/src/__support/FPUtil/Hypot.h +++ b/libc/src/__support/FPUtil/Hypot.h @@ -12,10 +12,10 @@ #include "BasicOperations.h" #include "FEnvImpl.h" #include "FPBits.h" -#include "builtin_wrappers.h" #include "src/__support/CPP/bit.h" #include "src/__support/CPP/type_traits.h" #include "src/__support/UInt128.h" +#include "src/__support/builtin_wrappers.h" namespace __llvm_libc { namespace fputil { diff --git a/libc/src/__support/FPUtil/generic/FMA.h b/libc/src/__support/FPUtil/generic/FMA.h --- a/libc/src/__support/FPUtil/generic/FMA.h +++ b/libc/src/__support/FPUtil/generic/FMA.h @@ -13,8 +13,8 @@ #include "src/__support/FPUtil/FEnvImpl.h" #include "src/__support/FPUtil/FPBits.h" #include "src/__support/FPUtil/FloatProperties.h" -#include "src/__support/FPUtil/builtin_wrappers.h" #include "src/__support/UInt128.h" +#include "src/__support/builtin_wrappers.h" #include "src/__support/common.h" namespace __llvm_libc { diff --git a/libc/src/__support/FPUtil/generic/FMod.h b/libc/src/__support/FPUtil/generic/FMod.h --- a/libc/src/__support/FPUtil/generic/FMod.h +++ b/libc/src/__support/FPUtil/generic/FMod.h @@ -13,7 +13,7 @@ #include "src/__support/CPP/type_traits.h" #include "src/__support/FPUtil/FEnvImpl.h" #include "src/__support/FPUtil/FPBits.h" -#include "src/__support/FPUtil/builtin_wrappers.h" +#include "src/__support/builtin_wrappers.h" #include "src/__support/common.h" #include "src/math/generic/math_utils.h" diff --git a/libc/src/__support/FPUtil/generic/sqrt.h b/libc/src/__support/FPUtil/generic/sqrt.h --- a/libc/src/__support/FPUtil/generic/sqrt.h +++ b/libc/src/__support/FPUtil/generic/sqrt.h @@ -15,8 +15,8 @@ #include "src/__support/FPUtil/FEnvImpl.h" #include "src/__support/FPUtil/FPBits.h" #include "src/__support/FPUtil/PlatformDefs.h" -#include "src/__support/FPUtil/builtin_wrappers.h" #include "src/__support/UInt128.h" +#include "src/__support/builtin_wrappers.h" namespace __llvm_libc { namespace fputil { diff --git a/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h b/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h --- a/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h +++ b/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h @@ -12,8 +12,8 @@ #include "src/__support/FPUtil/FEnvImpl.h" #include "src/__support/FPUtil/FPBits.h" #include "src/__support/FPUtil/PlatformDefs.h" -#include "src/__support/FPUtil/builtin_wrappers.h" #include "src/__support/UInt128.h" +#include "src/__support/builtin_wrappers.h" namespace __llvm_libc { namespace fputil { diff --git a/libc/src/__support/FPUtil/builtin_wrappers.h b/libc/src/__support/builtin_wrappers.h rename from libc/src/__support/FPUtil/builtin_wrappers.h rename to libc/src/__support/builtin_wrappers.h --- a/libc/src/__support/FPUtil/builtin_wrappers.h +++ b/libc/src/__support/builtin_wrappers.h @@ -7,11 +7,10 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_BUILTIN_WRAPPERS_H -#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_BUILTIN_WRAPPERS_H +#ifndef LLVM_LIBC_SRC_SUPPORT_BUILTIN_WRAPPERS_H +#define LLVM_LIBC_SRC_SUPPORT_BUILTIN_WRAPPERS_H namespace __llvm_libc { -namespace fputil { // The following overloads are matched based on what is accepted by // __builtin_clz/ctz* rather than using the exactly-sized aliases from stdint.h. @@ -65,7 +64,6 @@ return __internal::clz(val); } -} // namespace fputil } // namespace __llvm_libc -#endif // LLVM_LIBC_SRC_SUPPORT_FPUTIL_BUILTIN_WRAPPERS_H +#endif // LLVM_LIBC_SRC_SUPPORT_BUILTIN_WRAPPERS_H diff --git a/libc/src/__support/str_to_float.h b/libc/src/__support/str_to_float.h --- a/libc/src/__support/str_to_float.h +++ b/libc/src/__support/str_to_float.h @@ -11,8 +11,8 @@ #include "src/__support/CPP/limits.h" #include "src/__support/FPUtil/FPBits.h" -#include "src/__support/FPUtil/builtin_wrappers.h" #include "src/__support/UInt128.h" +#include "src/__support/builtin_wrappers.h" #include "src/__support/ctype_utils.h" #include "src/__support/detailed_powers_of_ten.h" #include "src/__support/high_precision_decimal.h" @@ -52,11 +52,11 @@ } template <> uint32_t inline leading_zeroes(uint32_t inputNumber) { - return fputil::safe_clz(inputNumber); + return safe_clz(inputNumber); } template <> uint32_t inline leading_zeroes(uint64_t inputNumber) { - return fputil::safe_clz(inputNumber); + return safe_clz(inputNumber); } static inline uint64_t low64(const UInt128 &num) { diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel @@ -168,7 +168,7 @@ "src/__support/FPUtil/NearestIntegerOperations.h", "src/__support/FPUtil/NormalFloat.h", "src/__support/FPUtil/PlatformDefs.h", - "src/__support/FPUtil/builtin_wrappers.h", + "src/__support/builtin_wrappers.h", "src/__support/FPUtil/except_value_utils.h", ]