[llvm-branch-commits] [libc] [libc][math][c++23] Add next{after, down, toward, up}bf16 math functions (PR #153993)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Aug 16 20:22:47 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Krishna Pandey (krishna2803)
<details>
<summary>Changes</summary>
This PR adds the following basic math functions for BFloat16 type along with the tests:
- nextafterbf16
- nextdownbf16
- nexttowardbf16
- nextupbf16
---
Patch is 32.82 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/153993.diff
30 Files Affected:
- (modified) libc/config/baremetal/aarch64/entrypoints.txt (+4)
- (modified) libc/config/baremetal/arm/entrypoints.txt (+4)
- (modified) libc/config/baremetal/riscv/entrypoints.txt (+4)
- (modified) libc/config/darwin/aarch64/entrypoints.txt (+4)
- (modified) libc/config/darwin/x86_64/entrypoints.txt (+4)
- (modified) libc/config/gpu/amdgpu/entrypoints.txt (+4)
- (modified) libc/config/gpu/nvptx/entrypoints.txt (+4)
- (modified) libc/config/linux/aarch64/entrypoints.txt (+4)
- (modified) libc/config/linux/arm/entrypoints.txt (+4)
- (modified) libc/config/linux/riscv/entrypoints.txt (+4)
- (modified) libc/config/linux/x86_64/entrypoints.txt (+4)
- (modified) libc/config/windows/entrypoints.txt (+4)
- (modified) libc/docs/headers/math/index.rst (+4-4)
- (modified) libc/src/math/CMakeLists.txt (+4)
- (modified) libc/src/math/generic/CMakeLists.txt (+56)
- (added) libc/src/math/generic/nextafterbf16.cpp (+21)
- (added) libc/src/math/generic/nextdownbf16.cpp (+21)
- (added) libc/src/math/generic/nexttowardbf16.cpp (+22)
- (added) libc/src/math/generic/nextupbf16.cpp (+21)
- (added) libc/src/math/nextafterbf16.h (+21)
- (added) libc/src/math/nextdownbf16.h (+21)
- (added) libc/src/math/nexttowardbf16.h (+21)
- (added) libc/src/math/nextupbf16.h (+21)
- (modified) libc/test/src/math/smoke/CMakeLists.txt (+52)
- (modified) libc/test/src/math/smoke/NextAfterTest.h (+23-20)
- (modified) libc/test/src/math/smoke/NextTowardTest.h (+2-2)
- (added) libc/test/src/math/smoke/nextafterbf16_test.cpp (+14)
- (added) libc/test/src/math/smoke/nextdownbf16_test.cpp (+14)
- (added) libc/test/src/math/smoke/nexttowardbf16_test.cpp (+14)
- (added) libc/test/src/math/smoke/nextupbf16_test.cpp (+14)
``````````diff
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index c2710429b3cfd..26ee82d99192f 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -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
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 6e5389d542f80..00025d324fc2c 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -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
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 76da24d2cc876..c0ab0cf903c41 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -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
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index 5bfd6c863fabb..cd81756770ed4 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -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
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index 27d214d06cd0b..3aa54e027a42d 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -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
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index bc75956738e5a..3b42c0fd71547 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -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
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index c9688284df16c..b569327409849 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -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
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index e42bbb14ec119..4058e7155f34a 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -874,6 +874,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
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 60fc953c2b9f4..9002bd12d6733 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -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
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 1a03683d72e61..77d5bae188a3c 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -893,6 +893,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
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 9b4946b883626..b811fe79c174d 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -925,6 +925,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
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index b97e893567038..ec2fde253e898 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -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
diff --git a/libc/docs/headers/math/index.rst b/libc/docs/headers/math/index.rst
index 754c1a55cf449..591295659c3d4 100644
--- a/libc/docs/headers/math/index.rst
+++ b/libc/docs/headers/math/index.rst
@@ -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 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index f94120272ce66..3843247c4fa5b 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -431,23 +431,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)
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 1608bed87cb6b..822da74d7597e 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -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
@@ -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
@@ -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
@@ -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
diff --git a/libc/src/math/generic/nextafterbf16.cpp b/libc/src/math/generic/nextafterbf16.cpp
new file mode 100644
index 0000000000000..e21a2dcb3d664
--- /dev/null
+++ b/libc/src/math/generic/nextafterbf16.cpp
@@ -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
diff --git a/libc/src/math/generic/nextdownbf16.cpp b/libc/src/math/generic/nextdownbf16.cpp
new file mode 100644
index 0000000000000..2115df95ff072
--- /dev/null
+++ b/libc/src/math/generic/nextdownbf16.cpp
@@ -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
diff --git a/libc/src/math/generic/nexttowardbf16.cpp b/libc/src/math/generic/nexttowardbf16.cpp
new file mode 100644
index 0000000000000..3deab87575939
--- /dev/null
+++ b/libc/src/math/generic/nexttowardbf16.cpp
@@ -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
diff --git a/libc/src/math/generic/nextupbf16.cpp b/libc/src/math/generic/nextupbf16.cpp
new file mode 100644
index 0000000000000..147ce37477d9f
--- /dev/null
+++ b/libc/src/math/generic/nextupbf16.cpp
@@ -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
diff --git a/libc/src/math/nextafterbf16.h b/libc/src/math/nextafterbf16.h
new file mode 100644
index 0000000000000..f962c7c51e5cd
--- /dev/null
+++ b/libc/src/math/nextafterbf16.h
@@ -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
diff --git a/libc/src/math/nextdownbf16.h b/libc/src/math/nextdownbf16.h
new file mode 100644
index 0000000000000..36b0cd7cb9626
--- /dev/null
+++ b/libc/src/math/nextdownbf16.h
@@ -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
diff --git a/libc/src/math/nexttowardbf16.h b/libc/src/math/nexttowardbf16.h
new file mode 100644
index 0000000000000..930abf858ef51
--- /dev/null
+++ b/libc/src/math/nexttowardbf16.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for nexttowardbf16 ----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.tx...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/153993
More information about the llvm-branch-commits
mailing list