#ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_FMA_H
#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_FMA_H
-#include "src/__support/common.h"
#include "src/__support/macros/properties/architectures.h"
-#include "src/__support/macros/properties/cpu_features.h"
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#if defined(LIBC_TARGET_CPU_HAS_FMA)
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/type_traits.h"
-#include "src/__support/common.h"
#include "src/__support/macros/attributes.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include <limits.h>
#include <math.h>
#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_FMA_H
#include "src/__support/macros/properties/architectures.h"
-#include "src/__support/macros/properties/cpu_features.h"
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#if !defined(LIBC_TARGET_ARCH_IS_AARCH64)
#error "Invalid include"
#include "multiply_add.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/UInt.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include <stddef.h>
#include "FEnvImpl.h"
#include "FPBits.h"
#include "src/__support/CPP/optional.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
namespace __llvm_libc {
#include "src/__support/FPUtil/FloatProperties.h"
#include "src/__support/UInt128.h"
#include "src/__support/builtin_wrappers.h"
-#include "src/__support/common.h"
+#include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
namespace __llvm_libc {
namespace fputil {
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/builtin_wrappers.h"
-#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/math/generic/math_utils.h"
namespace __llvm_libc {
#include "src/__support/common.h"
#include "src/__support/macros/properties/architectures.h"
-#include "src/__support/macros/properties/cpu_features.h"
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
namespace __llvm_libc {
namespace fputil {
#ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_NEAREST_INTEGER_H
#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_NEAREST_INTEGER_H
-#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/__support/macros/properties/architectures.h"
#include "src/__support/macros/properties/cpu_features.h"
#ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_FMA_H
#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_FMA_H
-#include "src/__support/common.h"
#include "src/__support/macros/properties/architectures.h"
-#include "src/__support/macros/properties/cpu_features.h"
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#if !defined(LIBC_TARGET_ARCH_IS_X86_64)
#error "Invalid include"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/builtin_wrappers.h"
#include "src/__support/integer_utils.h"
-#include "src/__support/macros/attributes.h" // LIBC_UNLIKELY
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/__support/number_pair.h"
#include <stddef.h> // For size_t
#define LIBC_INLINE inline
#define LIBC_INLINE_ASM __asm__ __volatile__
-
-// We use a template to implement likely/unlikely to make sure that we don't
-// accidentally pass an integer.
-namespace __llvm_libc::details {
-template <typename T>
-constexpr LIBC_INLINE bool expects_bool_condition(T value, T expected) {
- return __builtin_expect(value, expected);
-}
-} // namespace __llvm_libc::details
-#define LIBC_LIKELY(x) __llvm_libc::details::expects_bool_condition(x, true)
-#define LIBC_UNLIKELY(x) __llvm_libc::details::expects_bool_condition(x, false)
-
#define LIBC_UNUSED __attribute__((unused))
#endif // LLVM_LIBC_SUPPORT_MACROS_ATTRIBUTES_H
#ifndef LLVM_LIBC_SUPPORT_MACROS_CONFIG_H
#define LLVM_LIBC_SUPPORT_MACROS_CONFIG_H
+#define LIBC_INLINE inline
+
// LIBC_HAS_BUILTIN()
//
// Checks whether the compiler supports a Clang Feature Checking Macro, and if
// Note: Use this macro to avoid an extra level of #ifdef __has_builtin check.
// http://releases.llvm.org/3.3/tools/clang/docs/LanguageExtensions.html
-
// Compiler builtin-detection.
// clang.llvm.org/docs/LanguageExtensions.html#has-builtin
#ifdef __has_builtin
#ifndef LLVM_LIBC_SRC_SUPPORT_MACROS_OPTIMIZATION_H
#define LLVM_LIBC_SRC_SUPPORT_MACROS_OPTIMIZATION_H
-#include "src/__support/macros/properties/compiler.h"
+#include "src/__support/macros/config.h" // LIBC_HAS_BUILTIN
+
+// We use a template to implement likely/unlikely to make sure that we don't
+// accidentally pass an integer.
+namespace __llvm_libc::details {
+template <typename T>
+constexpr LIBC_INLINE bool expects_bool_condition(T value, T expected) {
+ return __builtin_expect(value, expected);
+}
+} // namespace __llvm_libc::details
+#define LIBC_LIKELY(x) __llvm_libc::details::expects_bool_condition(x, true)
+#define LIBC_UNLIKELY(x) __llvm_libc::details::expects_bool_condition(x, false)
#if defined(LIBC_COMPILER_IS_CLANG)
#define LIBC_LOOP_NOUNROLL _Pragma("nounroll")
#include "src/__support/FPUtil/except_value_utils.h"
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/sqrt.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include <errno.h>
#include "src/__support/FPUtil/PolyEval.h"
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/sqrt.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/math/generic/common_constants.h"
#include "src/math/generic/explogxf.h"
#include "src/__support/FPUtil/except_value_utils.h"
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/sqrt.h"
-#include "src/__support/macros/properties/cpu_features.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include <errno.h>
#include "src/__support/FPUtil/PolyEval.h"
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/sqrt.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/math/generic/common_constants.h"
#include "src/math/generic/explogxf.h"
#include "src/math/atanf.h"
#include "math_utils.h"
#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/math/generic/inv_trigf_utils.h"
namespace __llvm_libc {
#include "src/math/atanhf.h"
#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/math/generic/explogxf.h"
namespace __llvm_libc {
#include "src/__support/FPUtil/except_value_utils.h"
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/common.h"
-#include "src/__support/macros/properties/cpu_features.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include <errno.h>
#include "src/math/coshf.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/multiply_add.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/math/generic/explogxf.h"
namespace __llvm_libc {
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/nearest_integer.h"
#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include <errno.h>
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/nearest_integer.h"
#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include <errno.h>
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/nearest_integer.h"
#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include <errno.h>
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/nearest_integer.h"
#include "src/__support/common.h"
-#include "src/__support/macros/properties/cpu_features.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include <errno.h>
#include "src/__support/FPUtil/dyadic_float.h"
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
namespace __llvm_libc {
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/common.h"
-#include "src/__support/macros/properties/cpu_features.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include <errno.h>
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/PolyEval.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/properties/cpu_features.h"
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#if defined(LIBC_TARGET_CPU_HAS_FMA)
#include "range_reduction_fma.h"
#include "src/__support/FPUtil/PolyEval.h"
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/common.h"
-#include "src/__support/macros/properties/cpu_features.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include <errno.h>
#include "src/math/sinhf.h"
#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/math/generic/explogxf.h"
namespace __llvm_libc {
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/FPUtil/nearest_integer.h"
#include "src/__support/common.h"
-#include "src/__support/macros/properties/cpu_features.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include <errno.h>
#include "src/math/tanhf.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/macros/properties/cpu_features.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include "src/math/generic/explogxf.h"
namespace __llvm_libc {
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_BCMP_IMPLEMENTATIONS_H
#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY LIBC_LOOP_NOUNROLL
#include "src/__support/macros/properties/architectures.h"
#include "src/string/memory_utils/op_aarch64.h"
#include "src/string/memory_utils/op_builtin.h"
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP_IMPLEMENTATIONS_H
#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY LIBC_LOOP_NOUNROLL
#include "src/__support/macros/properties/architectures.h"
#include "src/string/memory_utils/op_aarch64.h"
#include "src/string/memory_utils/op_builtin.h"
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_MEMCPY_IMPLEMENTATIONS_H
#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY LIBC_LOOP_NOUNROLL
#include "src/__support/macros/properties/architectures.h"
#include "src/string/memory_utils/op_aarch64.h"
#include "src/string/memory_utils/op_builtin.h"
#include "src/__support/common.h"
#include "src/__support/endian.h"
#include "src/__support/macros/optimization.h"
-#include "src/__support/macros/properties/compiler.h"
#include "src/string/memory_utils/op_builtin.h"
#include "src/string/memory_utils/utils.h"
#define LIBC_SRC_STRING_STRING_UTILS_H
#include "src/__support/CPP/bitset.h"
-#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
#include "src/string/memory_utils/bzero_implementations.h"
#include "src/string/memory_utils/memcpy_implementations.h"
#include <stddef.h> // For size_t
//===----------------------------------------------------------------------===//
#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include "src/math/exp2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
name = "__support_macros_optimization",
hdrs = ["src/__support/macros/optimization.h"],
deps = [
- ":__support_macros_properties_compiler",
+ ":__support_macros_config",
":libc_root",
],
)
"__support_cpp_type_traits",
"__support_integer_utils",
"__support_macros_attributes",
+ "__support_macros_optimization",
"__support_number_pair",
":libc_root",
],
":__support_fputil_nearest_integer_operations",
":__support_fputil_normal_float",
":__support_fputil_platform_defs",
+ ":__support_macros_optimization",
":__support_uint128",
":libc_root",
],
textual_hdrs = fma_platform_hdrs,
deps = [
":__support_builtin_wrappers",
- ":__support_common",
":__support_cpp_bit",
":__support_cpp_type_traits",
":__support_fputil_fenv_impl",
":__support_fputil_float_properties",
":__support_fputil_fp_bits",
+ ":__support_macros_optimization",
":__support_macros_properties_cpu_features",
":__support_uint128",
":libc_root",
# own.
textual_hdrs = nearest_integer_platform_hdrs,
deps = [
- ":__support_common",
":libc_root",
],
)
name = "sincosf_utils",
hdrs = ["src/math/generic/sincosf_utils.h"],
deps = [
- ":__support_common",
":__support_fputil_fp_bits",
":__support_fputil_polyeval",
":libc_root",
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
+ ":__support_macros_optimization",
":__support_macros_properties_cpu_features",
":common_constants",
],
name = "expf",
additional_deps = [
":__support_fputil_fma",
- ":__support_fputil_nearest_integer",
":__support_fputil_multiply_add",
+ ":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
+ ":__support_macros_optimization",
":common_constants",
],
)
name = "exp10f",
additional_deps = [
":__support_fputil_fma",
- ":__support_fputil_nearest_integer",
":__support_fputil_multiply_add",
+ ":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
+ ":__support_macros_optimization",
":common_constants",
":explogxf",
],
name = "exp2f",
additional_deps = [
":__support_fputil_fma",
- ":__support_fputil_nearest_integer",
":__support_fputil_multiply_add",
+ ":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
+ ":__support_macros_optimization",
":explogxf",
],
)
name = "sinhf",
additional_deps = [
":__support_fputil_fma",
- ":__support_fputil_nearest_integer",
":__support_fputil_multiply_add",
+ ":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
+ ":__support_macros_optimization",
":common_constants",
":explogxf",
],
name = "coshf",
additional_deps = [
":__support_fputil_fma",
- ":__support_fputil_nearest_integer",
":__support_fputil_multiply_add",
+ ":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
+ ":__support_macros_optimization",
":common_constants",
":explogxf",
],
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
+ ":__support_macros_optimization",
":__support_macros_properties_cpu_features",
":common_constants",
":explogxf",
name = "asinhf",
additional_deps = [
":__support_fputil_fma",
- ":__support_fputil_nearest_integer",
":__support_fputil_multiply_add",
+ ":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
":__support_fputil_sqrt",
+ ":__support_macros_optimization",
":common_constants",
":explogxf",
],
name = "acoshf",
additional_deps = [
":__support_fputil_fma",
- ":__support_fputil_nearest_integer",
":__support_fputil_multiply_add",
+ ":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
":__support_fputil_sqrt",
+ ":__support_macros_optimization",
":common_constants",
":explogxf",
],
name = "atanhf",
additional_deps = [
":__support_fputil_fma",
- ":__support_fputil_nearest_integer",
":__support_fputil_multiply_add",
+ ":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
+ ":__support_macros_optimization",
":common_constants",
":explogxf",
],
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
":__support_fputil_sqrt",
+ ":__support_macros_optimization",
":__support_macros_properties_cpu_features",
":inv_trigf_utils",
],
name = "acosf",
additional_deps = [
":__support_fputil_fma",
- ":__support_fputil_nearest_integer",
":__support_fputil_multiply_add",
+ ":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
":__support_fputil_sqrt",
+ ":__support_macros_optimization",
":inv_trigf_utils",
],
)
name = "atanf",
additional_deps = [
":__support_fputil_fma",
- ":__support_fputil_nearest_integer",
":__support_fputil_multiply_add",
+ ":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
+ ":__support_macros_optimization",
":inv_trigf_utils",
":math_utils",
],
additional_deps = [
":__support_fputil_fma",
":__support_fputil_multiply_add",
+ ":__support_macros_optimization",
":__support_macros_properties_cpu_features",
":sincosf_utils",
],
additional_deps = [
":__support_fputil_fma",
":__support_fputil_multiply_add",
+ ":__support_macros_optimization",
":__support_macros_properties_cpu_features",
":sincosf_utils",
],
":__support_fputil_fma",
":__support_fputil_multiply_add",
":__support_fputil_polyeval",
+ ":__support_macros_optimization",
":__support_macros_properties_cpu_features",
":range_reduction",
":sincosf_utils",
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
+ ":__support_macros_optimization",
":__support_macros_properties_cpu_features",
":range_reduction",
":sincosf_utils",
":__support_macros_attributes",
":__support_macros_config",
":__support_macros_optimization",
+ ":__support_macros_properties_cpu_features",
":libc_root",
],
)
deps = [
":__support_common",
":__support_cpp_bitset",
+ ":__support_macros_optimization",
":libc_root",
":string_memory_utils",
],
math_test(
name = "exp2f",
deps = [
+ "//libc:__support_macros_properties_cpu_features",
"//libc/utils/MPFRWrapper:mpfr_wrapper",
],
)