File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -735,6 +735,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
735735 libc.src.math.rintf16
736736 libc.src.math.roundevenf16
737737 libc.src.math.roundf16
738+ libc.src.math.rsqrtf16
738739 libc.src.math.scalblnf16
739740 libc.src.math.scalbnf16
740741 libc.src.math.setpayloadf16
Original file line number Diff line number Diff line change @@ -749,6 +749,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
749749 libc.src.math.rintf16
750750 libc.src.math.roundevenf16
751751 libc.src.math.roundf16
752+ libc.src.math.rsqrtf16
752753 libc.src.math.scalblnf16
753754 libc.src.math.scalbnf16
754755 libc.src.math.setpayloadf16
Original file line number Diff line number Diff line change 2424namespace LIBC_NAMESPACE_DECL {
2525namespace math {
2626
27- static constexpr float16 rsqrtf16 (float16 x) {
27+ LIBC_INLINE static constexpr float16 rsqrtf16 (float16 x) {
2828 using FPBits = fputil::FPBits<float16>;
2929 FPBits xbits (x);
3030
@@ -56,9 +56,8 @@ static constexpr float16 rsqrtf16(float16 x) {
5656 }
5757
5858 // x = +inf => rsqrt(x) = 0
59- if (LIBC_UNLIKELY (xbits.is_inf ())) {
59+ if (LIBC_UNLIKELY (xbits.is_inf ()))
6060 return FPBits::zero ().get_val ();
61- }
6261
6362 // TODO: add integer based implementation when LIBC_TARGET_CPU_HAS_FPU_FLOAT
6463 // is not defined
@@ -67,9 +66,9 @@ static constexpr float16 rsqrtf16(float16 x) {
6766 // Targeted post-corrections to ensure correct rounding in half for specific
6867 // mantissa patterns
6968 const uint16_t half_mantissa = x_abs & 0x3ff ;
70- if (half_mantissa == 0x011F ) {
69+ if (LIBC_UNLIKELY ( half_mantissa == 0x011F ) ) {
7170 result = fputil::multiply_add (result, 0x1 .0p-21f , result);
72- } else if (half_mantissa == 0x0313 ) {
71+ } else if (LIBC_UNLIKELY ( half_mantissa == 0x0313 ) ) {
7372 result = fputil::multiply_add (result, -0x1 .0p-21f , result);
7473 }
7574
You can’t perform that action at this time.
0 commit comments