Compare commits
13 Commits
main
...
users/kris
Author | SHA1 | Date | |
---|---|---|---|
![]() |
090649a8e7 | ||
![]() |
24a0888f6e | ||
![]() |
36c4e5ca37 | ||
![]() |
1e33fe25e2 | ||
![]() |
6092968769 | ||
![]() |
12f1923f5e | ||
![]() |
a98b9281d8 | ||
![]() |
446e63718e | ||
![]() |
4a80312010 | ||
![]() |
733f4f17cc | ||
![]() |
baaf0e03e1 | ||
![]() |
0a2b5278c8 | ||
![]() |
b58785d627 |
@ -787,6 +787,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
libc.src.math.fromfpbf16
|
libc.src.math.fromfpbf16
|
||||||
libc.src.math.fromfpxbf16
|
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.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
@ -790,6 +790,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
libc.src.math.fromfpbf16
|
libc.src.math.fromfpbf16
|
||||||
libc.src.math.fromfpxbf16
|
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.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
@ -790,6 +790,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
libc.src.math.fromfpbf16
|
libc.src.math.fromfpbf16
|
||||||
libc.src.math.fromfpxbf16
|
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.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
@ -620,6 +620,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
libc.src.math.fromfpbf16
|
libc.src.math.fromfpbf16
|
||||||
libc.src.math.fromfpxbf16
|
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.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
@ -263,6 +263,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
libc.src.math.fromfpbf16
|
libc.src.math.fromfpbf16
|
||||||
libc.src.math.fromfpxbf16
|
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.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
@ -646,6 +646,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
libc.src.math.fromfpbf16
|
libc.src.math.fromfpbf16
|
||||||
libc.src.math.fromfpxbf16
|
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.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
@ -647,6 +647,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
libc.src.math.fromfpbf16
|
libc.src.math.fromfpbf16
|
||||||
libc.src.math.fromfpxbf16
|
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.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
@ -875,6 +875,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
libc.src.math.fromfpbf16
|
libc.src.math.fromfpbf16
|
||||||
libc.src.math.fromfpxbf16
|
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.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
@ -490,6 +490,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
libc.src.math.fromfpbf16
|
libc.src.math.fromfpbf16
|
||||||
libc.src.math.fromfpxbf16
|
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.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
@ -893,6 +893,9 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
libc.src.math.fromfpbf16
|
libc.src.math.fromfpbf16
|
||||||
libc.src.math.fromfpxbf16
|
libc.src.math.fromfpxbf16
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
libc.src.math.roundbf16
|
libc.src.math.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
@ -926,6 +926,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
libc.src.math.fromfpbf16
|
libc.src.math.fromfpbf16
|
||||||
libc.src.math.fromfpxbf16
|
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.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
@ -336,6 +336,10 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
|
|||||||
libc.src.math.fminimum_numbf16
|
libc.src.math.fminimum_numbf16
|
||||||
libc.src.math.fromfpbf16
|
libc.src.math.fromfpbf16
|
||||||
libc.src.math.fromfpxbf16
|
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.roundbf16
|
||||||
libc.src.math.roundevenbf16
|
libc.src.math.roundevenbf16
|
||||||
libc.src.math.truncbf16
|
libc.src.math.truncbf16
|
||||||
|
@ -215,13 +215,13 @@ Basic Operations
|
|||||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
||||||
| nearbyint | |check| | |check| | |check| | |check| | |check| | | 7.12.9.3 | F.10.6.3 |
|
| 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 |
|
| remainder | |check| | |check| | |check| | |check| | |check| | | 7.12.10.2 | F.10.7.2 |
|
||||||
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+------------------------+----------------------------+
|
||||||
|
@ -433,23 +433,27 @@ add_math_entrypoint_object(nextafterf)
|
|||||||
add_math_entrypoint_object(nextafterl)
|
add_math_entrypoint_object(nextafterl)
|
||||||
add_math_entrypoint_object(nextafterf16)
|
add_math_entrypoint_object(nextafterf16)
|
||||||
add_math_entrypoint_object(nextafterf128)
|
add_math_entrypoint_object(nextafterf128)
|
||||||
|
add_math_entrypoint_object(nextafterbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(nexttoward)
|
add_math_entrypoint_object(nexttoward)
|
||||||
add_math_entrypoint_object(nexttowardf)
|
add_math_entrypoint_object(nexttowardf)
|
||||||
add_math_entrypoint_object(nexttowardl)
|
add_math_entrypoint_object(nexttowardl)
|
||||||
add_math_entrypoint_object(nexttowardf16)
|
add_math_entrypoint_object(nexttowardf16)
|
||||||
|
add_math_entrypoint_object(nexttowardbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(nextdown)
|
add_math_entrypoint_object(nextdown)
|
||||||
add_math_entrypoint_object(nextdownf)
|
add_math_entrypoint_object(nextdownf)
|
||||||
add_math_entrypoint_object(nextdownl)
|
add_math_entrypoint_object(nextdownl)
|
||||||
add_math_entrypoint_object(nextdownf16)
|
add_math_entrypoint_object(nextdownf16)
|
||||||
add_math_entrypoint_object(nextdownf128)
|
add_math_entrypoint_object(nextdownf128)
|
||||||
|
add_math_entrypoint_object(nextdownbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(nextup)
|
add_math_entrypoint_object(nextup)
|
||||||
add_math_entrypoint_object(nextupf)
|
add_math_entrypoint_object(nextupf)
|
||||||
add_math_entrypoint_object(nextupl)
|
add_math_entrypoint_object(nextupl)
|
||||||
add_math_entrypoint_object(nextupf16)
|
add_math_entrypoint_object(nextupf16)
|
||||||
add_math_entrypoint_object(nextupf128)
|
add_math_entrypoint_object(nextupf128)
|
||||||
|
add_math_entrypoint_object(nextupbf16)
|
||||||
|
|
||||||
add_math_entrypoint_object(pow)
|
add_math_entrypoint_object(pow)
|
||||||
add_math_entrypoint_object(powf)
|
add_math_entrypoint_object(powf)
|
||||||
|
@ -3496,6 +3496,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.manipulation_functions
|
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(
|
add_entrypoint_object(
|
||||||
nexttoward
|
nexttoward
|
||||||
SRCS
|
SRCS
|
||||||
@ -3537,6 +3551,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.manipulation_functions
|
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(
|
add_entrypoint_object(
|
||||||
nextdown
|
nextdown
|
||||||
SRCS
|
SRCS
|
||||||
@ -3589,6 +3617,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.manipulation_functions
|
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(
|
add_entrypoint_object(
|
||||||
nextup
|
nextup
|
||||||
SRCS
|
SRCS
|
||||||
@ -3641,6 +3683,20 @@ add_entrypoint_object(
|
|||||||
libc.src.__support.FPUtil.manipulation_functions
|
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(
|
add_entrypoint_object(
|
||||||
fmod
|
fmod
|
||||||
SRCS
|
SRCS
|
||||||
|
21
libc/src/math/generic/nextafterbf16.cpp
Normal file
21
libc/src/math/generic/nextafterbf16.cpp
Normal file
@ -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
libc/src/math/generic/nextdownbf16.cpp
Normal file
21
libc/src/math/generic/nextdownbf16.cpp
Normal file
@ -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
libc/src/math/generic/nexttowardbf16.cpp
Normal file
22
libc/src/math/generic/nexttowardbf16.cpp
Normal file
@ -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
libc/src/math/generic/nextupbf16.cpp
Normal file
21
libc/src/math/generic/nextupbf16.cpp
Normal file
@ -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
libc/src/math/nextafterbf16.h
Normal file
21
libc/src/math/nextafterbf16.h
Normal file
@ -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
libc/src/math/nextdownbf16.h
Normal file
21
libc/src/math/nextdownbf16.h
Normal file
@ -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
|
21
libc/src/math/nexttowardbf16.h
Normal file
21
libc/src/math/nexttowardbf16.h
Normal file
@ -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.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef LLVM_LIBC_SRC_MATH_NEXTTOWARDBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_NEXTTOWARDBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
bfloat16 nexttowardbf16(bfloat16 x, long double y);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_NEXTTOWARDBF16_H
|
21
libc/src/math/nextupbf16.h
Normal file
21
libc/src/math/nextupbf16.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//===-- Implementation header for nextupbf16 --------------------*- 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_NEXTUPBF16_H
|
||||||
|
#define LLVM_LIBC_SRC_MATH_NEXTUPBF16_H
|
||||||
|
|
||||||
|
#include "src/__support/macros/config.h"
|
||||||
|
#include "src/__support/macros/properties/types.h"
|
||||||
|
|
||||||
|
namespace LIBC_NAMESPACE_DECL {
|
||||||
|
|
||||||
|
bfloat16 nextupbf16(bfloat16 x);
|
||||||
|
|
||||||
|
} // namespace LIBC_NAMESPACE_DECL
|
||||||
|
|
||||||
|
#endif // LLVM_LIBC_SRC_MATH_NEXTUPBF16_H
|
@ -3660,6 +3660,23 @@ add_fp_unittest(
|
|||||||
libc.src.__support.FPUtil.fp_bits
|
libc.src.__support.FPUtil.fp_bits
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
nextafterbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
nextafterbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
NextAfterTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.hdr.fenv_macros
|
||||||
|
libc.src.math.nextafterbf16
|
||||||
|
libc.src.__support.CPP.bit
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.FPUtil.fenv_impl
|
||||||
|
libc.src.__support.FPUtil.fp_bits
|
||||||
|
)
|
||||||
|
|
||||||
# FIXME: These tests are currently spurious for the GPU.
|
# FIXME: These tests are currently spurious for the GPU.
|
||||||
if(NOT LIBC_TARGET_OS_IS_GPU)
|
if(NOT LIBC_TARGET_OS_IS_GPU)
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
@ -3727,6 +3744,23 @@ add_fp_unittest(
|
|||||||
libc.src.__support.FPUtil.fp_bits
|
libc.src.__support.FPUtil.fp_bits
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
nexttowardbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
nexttowardbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
NextTowardTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.hdr.fenv_macros
|
||||||
|
libc.src.math.nexttowardbf16
|
||||||
|
libc.src.__support.CPP.bit
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
libc.src.__support.FPUtil.fenv_impl
|
||||||
|
libc.src.__support.FPUtil.fp_bits
|
||||||
|
)
|
||||||
|
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
nextdown_test
|
nextdown_test
|
||||||
SUITE
|
SUITE
|
||||||
@ -3787,6 +3821,19 @@ add_fp_unittest(
|
|||||||
libc.src.math.nextdownf128
|
libc.src.math.nextdownf128
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
nextdownbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
nextdownbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
NextDownTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.math.nextdownbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
)
|
||||||
|
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
nextup_test
|
nextup_test
|
||||||
SUITE
|
SUITE
|
||||||
@ -3847,6 +3894,19 @@ add_fp_unittest(
|
|||||||
libc.src.math.nextupf128
|
libc.src.math.nextupf128
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_fp_unittest(
|
||||||
|
nextupbf16_test
|
||||||
|
SUITE
|
||||||
|
libc-math-smoke-tests
|
||||||
|
SRCS
|
||||||
|
nextupbf16_test.cpp
|
||||||
|
HDRS
|
||||||
|
NextUpTest.h
|
||||||
|
DEPENDS
|
||||||
|
libc.src.math.nextupbf16
|
||||||
|
libc.src.__support.FPUtil.bfloat16
|
||||||
|
)
|
||||||
|
|
||||||
# TODO(lntue): The current implementation of fputil::general::fma<float> is only
|
# TODO(lntue): The current implementation of fputil::general::fma<float> is only
|
||||||
# correctly rounded for the default rounding mode round-to-nearest tie-to-even.
|
# correctly rounded for the default rounding mode round-to-nearest tie-to-even.
|
||||||
add_fp_unittest(
|
add_fp_unittest(
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "src/__support/CPP/bit.h"
|
#include "src/__support/CPP/bit.h"
|
||||||
#include "src/__support/FPUtil/FEnvImpl.h"
|
#include "src/__support/FPUtil/FEnvImpl.h"
|
||||||
#include "src/__support/FPUtil/FPBits.h"
|
#include "src/__support/FPUtil/FPBits.h"
|
||||||
|
#include "src/__support/sign.h"
|
||||||
#include "test/UnitTest/FEnvSafeTest.h"
|
#include "test/UnitTest/FEnvSafeTest.h"
|
||||||
#include "test/UnitTest/FPMatcher.h"
|
#include "test/UnitTest/FPMatcher.h"
|
||||||
#include "test/UnitTest/Test.h"
|
#include "test/UnitTest/Test.h"
|
||||||
@ -42,6 +43,8 @@ class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
|
|||||||
const T neg_inf = FPBits::inf(Sign::NEG).get_val();
|
const T neg_inf = FPBits::inf(Sign::NEG).get_val();
|
||||||
const T zero = FPBits::zero(Sign::POS).get_val();
|
const T zero = FPBits::zero(Sign::POS).get_val();
|
||||||
const T neg_zero = FPBits::zero(Sign::NEG).get_val();
|
const T neg_zero = FPBits::zero(Sign::NEG).get_val();
|
||||||
|
const T one = FPBits::one(Sign::POS).get_val();
|
||||||
|
const T neg_one = FPBits::one(Sign::NEG).get_val();
|
||||||
const T nan = FPBits::quiet_nan().get_val();
|
const T nan = FPBits::quiet_nan().get_val();
|
||||||
|
|
||||||
static constexpr StorageType min_subnormal =
|
static constexpr StorageType min_subnormal =
|
||||||
@ -55,8 +58,8 @@ public:
|
|||||||
typedef T (*NextAfterFunc)(T, T);
|
typedef T (*NextAfterFunc)(T, T);
|
||||||
|
|
||||||
void testNaN(NextAfterFunc func) {
|
void testNaN(NextAfterFunc func) {
|
||||||
ASSERT_FP_EQ(func(nan, 0), nan);
|
ASSERT_FP_EQ(func(nan, zero), nan);
|
||||||
ASSERT_FP_EQ(func(0, nan), nan);
|
ASSERT_FP_EQ(func(zero, nan), nan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testBoundaries(NextAfterFunc func) {
|
void testBoundaries(NextAfterFunc func) {
|
||||||
@ -65,68 +68,68 @@ public:
|
|||||||
|
|
||||||
// 'from' is zero|neg_zero.
|
// 'from' is zero|neg_zero.
|
||||||
T x = zero;
|
T x = zero;
|
||||||
T result = func(x, T(1));
|
T result = func(x, one);
|
||||||
StorageType expected_bits = 1;
|
StorageType expected_bits = 1;
|
||||||
T expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
T expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
|
|
||||||
result = func(x, T(-1));
|
result = func(x, neg_one);
|
||||||
expected_bits = FPBits::SIGN_MASK + 1;
|
expected_bits = FPBits::SIGN_MASK + 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
|
|
||||||
x = neg_zero;
|
x = neg_zero;
|
||||||
result = func(x, 1);
|
result = func(x, one);
|
||||||
expected_bits = 1;
|
expected_bits = 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
|
|
||||||
result = func(x, -1);
|
result = func(x, neg_one);
|
||||||
expected_bits = FPBits::SIGN_MASK + 1;
|
expected_bits = FPBits::SIGN_MASK + 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
|
|
||||||
// 'from' is max subnormal value.
|
// 'from' is max subnormal value.
|
||||||
x = LIBC_NAMESPACE::cpp::bit_cast<T>(max_subnormal);
|
x = LIBC_NAMESPACE::cpp::bit_cast<T>(max_subnormal);
|
||||||
result = func(x, 1);
|
result = func(x, one);
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal);
|
||||||
ASSERT_FP_EQ(result, expected);
|
ASSERT_FP_EQ(result, expected);
|
||||||
|
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
expected_bits = max_subnormal - 1;
|
expected_bits = max_subnormal - 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
|
|
||||||
x = -x;
|
x = -x;
|
||||||
|
|
||||||
result = func(x, -1);
|
result = func(x, neg_one);
|
||||||
expected_bits = FPBits::SIGN_MASK + min_normal;
|
expected_bits = FPBits::SIGN_MASK + min_normal;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ(result, expected);
|
ASSERT_FP_EQ(result, expected);
|
||||||
|
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
expected_bits = FPBits::SIGN_MASK + max_subnormal - 1;
|
expected_bits = FPBits::SIGN_MASK + max_subnormal - 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
|
|
||||||
// 'from' is min subnormal value.
|
// 'from' is min subnormal value.
|
||||||
x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_subnormal);
|
x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_subnormal);
|
||||||
result = func(x, 1);
|
result = func(x, one);
|
||||||
expected_bits = min_subnormal + 1;
|
expected_bits = min_subnormal + 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(func(x, 0), zero);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(func(x, zero), zero);
|
||||||
|
|
||||||
x = -x;
|
x = -x;
|
||||||
result = func(x, -1);
|
result = func(x, neg_one);
|
||||||
expected_bits = FPBits::SIGN_MASK + min_subnormal + 1;
|
expected_bits = FPBits::SIGN_MASK + min_subnormal + 1;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(func(x, 0), T(-0.0));
|
ASSERT_FP_EQ_WITH_UNDERFLOW(func(x, zero), neg_zero);
|
||||||
|
|
||||||
// 'from' is min normal.
|
// 'from' is min normal.
|
||||||
x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal);
|
x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal);
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
expected_bits = max_subnormal;
|
expected_bits = max_subnormal;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
@ -137,7 +140,7 @@ public:
|
|||||||
ASSERT_FP_EQ(result, expected);
|
ASSERT_FP_EQ(result, expected);
|
||||||
|
|
||||||
x = -x;
|
x = -x;
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
expected_bits = FPBits::SIGN_MASK + max_subnormal;
|
expected_bits = FPBits::SIGN_MASK + max_subnormal;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected);
|
||||||
@ -157,14 +160,14 @@ public:
|
|||||||
|
|
||||||
// 'from' is infinity.
|
// 'from' is infinity.
|
||||||
x = inf;
|
x = inf;
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
expected_bits = max_normal;
|
expected_bits = max_normal;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ(result, expected);
|
ASSERT_FP_EQ(result, expected);
|
||||||
ASSERT_FP_EQ(func(x, inf), inf);
|
ASSERT_FP_EQ(func(x, inf), inf);
|
||||||
|
|
||||||
x = neg_inf;
|
x = neg_inf;
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
expected_bits = FPBits::SIGN_MASK + max_normal;
|
expected_bits = FPBits::SIGN_MASK + max_normal;
|
||||||
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits);
|
||||||
ASSERT_FP_EQ(result, expected);
|
ASSERT_FP_EQ(result, expected);
|
||||||
@ -172,7 +175,7 @@ public:
|
|||||||
|
|
||||||
// 'from' is a power of 2.
|
// 'from' is a power of 2.
|
||||||
x = T(32.0);
|
x = T(32.0);
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
FPBits x_bits = FPBits(x);
|
FPBits x_bits = FPBits(x);
|
||||||
FPBits result_bits = FPBits(result);
|
FPBits result_bits = FPBits(result);
|
||||||
ASSERT_EQ(result_bits.get_biased_exponent(),
|
ASSERT_EQ(result_bits.get_biased_exponent(),
|
||||||
@ -187,7 +190,7 @@ public:
|
|||||||
|
|
||||||
x = -x;
|
x = -x;
|
||||||
|
|
||||||
result = func(x, 0);
|
result = func(x, zero);
|
||||||
result_bits = FPBits(result);
|
result_bits = FPBits(result);
|
||||||
ASSERT_EQ(result_bits.get_biased_exponent(),
|
ASSERT_EQ(result_bits.get_biased_exponent(),
|
||||||
uint16_t(x_bits.get_biased_exponent() - 1));
|
uint16_t(x_bits.get_biased_exponent() - 1));
|
||||||
|
@ -62,8 +62,8 @@ public:
|
|||||||
typedef T (*NextTowardFunc)(T, long double);
|
typedef T (*NextTowardFunc)(T, long double);
|
||||||
|
|
||||||
void testNaN(NextTowardFunc func) {
|
void testNaN(NextTowardFunc func) {
|
||||||
ASSERT_FP_EQ(func(nan, 0), nan);
|
ASSERT_FP_EQ(func(nan, to_zero), nan);
|
||||||
ASSERT_FP_EQ(func(0, to_nan), nan);
|
ASSERT_FP_EQ(func(zero, to_nan), nan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testBoundaries(NextTowardFunc func) {
|
void testBoundaries(NextTowardFunc func) {
|
||||||
|
14
libc/test/src/math/smoke/nextafterbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/nextafterbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for nextafterbf16 ---------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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 "NextAfterTest.h"
|
||||||
|
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/math/nextafterbf16.h"
|
||||||
|
|
||||||
|
LIST_NEXTAFTER_TESTS(bfloat16, LIBC_NAMESPACE::nextafterbf16)
|
14
libc/test/src/math/smoke/nextdownbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/nextdownbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for nextdownbf16 ----------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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 "NextDownTest.h"
|
||||||
|
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/math/nextdownbf16.h"
|
||||||
|
|
||||||
|
LIST_NEXTDOWN_TESTS(bfloat16, LIBC_NAMESPACE::nextdownbf16)
|
14
libc/test/src/math/smoke/nexttowardbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/nexttowardbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for nexttowardbf16 --------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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 "NextTowardTest.h"
|
||||||
|
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/math/nexttowardbf16.h"
|
||||||
|
|
||||||
|
LIST_NEXTTOWARD_TESTS(bfloat16, LIBC_NAMESPACE::nexttowardbf16)
|
14
libc/test/src/math/smoke/nextupbf16_test.cpp
Normal file
14
libc/test/src/math/smoke/nextupbf16_test.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//===-- Unittests for nextupbf16 ------------------------------------------===//
|
||||||
|
//
|
||||||
|
// 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 "NextUpTest.h"
|
||||||
|
|
||||||
|
#include "src/__support/FPUtil/bfloat16.h"
|
||||||
|
#include "src/math/nextupbf16.h"
|
||||||
|
|
||||||
|
LIST_NEXTUP_TESTS(bfloat16, LIBC_NAMESPACE::nextupbf16)
|
Loading…
x
Reference in New Issue
Block a user