Skip to content

Commit e7adac7

Browse files
committed
Revert "[libc][math][c23] Add ldexpf16 C23 math function"
This reverts commit 7bee516.
1 parent 141f155 commit e7adac7

File tree

13 files changed

+10
-99
lines changed

13 files changed

+10
-99
lines changed

libc/config/linux/aarch64/entrypoints.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,6 @@ if(LIBC_TYPES_HAS_FLOAT16)
520520
libc.src.math.fromfpf16
521521
libc.src.math.fromfpxf16
522522
libc.src.math.ilogbf16
523-
libc.src.math.ldexpf16
524523
libc.src.math.llogbf16
525524
libc.src.math.llrintf16
526525
libc.src.math.llroundf16

libc/config/linux/x86_64/entrypoints.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,6 @@ if(LIBC_TYPES_HAS_FLOAT16)
553553
libc.src.math.fromfpf16
554554
libc.src.math.fromfpxf16
555555
libc.src.math.ilogbf16
556-
libc.src.math.ldexpf16
557556
libc.src.math.llogbf16
558557
libc.src.math.llrintf16
559558
libc.src.math.llroundf16

libc/docs/math/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Basic Operations
170170
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
171171
| ilogb | |check| | |check| | |check| | |check| | |check| | 7.12.6.8 | F.10.3.8 |
172172
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
173-
| ldexp | |check| | |check| | |check| | |check| | |check| | 7.12.6.9 | F.10.3.9 |
173+
| ldexp | |check| | |check| | |check| | | |check| | 7.12.6.9 | F.10.3.9 |
174174
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
175175
| llogb | |check| | |check| | |check| | |check| | |check| | 7.12.6.10 | F.10.3.10 |
176176
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+

libc/spec/stdc.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,6 @@ def StdC : StandardSpec<"stdc"> {
532532
FunctionSpec<"ldexp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
533533
FunctionSpec<"ldexpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
534534
FunctionSpec<"ldexpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>]>,
535-
GuardedFunctionSpec<"ldexpf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<IntType>], "LIBC_TYPES_HAS_FLOAT16">,
536535
GuardedFunctionSpec<"ldexpf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<IntType>], "LIBC_TYPES_HAS_FLOAT128">,
537536

538537
FunctionSpec<"log10", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,

libc/src/__support/FPUtil/ManipulationFunctions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ LIBC_INLINE constexpr T ldexp(T x, int exp) {
186186
}
187187

188188
// For all other values, NormalFloat to T conversion handles it the right way.
189-
DyadicFloat<cpp::max(FPBits<T>::STORAGE_LEN, 32)> normal(bits.get_val());
189+
DyadicFloat<FPBits<T>::STORAGE_LEN> normal(bits.get_val());
190190
normal.exponent += exp;
191191
return static_cast<T>(normal);
192192
}

libc/src/__support/FPUtil/dyadic_float.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "src/__support/CPP/type_traits.h"
1515
#include "src/__support/big_int.h"
1616
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
17-
#include "src/__support/macros/properties/types.h" // float16
1817

1918
#include <stddef.h>
2019

@@ -184,10 +183,6 @@ template <size_t Bits> struct DyadicFloat {
184183
return r;
185184
}
186185

