Skip to content

Commit 73b34db

Browse files
committed
[libc][math][c23] Update for comments.
1 parent 45386af commit 73b34db

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

libc/config/linux/riscv/entrypoints.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@ set(TARGET_LIBM_ENTRYPOINTS
397397
# math.h entrypoints
398398
libc.src.math.acosf
399399
libc.src.math.acoshf
400-
libc.src.math.acoshf16
401400
libc.src.math.asinf
402401
libc.src.math.asinhf
403402
libc.src.math.atan2

libc/src/math/generic/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3955,6 +3955,7 @@ add_entrypoint_object(
39553955
libc.hdr.errno_macros
39563956
libc.hdr.fenv_macros
39573957
libc.src.__support.FPUtil.cast
3958+
libc.src.__support.FPUtil.except_value_utils
39583959
libc.src.__support.FPUtil.fenv_impl
39593960
libc.src.__support.FPUtil.fp_bits
39603961
libc.src.__support.FPUtil.multiply_add

libc/src/math/generic/acoshf16.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
#include "hdr/fenv_macros.h"
1313
#include "src/__support/FPUtil/FEnvImpl.h"
1414
#include "src/__support/FPUtil/FPBits.h"
15+
#include "src/__support/FPUtil/PolyEval.h"
1516
#include "src/__support/FPUtil/cast.h"
1617
#include "src/__support/FPUtil/except_value_utils.h"
1718
#include "src/__support/FPUtil/multiply_add.h"
1819
#include "src/__support/FPUtil/sqrt.h"
20+
#include "src/__support/common.h"
21+
#include "src/__support/macros/config.h"
1922
#include "src/__support/macros/optimization.h"
2023

2124
namespace LIBC_NAMESPACE_DECL {
@@ -34,15 +37,6 @@ LLVM_LIBC_FUNCTION(float16, acoshf16, (float16 x)) {
3437
FPBits xbits(x);
3538
uint16_t x_u = xbits.uintval();
3639

37-
// Domain error for inputs less than 1.0.
38-
if (LIBC_UNLIKELY(x <= 1.0f)) {
39-
if (x == 1.0f)
40-
return FPBits::zero().get_val();
41-
fputil::set_errno_if_required(EDOM);
42-
fputil::raise_except_if_required(FE_INVALID);
43-
return FPBits::quiet_nan().get_val();
44-
}
45-
4640
// Check for NaN input first.
4741
if (LIBC_UNLIKELY(xbits.is_inf_or_nan())) {
4842
if (xbits.is_signaling_nan()) {
@@ -57,6 +51,15 @@ LLVM_LIBC_FUNCTION(float16, acoshf16, (float16 x)) {
5751
return x;
5852
}
5953

54+
// Domain error for inputs less than 1.0.
55+
if (LIBC_UNLIKELY(x <= 1.0f)) {
56+
if (x == 1.0f)
57+
return FPBits::zero().get_val();
58+
fputil::set_errno_if_required(EDOM);
59+
fputil::raise_except_if_required(FE_INVALID);
60+
return FPBits::quiet_nan().get_val();
61+
}
62+
6063
if (auto r = ACOSHF16_EXCEPTS.lookup(xbits.uintval());
6164
LIBC_UNLIKELY(r.has_value()))
6265
return r.value();

0 commit comments

Comments
 (0)