1
- // ===-- Half-precision asinhf16(x) function --------------------------------===//
1
+ // ===-- Half-precision asinhf16(x) function--------------------------------===//
2
2
//
3
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
4
// See https://llvm.org/LICENSE.txt for license information.
8
8
// ===----------------------------------------------------------------------===//
9
9
10
10
#include " src/math/asinhf16.h"
11
- #include " src/math/generic/explogxf.h"
12
11
#include " src/__support/FPUtil/except_value_utils.h"
13
12
#include " src/__support/FPUtil/generic/sqrt.h"
14
13
#include " src/__support/FPUtil/multiply_add.h"
15
14
#include " src/__support/common.h"
16
15
#include " src/__support/macros/config.h"
17
16
#include " src/__support/macros/properties/types.h"
17
+ #include " src/math/generic/explogxf.h"
18
18
19
19
namespace LIBC_NAMESPACE_DECL {
20
20
21
21
#ifndef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
22
22
static constexpr size_t N_EXCEPTS = 8 ;
23
23
24
- static constexpr fputil::ExceptValues<float16, N_EXCEPTS> ASINHF16_EXCEPTS{{
25
- // (input, RZ output, RU offset, RD offset, RN offset)
26
- {0x3769 , 0x372A , 1 , 0 , 1 },
27
- {0x3B5B , 0x3A96 , 1 , 0 , 0 },
28
- {0x4B1F , 0x42B3 , 1 , 0 , 0 },
29
- {0x4C9B , 0x4336 , 1 , 0 , 1 },
30
- {0xB769 , 0xB72A , 0 , 1 , 1 },
31
- {0xBB5B , 0xBA96 , 0 , 1 , 0 },
32
- {0xCB1F , 0xC2B3 , 0 , 1 , 0 },
33
- {0xCC9B , 0xC336 , 0 , 1 , 1 }
34
- }};
24
+ static constexpr fputil::ExceptValues<float16, N_EXCEPTS> ASINHF16_EXCEPTS{
25
+ {// (input, RZ output, RU offset, RD offset, RN offset)
26
+ {0x3769 , 0x372A , 1 , 0 , 1 },
27
+ {0x3B5B , 0x3A96 , 1 , 0 , 0 },
28
+ {0x4B1F , 0x42B3 , 1 , 0 , 0 },
29
+ {0x4C9B , 0x4336 , 1 , 0 , 1 },
30
+ {0xB769 , 0xB72A , 0 , 1 , 1 },
31
+ {0xBB5B , 0xBA96 , 0 , 1 , 0 },
32
+ {0xCB1F , 0xC2B3 , 0 , 1 , 0 },
33
+ {0xCC9B , 0xC336 , 0 , 1 , 1 }}};
35
34
#endif // !LIBC_MATH_HAS_SKIP_ACCURATE_PASS
36
35
37
36
LLVM_LIBC_FUNCTION (float16, asinhf16, (float16 x)) {
@@ -64,8 +63,8 @@ LLVM_LIBC_FUNCTION(float16, asinhf16, (float16 x)) {
64
63
if (LIBC_UNLIKELY (x_abs <= 0x3400 )) {
65
64
if (LIBC_UNLIKELY (x_abs == 0 ))
66
65
return x;
67
- if (LIBC_UNLIKELY ((fputil::get_round () == FE_UPWARD) &&
68
- (x_u >= 0x8401 ) && (x_u <= 0x90E6 )))
66
+ if (LIBC_UNLIKELY ((fputil::get_round () == FE_UPWARD) && (x_u >= 0x8401 ) &&
67
+ (x_u <= 0x90E6 )))
69
68
return static_cast <float16>(x_d + 0x1p-24f );
70
69
71
70
float x_sq = x_d * x_d;
@@ -79,7 +78,7 @@ LLVM_LIBC_FUNCTION(float16, asinhf16, (float16 x)) {
79
78
80
79
// General case: asinh(x) = ln(x + sqrt(x^2 + 1))
81
80
float sqrt_term = fputil::sqrt<float >(fputil::multiply_add (x_d, x_d, 1 .0f ));
82
- return fputil::cast<float16>(x_sign * log_eval (
83
- fputil::multiply_add (x_d, x_sign, sqrt_term)));
84
- }
81
+ return fputil::cast<float16>(
82
+ x_sign * log_eval (fputil::multiply_add (x_d, x_sign, sqrt_term)));
85
83
}
84
+ } // namespace LIBC_NAMESPACE_DECL
0 commit comments