187-
LIBC_INLINE explicit constexpr operator float16() const {
188-
return static_cast<float16>(static_cast<float>(*this));
189-
}
190-
191186
LIBC_INLINE explicit constexpr operator MantissaType() const {
192187
if (mantissa.is_zero())
193188
return 0;

libc/src/math/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ add_math_entrypoint_object(llogbf128)
224224
add_math_entrypoint_object(ldexp)
225225
add_math_entrypoint_object(ldexpf)
226226
add_math_entrypoint_object(ldexpl)
227-
add_math_entrypoint_object(ldexpf16)
228227
add_math_entrypoint_object(ldexpf128)
229228

230229
add_math_entrypoint_object(log10)

libc/src/math/generic/CMakeLists.txt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,19 +1487,6 @@ add_entrypoint_object(
14871487
libc.src.__support.FPUtil.manipulation_functions
14881488
)
14891489

1490-
add_entrypoint_object(
1491-
ldexpf16
1492-
SRCS
1493-
ldexpf16.cpp
1494-
HDRS
1495-
../ldexpf16.h
1496-
COMPILE_OPTIONS
1497-
-O0 -ggdb3
1498-
DEPENDS
1499-
libc.src.__support.macros.properties.types
1500-
libc.src.__support.FPUtil.manipulation_functions
1501-
)
1502-
15031490
add_entrypoint_object(
15041491
ldexpf128
15051492
SRCS

libc/src/math/generic/ldexpf16.cpp

Lines changed: 0 additions & 19 deletions
This file was deleted.

libc/src/math/ldexpf16.h

Lines changed: 0 additions & 20 deletions
This file was deleted.

libc/test/src/math/smoke/CMakeLists.txt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,21 +1550,6 @@ add_fp_unittest(
15501550
libc.src.__support.FPUtil.normal_float
15511551
)
15521552

1553-
add_fp_unittest(
1554-
ldexpf16_test
1555-
SUITE
1556-
libc-math-smoke-tests
1557-
SRCS
1558-
ldexpf16_test.cpp
1559-
HDRS
1560-
LdExpTest.h
1561-
DEPENDS
1562-
libc.src.math.ldexpf16
1563-
libc.src.__support.CPP.limits
1564-
libc.src.__support.FPUtil.fp_bits
1565-
libc.src.__support.FPUtil.normal_float
1566-
)
1567-
15681553
add_fp_unittest(
15691554
ldexpf128_test
15701555
SUITE

libc/test/src/math/smoke/LdExpTest.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class LdExpTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
3131
const T nan = FPBits::quiet_nan().get_val();
3232

3333
// A normalized mantissa to be used with tests.
34-
static constexpr StorageType MANTISSA = NormalFloat::ONE + 0x123;
34+
static constexpr StorageType MANTISSA = NormalFloat::ONE + 0x1234;
3535

3636
public:
3737
typedef T (*LdExpFunc)(T, int);
@@ -60,7 +60,7 @@ class LdExpTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
6060

6161
void testOverflow(LdExpFunc func) {
6262
NormalFloat x(Sign::POS, FPBits::MAX_BIASED_EXPONENT - 10,
63-
NormalFloat::ONE + 0xF00);
63+
NormalFloat::ONE + 0xF00BA);
6464
for (int32_t exp = 10; exp < 100; ++exp) {
6565
ASSERT_FP_EQ(inf, func(T(x), exp));
6666
ASSERT_FP_EQ(neg_inf, func(-T(x), exp));
@@ -95,10 +95,10 @@ class LdExpTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
9595

9696
void testNormalOperation(LdExpFunc func) {
9797
T val_array[] = {// Normal numbers
98-
NormalFloat(Sign::POS, 10, MANTISSA),
99-
NormalFloat(Sign::POS, -10, MANTISSA),
100-
NormalFloat(Sign::NEG, 10, MANTISSA),
101-
NormalFloat(Sign::NEG, -10, MANTISSA),
98+
NormalFloat(Sign::POS, 100, MANTISSA),
99+
NormalFloat(Sign::POS, -100, MANTISSA),
100+
NormalFloat(Sign::NEG, 100, MANTISSA),
101+
NormalFloat(Sign::NEG, -100, MANTISSA),
102102
// Subnormal numbers
103103
NormalFloat(Sign::POS, -FPBits::EXP_BIAS, MANTISSA),
104104
NormalFloat(Sign::NEG, -FPBits::EXP_BIAS, MANTISSA)};
@@ -114,8 +114,8 @@ class LdExpTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
114114
NormalFloat two_to_exp = NormalFloat(static_cast<T>(1.L));
115115
two_to_exp = two_to_exp.mul2(exp);
116116

117-
ASSERT_FP_EQ(func(x, exp), x * static_cast<T>(two_to_exp));
118-
ASSERT_FP_EQ(func(x, -exp), x / static_cast<T>(two_to_exp));
117+
ASSERT_FP_EQ(func(x, exp), x * two_to_exp);
118+
ASSERT_FP_EQ(func(x, -exp), x / two_to_exp);
119119
}
120120
}
121121

libc/test/src/math/smoke/ldexpf16_test.cpp

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)