Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libc/config/baremetal/aarch64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
Expand Down
4 changes: 4 additions & 0 deletions libc/config/baremetal/arm/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
Expand Down
4 changes: 4 additions & 0 deletions libc/config/baremetal/riscv/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
Expand Down
4 changes: 4 additions & 0 deletions libc/config/darwin/aarch64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
Expand Down
4 changes: 4 additions & 0 deletions libc/config/darwin/x86_64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
Expand Down
4 changes: 4 additions & 0 deletions libc/config/gpu/amdgpu/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
Expand Down
4 changes: 4 additions & 0 deletions libc/config/gpu/nvptx/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
Expand Down
4 changes: 4 additions & 0 deletions libc/config/linux/aarch64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
Expand Down
4 changes: 4 additions & 0 deletions libc/config/linux/arm/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
Expand Down
3 changes: 3 additions & 0 deletions libc/config/linux/riscv/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,9 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
Expand Down
4 changes: 4 additions & 0 deletions libc/config/linux/x86_64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
Expand Down
4 changes: 4 additions & 0 deletions libc/config/windows/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.fminimum_numbf16
libc.src.math.fromfpbf16
libc.src.math.fromfpxbf16
libc.src.math.nextafterbf16
libc.src.math.nextdownbf16
libc.src.math.nexttowardbf16
libc.src.math.nextupbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
Expand Down
8 changes: 4 additions & 4 deletions libc/docs/headers/math/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ Basic Operations
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| nearbyint | |check| | |check| | |check| | |check| | |check| | | 7.12.9.3 | F.10.6.3 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| nextafter | |check| | |check| | |check| | |check| | |check| | | 7.12.11.3 | F.10.8.3 |
| nextafter | |check| | |check| | |check| | |check| | |check| | |check| | 7.12.11.3 | F.10.8.3 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| nextdown | |check| | |check| | |check| | |check| | |check| | | 7.12.11.6 | F.10.8.6 |
| nextdown | |check| | |check| | |check| | |check| | |check| | |check| | 7.12.11.6 | F.10.8.6 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| nexttoward | |check| | |check| | |check| | |check| | N/A | | 7.12.11.4 | F.10.8.4 |
| nexttoward | |check| | |check| | |check| | |check| | N/A | |check| | 7.12.11.4 | F.10.8.4 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| nextup | |check| | |check| | |check| | |check| | |check| | | 7.12.11.5 | F.10.8.5 |
| nextup | |check| | |check| | |check| | |check| | |check| | |check| | 7.12.11.5 | F.10.8.5 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
| remainder | |check| | |check| | |check| | |check| | |check| | | 7.12.10.2 | F.10.7.2 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
Expand Down
4 changes: 4 additions & 0 deletions libc/src/math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -433,23 +433,27 @@ add_math_entrypoint_object(nextafterf)
add_math_entrypoint_object(nextafterl)
add_math_entrypoint_object(nextafterf16)
add_math_entrypoint_object(nextafterf128)
add_math_entrypoint_object(nextafterbf16)

add_math_entrypoint_object(nexttoward)
add_math_entrypoint_object(nexttowardf)
add_math_entrypoint_object(nexttowardl)
add_math_entrypoint_object(nexttowardf16)
add_math_entrypoint_object(nexttowardbf16)

add_math_entrypoint_object(nextdown)
add_math_entrypoint_object(nextdownf)
add_math_entrypoint_object(nextdownl)
add_math_entrypoint_object(nextdownf16)
add_math_entrypoint_object(nextdownf128)
add_math_entrypoint_object(nextdownbf16)

add_math_entrypoint_object(nextup)
add_math_entrypoint_object(nextupf)
add_math_entrypoint_object(nextupl)
add_math_entrypoint_object(nextupf16)
add_math_entrypoint_object(nextupf128)
add_math_entrypoint_object(nextupbf16)

add_math_entrypoint_object(pow)
add_math_entrypoint_object(powf)
Expand Down
56 changes: 56 additions & 0 deletions libc/src/math/generic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3496,6 +3496,20 @@ add_entrypoint_object(
libc.src.__support.FPUtil.manipulation_functions
)

add_entrypoint_object(
nextafterbf16
SRCS
nextafterbf16.cpp
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
)

add_entrypoint_object(
nexttoward
SRCS
Expand Down Expand Up @@ -3537,6 +3551,20 @@ add_entrypoint_object(
libc.src.__support.FPUtil.manipulation_functions
)

add_entrypoint_object(
nexttowardbf16
SRCS
nexttowardbf16.cpp
HDRS
../nexttowardbf16.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
)

add_entrypoint_object(
nextdown
SRCS
Expand Down Expand Up @@ -3589,6 +3617,20 @@ add_entrypoint_object(
libc.src.__support.FPUtil.manipulation_functions
)

add_entrypoint_object(
nextdownbf16
SRCS
nextdownbf16.cpp
HDRS
../nextdownbf16.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
)

add_entrypoint_object(
nextup
SRCS
Expand Down Expand Up @@ -3641,6 +3683,20 @@ add_entrypoint_object(
libc.src.__support.FPUtil.manipulation_functions
)

add_entrypoint_object(
nextupbf16
SRCS
nextupbf16.cpp
HDRS
../nextupbf16.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
)

add_entrypoint_object(
fmod
SRCS
Expand Down
21 changes: 21 additions & 0 deletions libc/src/math/generic/nextafterbf16.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of nextafterbf16 function --------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#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"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(bfloat16, nextafterbf16, (bfloat16 x, bfloat16 y)) {
return fputil::nextafter(x, y);
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/math/generic/nextdownbf16.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of nextdownbf16 function ---------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "src/math/nextdownbf16.h"
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(bfloat16, nextdownbf16, (bfloat16 x)) {
return fputil::nextupdown</*IsDown=*/true>(x);
}

} // namespace LIBC_NAMESPACE_DECL
22 changes: 22 additions & 0 deletions libc/src/math/generic/nexttowardbf16.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===-- Implementation of nexttowardbf16 function -------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "src/math/nexttowardbf16.h"
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(bfloat16, nexttowardbf16, (bfloat16 x, long double y)) {
// nextafter<T, U> where T != U is nexttoward
return fputil::nextafter(x, y);
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/math/generic/nextupbf16.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation of nextupbf16 function -----------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "src/math/nextupbf16.h"
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"

namespace LIBC_NAMESPACE_DECL {

LLVM_LIBC_FUNCTION(bfloat16, nextupbf16, (bfloat16 x)) {
return fputil::nextupdown</*IsDown=*/false>(x);
}

} // namespace LIBC_NAMESPACE_DECL
21 changes: 21 additions & 0 deletions libc/src/math/nextafterbf16.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- 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_MATH_NEXTAFTERBF16_H
#define LLVM_LIBC_SRC_MATH_NEXTAFTERBF16_H

#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"

namespace LIBC_NAMESPACE_DECL {

bfloat16 nextafterbf16(bfloat16 x, bfloat16 y);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_MATH_NEXTAFTERBF16_H
21 changes: 21 additions & 0 deletions libc/src/math/nextdownbf16.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//===-- Implementation header for nextdownbf16 ------------------*- 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_MATH_NEXTDOWNBF16_H
#define LLVM_LIBC_SRC_MATH_NEXTDOWNBF16_H

#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"

namespace LIBC_NAMESPACE_DECL {

bfloat16 nextdownbf16(bfloat16 x);

} // namespace LIBC_NAMESPACE_DECL

#endif // LLVM_LIBC_SRC_MATH_NEXTDOWNBF16_H
Loading
Loading