[libc][math] Refactor nextafter family to header-only (#181673)
closes #181672
This commit is contained in:
parent
20ec9a9bb7
commit
7e39b280e8
@ -170,6 +170,12 @@
|
||||
#include "math/logbl.h"
|
||||
#include "math/logf.h"
|
||||
#include "math/logf16.h"
|
||||
#include "math/nextafter.h"
|
||||
#include "math/nextafterbf16.h"
|
||||
#include "math/nextafterf.h"
|
||||
#include "math/nextafterf128.h"
|
||||
#include "math/nextafterf16.h"
|
||||
#include "math/nextafterl.h"
|
||||
#include "math/nextdown.h"
|
||||
#include "math/nextdownbf16.h"
|
||||
#include "math/nextdownf.h"
|
||||
|
||||
23
libc/shared/math/nextafter.h
Normal file
23
libc/shared/math/nextafter.h
Normal file
@ -0,0 +1,23 @@
|
||||
//===-- Shared nextafter function -------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_MATH_NEXTAFTER_H
|
||||
#define LLVM_LIBC_SHARED_MATH_NEXTAFTER_H
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/math/nextafter.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using math::nextafter;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_MATH_NEXTAFTER_H
|
||||
23
libc/shared/math/nextafterbf16.h
Normal file
23
libc/shared/math/nextafterbf16.h
Normal file
@ -0,0 +1,23 @@
|
||||
//===-- Shared nextafterbf16 function ---------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_MATH_NEXTAFTERBF16_H
|
||||
#define LLVM_LIBC_SHARED_MATH_NEXTAFTERBF16_H
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/math/nextafterbf16.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using math::nextafterbf16;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_MATH_NEXTAFTERBF16_H
|
||||
23
libc/shared/math/nextafterf.h
Normal file
23
libc/shared/math/nextafterf.h
Normal file
@ -0,0 +1,23 @@
|
||||
//===-- Shared nextafterf function ------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_MATH_NEXTAFTERF_H
|
||||
#define LLVM_LIBC_SHARED_MATH_NEXTAFTERF_H
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/math/nextafterf.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using math::nextafterf;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_MATH_NEXTAFTERF_H
|
||||
29
libc/shared/math/nextafterf128.h
Normal file
29
libc/shared/math/nextafterf128.h
Normal file
@ -0,0 +1,29 @@
|
||||
//===-- Shared nextafterf128 function ---------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_MATH_NEXTAFTERF128_H
|
||||
#define LLVM_LIBC_SHARED_MATH_NEXTAFTERF128_H
|
||||
|
||||
#include "include/llvm-libc-types/float128.h"
|
||||
|
||||
#ifdef LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/math/nextafterf128.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using math::nextafterf128;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_MATH_NEXTAFTERF128_H
|
||||
29
libc/shared/math/nextafterf16.h
Normal file
29
libc/shared/math/nextafterf16.h
Normal file
@ -0,0 +1,29 @@
|
||||
//===-- Shared nextafterf16 function ----------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_MATH_NEXTAFTERF16_H
|
||||
#define LLVM_LIBC_SHARED_MATH_NEXTAFTERF16_H
|
||||
|
||||
#include "include/llvm-libc-macros/float16-macros.h"
|
||||
|
||||
#ifdef LIBC_TYPES_HAS_FLOAT16
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/math/nextafterf16.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using math::nextafterf16;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LIBC_TYPES_HAS_FLOAT16
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_MATH_NEXTAFTERF16_H
|
||||
23
libc/shared/math/nextafterl.h
Normal file
23
libc/shared/math/nextafterl.h
Normal file
@ -0,0 +1,23 @@
|
||||
//===-- Shared nextafterl function ------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SHARED_MATH_NEXTAFTERL_H
|
||||
#define LLVM_LIBC_SHARED_MATH_NEXTAFTERL_H
|
||||
|
||||
#include "shared/libc_common.h"
|
||||
#include "src/__support/math/nextafterl.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
namespace shared {
|
||||
|
||||
using math::nextafterl;
|
||||
|
||||
} // namespace shared
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SHARED_MATH_NEXTAFTERL_H
|
||||
@ -1848,6 +1848,63 @@ add_header_library(
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
nextafter
|
||||
HDRS
|
||||
nextafter.h
|
||||
DEPENDS
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
nextafterbf16
|
||||
HDRS
|
||||
nextafterbf16.h
|
||||
DEPENDS
|
||||
libc.src.__support.FPUtil.bfloat16
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
nextafterf
|
||||
HDRS
|
||||
nextafterf.h
|
||||
DEPENDS
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
nextafterf128
|
||||
HDRS
|
||||
nextafterf128.h
|
||||
DEPENDS
|
||||
libc.include.llvm-libc-types.float128
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
nextafterf16
|
||||
HDRS
|
||||
nextafterf16.h
|
||||
DEPENDS
|
||||
libc.include.llvm-libc-macros.float16_macros
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
nextafterl
|
||||
HDRS
|
||||
nextafterl.h
|
||||
DEPENDS
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
libc.src.__support.macros.config
|
||||
)
|
||||
|
||||
add_header_library(
|
||||
nexttoward
|
||||
HDRS
|
||||
|
||||
26
libc/src/__support/math/nextafter.h
Normal file
26
libc/src/__support/math/nextafter.h
Normal file
@ -0,0 +1,26 @@
|
||||
//===-- Implementation header for nextafter ---------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTER_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTER_H
|
||||
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
namespace math {
|
||||
|
||||
LIBC_INLINE double nextafter(double x, double y) {
|
||||
return fputil::nextafter(x, y);
|
||||
}
|
||||
|
||||
} // namespace math
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTER_H
|
||||
27
libc/src/__support/math/nextafterbf16.h
Normal file
27
libc/src/__support/math/nextafterbf16.h
Normal file
@ -0,0 +1,27 @@
|
||||
//===-- Implementation header for nextafterbf16 -----------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERBF16_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERBF16_H
|
||||
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/FPUtil/bfloat16.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
namespace math {
|
||||
|
||||
LIBC_INLINE bfloat16 nextafterbf16(bfloat16 x, bfloat16 y) {
|
||||
return fputil::nextafter(x, y);
|
||||
}
|
||||
|
||||
} // namespace math
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERBF16_H
|
||||
26
libc/src/__support/math/nextafterf.h
Normal file
26
libc/src/__support/math/nextafterf.h
Normal file
@ -0,0 +1,26 @@
|
||||
//===-- Implementation header for nextafterf --------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF_H
|
||||
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
namespace math {
|
||||
|
||||
LIBC_INLINE float nextafterf(float x, float y) {
|
||||
return fputil::nextafter(x, y);
|
||||
}
|
||||
|
||||
} // namespace math
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF_H
|
||||
32
libc/src/__support/math/nextafterf128.h
Normal file
32
libc/src/__support/math/nextafterf128.h
Normal file
@ -0,0 +1,32 @@
|
||||
//===-- Implementation header for nextafterf128 -----------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF128_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF128_H
|
||||
|
||||
#include "include/llvm-libc-types/float128.h"
|
||||
|
||||
#ifdef LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
namespace math {
|
||||
|
||||
LIBC_INLINE float128 nextafterf128(float128 x, float128 y) {
|
||||
return fputil::nextafter(x, y);
|
||||
}
|
||||
|
||||
} // namespace math
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LIBC_TYPES_HAS_FLOAT128
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF128_H
|
||||
32
libc/src/__support/math/nextafterf16.h
Normal file
32
libc/src/__support/math/nextafterf16.h
Normal file
@ -0,0 +1,32 @@
|
||||
//===-- Implementation header for nextafterf16 ------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF16_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF16_H
|
||||
|
||||
#include "include/llvm-libc-macros/float16-macros.h"
|
||||
|
||||
#ifdef LIBC_TYPES_HAS_FLOAT16
|
||||
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
namespace math {
|
||||
|
||||
LIBC_INLINE float16 nextafterf16(float16 x, float16 y) {
|
||||
return fputil::nextafter(x, y);
|
||||
}
|
||||
|
||||
} // namespace math
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LIBC_TYPES_HAS_FLOAT16
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERF16_H
|
||||
26
libc/src/__support/math/nextafterl.h
Normal file
26
libc/src/__support/math/nextafterl.h
Normal file
@ -0,0 +1,26 @@
|
||||
//===-- Implementation header for nextafterl --------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERL_H
|
||||
#define LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERL_H
|
||||
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
namespace math {
|
||||
|
||||
LIBC_INLINE long double nextafterl(long double x, long double y) {
|
||||
return fputil::nextafter(x, y);
|
||||
}
|
||||
|
||||
} // namespace math
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_NEXTAFTERL_H
|
||||
@ -3345,7 +3345,7 @@ add_entrypoint_object(
|
||||
HDRS
|
||||
../nextafter.h
|
||||
DEPENDS
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
libc.src.__support.math.nextafter
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
@ -3355,7 +3355,7 @@ add_entrypoint_object(
|
||||
HDRS
|
||||
../nextafterf.h
|
||||
DEPENDS
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
libc.src.__support.math.nextafterf
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
@ -3365,7 +3365,7 @@ add_entrypoint_object(
|
||||
HDRS
|
||||
../nextafterl.h
|
||||
DEPENDS
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
libc.src.__support.math.nextafterl
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
@ -3375,8 +3375,7 @@ add_entrypoint_object(
|
||||
HDRS
|
||||
../nextafterf16.h
|
||||
DEPENDS
|
||||
libc.src.__support.macros.properties.types
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
libc.src.__support.math.nextafterf16
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
@ -3386,8 +3385,7 @@ add_entrypoint_object(
|
||||
HDRS
|
||||
../nextafterf128.h
|
||||
DEPENDS
|
||||
libc.src.__support.macros.properties.types
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
libc.src.__support.math.nextafterf128
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
@ -3397,11 +3395,7 @@ add_entrypoint_object(
|
||||
HDRS
|
||||
../nextafterbf16.h
|
||||
DEPENDS
|
||||
libc.src.__support.common
|
||||
libc.src.__support.FPUtil.bfloat16
|
||||
libc.src.__support.FPUtil.manipulation_functions
|
||||
libc.src.__support.macros.config
|
||||
libc.src.__support.macros.properties.types
|
||||
libc.src.__support.math.nextafterbf16
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
|
||||
@ -7,14 +7,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/math/nextafter.h"
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/common.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include "src/__support/math/nextafter.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
LLVM_LIBC_FUNCTION(double, nextafter, (double x, double y)) {
|
||||
return fputil::nextafter(x, y);
|
||||
return math::nextafter(x, y);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
@ -7,15 +7,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/math/nextafterbf16.h"
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/FPUtil/bfloat16.h"
|
||||
#include "src/__support/common.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include "src/__support/math/nextafterbf16.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
LLVM_LIBC_FUNCTION(bfloat16, nextafterbf16, (bfloat16 x, bfloat16 y)) {
|
||||
return fputil::nextafter(x, y);
|
||||
return math::nextafterbf16(x, y);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
@ -7,14 +7,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/math/nextafterf.h"
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/common.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include "src/__support/math/nextafterf.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
LLVM_LIBC_FUNCTION(float, nextafterf, (float x, float y)) {
|
||||
return fputil::nextafter(x, y);
|
||||
return math::nextafterf(x, y);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
@ -7,14 +7,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/math/nextafterf128.h"
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/common.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include "src/__support/math/nextafterf128.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
LLVM_LIBC_FUNCTION(float128, nextafterf128, (float128 x, float128 y)) {
|
||||
return fputil::nextafter(x, y);
|
||||
return math::nextafterf128(x, y);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
@ -7,14 +7,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/math/nextafterf16.h"
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/common.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include "src/__support/math/nextafterf16.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
LLVM_LIBC_FUNCTION(float16, nextafterf16, (float16 x, float16 y)) {
|
||||
return fputil::nextafter(x, y);
|
||||
return math::nextafterf16(x, y);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
@ -7,14 +7,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "src/math/nextafterl.h"
|
||||
#include "src/__support/FPUtil/ManipulationFunctions.h"
|
||||
#include "src/__support/common.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
#include "src/__support/math/nextafterl.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
LLVM_LIBC_FUNCTION(long double, nextafterl, (long double x, long double y)) {
|
||||
return fputil::nextafter(x, y);
|
||||
return math::nextafterl(x, y);
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
@ -185,6 +185,12 @@ add_fp_unittest(
|
||||
libc.src.__support.math.nexttowardf
|
||||
libc.src.__support.math.nexttowardf16
|
||||
libc.src.__support.math.nexttowardl
|
||||
libc.src.__support.math.nextafter
|
||||
libc.src.__support.math.nextafterbf16
|
||||
libc.src.__support.math.nextafterf
|
||||
libc.src.__support.math.nextafterf16
|
||||
libc.src.__support.math.nextafterl
|
||||
libc.src.__support.math.nextafterf128
|
||||
libc.src.__support.math.pow
|
||||
libc.src.__support.math.powf
|
||||
libc.src.__support.math.rsqrtf
|
||||
|
||||
@ -135,6 +135,7 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
|
||||
EXPECT_FP_EQ(min_denormal, LIBC_NAMESPACE::shared::nextupf16(0.0f16));
|
||||
EXPECT_FP_EQ(0x0p+0f16,
|
||||
LIBC_NAMESPACE::shared::nexttowardf16(0.0f16, 0.0f16));
|
||||
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::nextafterf16(0.0f16, 0.0f16));
|
||||
}
|
||||
|
||||
#endif // LIBC_TYPES_HAS_FLOAT16
|
||||
@ -219,6 +220,7 @@ TEST(LlvmLibcSharedMathTest, AllFloat) {
|
||||
float min_denormal = FPBits::min_subnormal(Sign ::POS).get_val();
|
||||
EXPECT_FP_EQ(min_denormal, LIBC_NAMESPACE::shared::nextupf(0.0f));
|
||||
EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::nexttowardf(0.0f, 0.0f));
|
||||
EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::nextafterf(0.0f, 0.0f));
|
||||
}
|
||||
|
||||
TEST(LlvmLibcSharedMathTest, AllDouble) {
|
||||
@ -279,6 +281,7 @@ TEST(LlvmLibcSharedMathTest, AllDouble) {
|
||||
double min_denormal = FPBits::min_subnormal(Sign ::POS).get_val();
|
||||
EXPECT_FP_EQ(min_denormal, LIBC_NAMESPACE::shared::nextup(0.0));
|
||||
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::nexttoward(0.0, 0.0));
|
||||
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::nextafter(0.0, 0.0));
|
||||
}
|
||||
|
||||
TEST(LlvmLibcSharedMathTest, AllLongDouble) {
|
||||
@ -318,6 +321,7 @@ TEST(LlvmLibcSharedMathTest, AllLongDouble) {
|
||||
long double min_denormal = FPBits::min_subnormal(Sign ::POS).get_val();
|
||||
EXPECT_FP_EQ(min_denormal, LIBC_NAMESPACE::shared::nextupl(0.0L));
|
||||
EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::nexttowardl(0.0L, 0.0L));
|
||||
EXPECT_FP_EQ(0x0p+0L, LIBC_NAMESPACE::shared::nextafterl(0.0L, 0.0L));
|
||||
}
|
||||
|
||||
#ifdef LIBC_TYPES_HAS_FLOAT128
|
||||
@ -384,6 +388,8 @@ TEST(LlvmLibcSharedMathTest, AllFloat128) {
|
||||
LIBC_NAMESPACE::shared::nextdownf128(float128(0.0)));
|
||||
float128 min_denormal = FPBits::min_subnormal(Sign ::POS).get_val();
|
||||
EXPECT_FP_EQ(min_denormal, LIBC_NAMESPACE::shared::nextupf128(float128(0.0)));
|
||||
EXPECT_FP_EQ(float128(0.0), LIBC_NAMESPACE::shared::nextafterf128(
|
||||
float128(0.0), float128(0.0)));
|
||||
}
|
||||
|
||||
#endif // LIBC_TYPES_HAS_FLOAT128
|
||||
@ -431,4 +437,6 @@ TEST(LlvmLibcSharedMathTest, AllBFloat16) {
|
||||
|
||||
EXPECT_FP_EQ(bfloat16(0.0),
|
||||
LIBC_NAMESPACE::shared::nexttowardbf16(bfloat16(0.0), 0.0L));
|
||||
EXPECT_FP_EQ(bfloat16(0.0), LIBC_NAMESPACE::shared::nextafterbf16(
|
||||
bfloat16(0.0), bfloat16(0.0)));
|
||||
}
|
||||
|
||||
@ -4107,6 +4107,63 @@ libc_support_library(
|
||||
],
|
||||
)
|
||||
|
||||
libc_support_library(
|
||||
name = "__support_math_nextafter",
|
||||
hdrs = ["src/__support/math/nextafter.h"],
|
||||
deps = [
|
||||
":__support_fputil_manipulation_functions",
|
||||
":__support_macros_config",
|
||||
],
|
||||
)
|
||||
|
||||
libc_support_library(
|
||||
name = "__support_math_nextafterbf16",
|
||||
hdrs = ["src/__support/math/nextafterbf16.h"],
|
||||
deps = [
|
||||
":__support_fputil_bfloat16",
|
||||
":__support_fputil_manipulation_functions",
|
||||
":__support_macros_config",
|
||||
],
|
||||
)
|
||||
|
||||
libc_support_library(
|
||||
name = "__support_math_nextafterf",
|
||||
hdrs = ["src/__support/math/nextafterf.h"],
|
||||
deps = [
|
||||
":__support_fputil_manipulation_functions",
|
||||
":__support_macros_config",
|
||||
],
|
||||
)
|
||||
|
||||
libc_support_library(
|
||||
name = "__support_math_nextafterf128",
|
||||
hdrs = ["src/__support/math/nextafterf128.h"],
|
||||
deps = [
|
||||
":__support_fputil_manipulation_functions",
|
||||
":__support_macros_config",
|
||||
":llvm_libc_types_float128",
|
||||
],
|
||||
)
|
||||
|
||||
libc_support_library(
|
||||
name = "__support_math_nextafterf16",
|
||||
hdrs = ["src/__support/math/nextafterf16.h"],
|
||||
deps = [
|
||||
":__support_fputil_manipulation_functions",
|
||||
":__support_macros_config",
|
||||
":llvm_libc_macros_float16_macros",
|
||||
],
|
||||
)
|
||||
|
||||
libc_support_library(
|
||||
name = "__support_math_nextafterl",
|
||||
hdrs = ["src/__support/math/nextafterl.h"],
|
||||
deps = [
|
||||
":__support_fputil_manipulation_functions",
|
||||
":__support_macros_config",
|
||||
],
|
||||
)
|
||||
|
||||
libc_support_library(
|
||||
name = "__support_math_nextdown",
|
||||
hdrs = ["src/__support/math/nextdown.h"],
|
||||
@ -7196,18 +7253,46 @@ libc_math_function(
|
||||
name = "nearbyintf16",
|
||||
)
|
||||
|
||||
libc_math_function(name = "nextafter")
|
||||
libc_math_function(
|
||||
name = "nextafter",
|
||||
additional_deps = [
|
||||
":__support_math_nextafter",
|
||||
],
|
||||
)
|
||||
|
||||
libc_math_function(name = "nextafterf")
|
||||
libc_math_function(
|
||||
name = "nextafterbf16",
|
||||
additional_deps = [
|
||||
":__support_math_nextafterbf16",
|
||||
],
|
||||
)
|
||||
|
||||
libc_math_function(name = "nextafterl")
|
||||
libc_math_function(
|
||||
name = "nextafterf",
|
||||
additional_deps = [
|
||||
":__support_math_nextafterf",
|
||||
],
|
||||
)
|
||||
|
||||
libc_math_function(
|
||||
name = "nextafterl",
|
||||
additional_deps = [
|
||||
":__support_math_nextafterl",
|
||||
],
|
||||
)
|
||||
|
||||
libc_math_function(
|
||||
name = "nextafterf128",
|
||||
additional_deps = [
|
||||
":__support_math_nextafterf128",
|
||||
],
|
||||
)
|
||||
|
||||
libc_math_function(
|
||||
name = "nextafterf16",
|
||||
additional_deps = [
|
||||
":__support_math_nextafterf16",
|
||||
],
|
||||
)
|
||||
|
||||
libc_math_function(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user