-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Revert "[libc][math][c23] Add MPFR unit tests for {ceil,floor,round,roundeven,trunc}f16 (#94383)" #94505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lntue
merged 1 commit into
llvm:main
from
overmighty:libc-math-ceilf16-mpfr-tests-revert
Jun 5, 2024
Merged
Revert "[libc][math][c23] Add MPFR unit tests for {ceil,floor,round,roundeven,trunc}f16 (#94383)" #94505
lntue
merged 1 commit into
llvm:main
from
overmighty:libc-math-ceilf16-mpfr-tests-revert
Jun 5, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…oundeven,trunc}f16 (llvm#94383)" This reverts commit fda1e4b. The commit caused Buildbot failures: - https://lab.llvm.org/buildbot/#/builders/256/builds/14331 - https://lab.llvm.org/buildbot/#/builders/229/builds/27009
@llvm/pr-subscribers-libc Author: OverMighty (overmighty) ChangesThis reverts commit fda1e4b. The commit caused Buildbot failures:
Patch is 20.82 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/94505.diff 12 Files Affected:
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index e4a3087c9055f..102188c332e40 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -141,7 +141,6 @@ add_fp_unittest(
TruncTest.h
DEPENDS
libc.src.math.trunc
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -156,7 +155,6 @@ add_fp_unittest(
TruncTest.h
DEPENDS
libc.src.math.truncf
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -171,22 +169,6 @@ add_fp_unittest(
TruncTest.h
DEPENDS
libc.src.math.truncl
- libc.src.__support.CPP.algorithm
- libc.src.__support.FPUtil.fp_bits
-)
-
-add_fp_unittest(
- truncf16_test
- NEED_MPFR
- SUITE
- libc-math-unittests
- SRCS
- truncf16_test.cpp
- HDRS
- TruncTest.h
- DEPENDS
- libc.src.math.truncf16
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -201,7 +183,6 @@ add_fp_unittest(
CeilTest.h
DEPENDS
libc.src.math.ceil
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -216,7 +197,6 @@ add_fp_unittest(
CeilTest.h
DEPENDS
libc.src.math.ceilf
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -231,22 +211,6 @@ add_fp_unittest(
CeilTest.h
DEPENDS
libc.src.math.ceill
- libc.src.__support.CPP.algorithm
- libc.src.__support.FPUtil.fp_bits
-)
-
-add_fp_unittest(
- ceilf16_test
- NEED_MPFR
- SUITE
- libc-math-unittests
- SRCS
- ceilf16_test.cpp
- HDRS
- CeilTest.h
- DEPENDS
- libc.src.math.ceilf16
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -261,7 +225,6 @@ add_fp_unittest(
FloorTest.h
DEPENDS
libc.src.math.floor
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -276,7 +239,6 @@ add_fp_unittest(
FloorTest.h
DEPENDS
libc.src.math.floorf
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -291,22 +253,6 @@ add_fp_unittest(
FloorTest.h
DEPENDS
libc.src.math.floorl
- libc.src.__support.CPP.algorithm
- libc.src.__support.FPUtil.fp_bits
-)
-
-add_fp_unittest(
- floorf16_test
- NEED_MPFR
- SUITE
- libc-math-unittests
- SRCS
- floorf16_test.cpp
- HDRS
- FloorTest.h
- DEPENDS
- libc.src.math.floorf16
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -321,7 +267,6 @@ add_fp_unittest(
RoundTest.h
DEPENDS
libc.src.math.round
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -336,7 +281,6 @@ add_fp_unittest(
RoundTest.h
DEPENDS
libc.src.math.roundf
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -351,22 +295,6 @@ add_fp_unittest(
RoundTest.h
DEPENDS
libc.src.math.roundl
- libc.src.__support.CPP.algorithm
- libc.src.__support.FPUtil.fp_bits
-)
-
-add_fp_unittest(
- roundf16_test
- NEED_MPFR
- SUITE
- libc-math-unittests
- SRCS
- roundf16_test.cpp
- HDRS
- RoundTest.h
- DEPENDS
- libc.src.math.roundf16
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -381,7 +309,6 @@ add_fp_unittest(
RoundEvenTest.h
DEPENDS
libc.src.math.roundeven
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -396,7 +323,6 @@ add_fp_unittest(
RoundEvenTest.h
DEPENDS
libc.src.math.roundevenf
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
@@ -411,22 +337,6 @@ add_fp_unittest(
RoundEvenTest.h
DEPENDS
libc.src.math.roundevenl
- libc.src.__support.CPP.algorithm
- libc.src.__support.FPUtil.fp_bits
-)
-
-add_fp_unittest(
- roundevenf16_test
- NEED_MPFR
- SUITE
- libc-math-unittests
- SRCS
- roundevenf16_test.cpp
- HDRS
- RoundEvenTest.h
- DEPENDS
- libc.src.math.roundevenf16
- libc.src.__support.CPP.algorithm
libc.src.__support.FPUtil.fp_bits
)
diff --git a/libc/test/src/math/CeilTest.h b/libc/test/src/math/CeilTest.h
index 3af87420a739f..b4c3752cc5c4b 100644
--- a/libc/test/src/math/CeilTest.h
+++ b/libc/test/src/math/CeilTest.h
@@ -6,10 +6,6 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIBC_TEST_SRC_MATH_CEILTEST_H
-#define LLVM_LIBC_TEST_SRC_MATH_CEILTEST_H
-
-#include "src/__support/CPP/algorithm.h"
#include "test/UnitTest/FEnvSafeTest.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -63,21 +59,18 @@ class CeilTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
EXPECT_FP_EQ(T(-10.0), func(T(-10.32)));
EXPECT_FP_EQ(T(11.0), func(T(10.65)));
EXPECT_FP_EQ(T(-10.0), func(T(-10.65)));
- EXPECT_FP_EQ(T(124.0), func(T(123.38)));
- EXPECT_FP_EQ(T(-123.0), func(T(-123.38)));
- EXPECT_FP_EQ(T(124.0), func(T(123.96)));
- EXPECT_FP_EQ(T(-123.0), func(T(-123.96)));
+ EXPECT_FP_EQ(T(1235.0), func(T(1234.38)));
+ EXPECT_FP_EQ(T(-1234.0), func(T(-1234.38)));
+ EXPECT_FP_EQ(T(1235.0), func(T(1234.96)));
+ EXPECT_FP_EQ(T(-1234.0), func(T(-1234.96)));
}
void testRange(CeilFunc func) {
- constexpr int COUNT = 100'000;
- constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
- static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
- StorageType v = 0;
- for (int i = 0; i <= COUNT; ++i, v += STEP) {
- FPBits xbits(v);
- T x = xbits.get_val();
- if (xbits.is_inf_or_nan())
+ constexpr StorageType COUNT = 100'000;
+ constexpr StorageType STEP = STORAGE_MAX / COUNT;
+ for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
+ T x = FPBits(v).get_val();
+ if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH(mpfr::Operation::Ceil, x, func(x), 0.0);
@@ -91,5 +84,3 @@ class CeilTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
TEST_F(LlvmLibcCeilTest, RoundedNubmers) { testRoundedNumbers(&func); } \
TEST_F(LlvmLibcCeilTest, Fractions) { testFractions(&func); } \
TEST_F(LlvmLibcCeilTest, Range) { testRange(&func); }
-
-#endif // LLVM_LIBC_TEST_SRC_MATH_CEILTEST_H
diff --git a/libc/test/src/math/FloorTest.h b/libc/test/src/math/FloorTest.h
index cce0c731ebbc0..9103a5b05eb5a 100644
--- a/libc/test/src/math/FloorTest.h
+++ b/libc/test/src/math/FloorTest.h
@@ -9,7 +9,6 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_FLOORTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_FLOORTEST_H
-#include "src/__support/CPP/algorithm.h"
#include "test/UnitTest/FEnvSafeTest.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -63,21 +62,18 @@ class FloorTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
EXPECT_FP_EQ(T(-11.0), func(T(-10.32)));
EXPECT_FP_EQ(T(10.0), func(T(10.65)));
EXPECT_FP_EQ(T(-11.0), func(T(-10.65)));
- EXPECT_FP_EQ(T(123.0), func(T(123.38)));
- EXPECT_FP_EQ(T(-124.0), func(T(-123.38)));
- EXPECT_FP_EQ(T(123.0), func(T(123.96)));
- EXPECT_FP_EQ(T(-124.0), func(T(-123.96)));
+ EXPECT_FP_EQ(T(1234.0), func(T(1234.38)));
+ EXPECT_FP_EQ(T(-1235.0), func(T(-1234.38)));
+ EXPECT_FP_EQ(T(1234.0), func(T(1234.96)));
+ EXPECT_FP_EQ(T(-1235.0), func(T(-1234.96)));
}
void testRange(FloorFunc func) {
- constexpr int COUNT = 100'000;
- constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
- static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
- StorageType v = 0;
- for (int i = 0; i <= COUNT; ++i, v += STEP) {
- FPBits xbits(v);
- T x = xbits.get_val();
- if (xbits.is_inf_or_nan())
+ constexpr StorageType COUNT = 100'000;
+ constexpr StorageType STEP = STORAGE_MAX / COUNT;
+ for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
+ T x = FPBits(v).get_val();
+ if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH(mpfr::Operation::Floor, x, func(x), 0.0);
diff --git a/libc/test/src/math/RoundEvenTest.h b/libc/test/src/math/RoundEvenTest.h
index 5ecda66ccb588..d70555d347659 100644
--- a/libc/test/src/math/RoundEvenTest.h
+++ b/libc/test/src/math/RoundEvenTest.h
@@ -9,7 +9,6 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_ROUNDEVENTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_ROUNDEVENTEST_H
-#include "src/__support/CPP/algorithm.h"
#include "test/UnitTest/FEnvSafeTest.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -61,25 +60,22 @@ class RoundEvenTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
EXPECT_FP_EQ(T(-2.0), func(T(-1.75)));
EXPECT_FP_EQ(T(11.0), func(T(10.65)));
EXPECT_FP_EQ(T(-11.0), func(T(-10.65)));
- EXPECT_FP_EQ(T(123.0), func(T(123.25)));
- EXPECT_FP_EQ(T(124.0), func(T(123.50)));
- EXPECT_FP_EQ(T(124.0), func(T(123.75)));
- EXPECT_FP_EQ(T(-123.0), func(T(-123.25)));
- EXPECT_FP_EQ(T(-124.0), func(T(-123.50)));
- EXPECT_FP_EQ(T(-124.0), func(T(-123.75)));
- EXPECT_FP_EQ(T(124.0), func(T(124.50)));
- EXPECT_FP_EQ(T(-124.0), func(T(-124.50)));
+ EXPECT_FP_EQ(T(1233.0), func(T(1233.25)));
+ EXPECT_FP_EQ(T(1234.0), func(T(1233.50)));
+ EXPECT_FP_EQ(T(1234.0), func(T(1233.75)));
+ EXPECT_FP_EQ(T(-1233.0), func(T(-1233.25)));
+ EXPECT_FP_EQ(T(-1234.0), func(T(-1233.50)));
+ EXPECT_FP_EQ(T(-1234.0), func(T(-1233.75)));
+ EXPECT_FP_EQ(T(1234.0), func(T(1234.50)));
+ EXPECT_FP_EQ(T(-1234.0), func(T(-1234.50)));
}
void testRange(RoundEvenFunc func) {
- constexpr int COUNT = 100'000;
- constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
- static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
- StorageType v = 0;
- for (int i = 0; i <= COUNT; ++i, v += STEP) {
- FPBits xbits(v);
- T x = xbits.get_val();
- if (xbits.is_inf_or_nan())
+ constexpr StorageType COUNT = 100'000;
+ constexpr StorageType STEP = STORAGE_MAX / COUNT;
+ for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
+ T x = FPBits(v).get_val();
+ if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH(mpfr::Operation::RoundEven, x, func(x), 0.0);
diff --git a/libc/test/src/math/RoundTest.h b/libc/test/src/math/RoundTest.h
index d571d5d8feed4..2a31df305ac38 100644
--- a/libc/test/src/math/RoundTest.h
+++ b/libc/test/src/math/RoundTest.h
@@ -9,7 +9,6 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_ROUNDTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_ROUNDTEST_H
-#include "src/__support/CPP/algorithm.h"
#include "test/UnitTest/FEnvSafeTest.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -63,21 +62,18 @@ class RoundTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
EXPECT_FP_EQ(T(-10.0), func(T(-10.32)));
EXPECT_FP_EQ(T(11.0), func(T(10.65)));
EXPECT_FP_EQ(T(-11.0), func(T(-10.65)));
- EXPECT_FP_EQ(T(123.0), func(T(123.38)));
- EXPECT_FP_EQ(T(-123.0), func(T(-123.38)));
- EXPECT_FP_EQ(T(124.0), func(T(123.96)));
- EXPECT_FP_EQ(T(-124.0), func(T(-123.96)));
+ EXPECT_FP_EQ(T(1234.0), func(T(1234.38)));
+ EXPECT_FP_EQ(T(-1234.0), func(T(-1234.38)));
+ EXPECT_FP_EQ(T(1235.0), func(T(1234.96)));
+ EXPECT_FP_EQ(T(-1235.0), func(T(-1234.96)));
}
void testRange(RoundFunc func) {
- constexpr int COUNT = 100'000;
- constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
- static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
- StorageType v = 0;
- for (int i = 0; i <= COUNT; ++i, v += STEP) {
- FPBits xbits(v);
- T x = xbits.get_val();
- if (xbits.is_inf_or_nan())
+ constexpr StorageType COUNT = 100'000;
+ constexpr StorageType STEP = STORAGE_MAX / COUNT;
+ for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
+ T x = FPBits(v).get_val();
+ if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH(mpfr::Operation::Round, x, func(x), 0.0);
diff --git a/libc/test/src/math/TruncTest.h b/libc/test/src/math/TruncTest.h
index 76c9740a917bf..bc5b76131291b 100644
--- a/libc/test/src/math/TruncTest.h
+++ b/libc/test/src/math/TruncTest.h
@@ -9,7 +9,6 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_TRUNCTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_TRUNCTEST_H
-#include "src/__support/CPP/algorithm.h"
#include "test/UnitTest/FEnvSafeTest.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -63,21 +62,18 @@ class TruncTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
EXPECT_FP_EQ(T(-10.0), func(T(-10.32)));
EXPECT_FP_EQ(T(10.0), func(T(10.65)));
EXPECT_FP_EQ(T(-10.0), func(T(-10.65)));
- EXPECT_FP_EQ(T(123.0), func(T(123.38)));
- EXPECT_FP_EQ(T(-123.0), func(T(-123.38)));
- EXPECT_FP_EQ(T(123.0), func(T(123.96)));
- EXPECT_FP_EQ(T(-123.0), func(T(-123.96)));
+ EXPECT_FP_EQ(T(1234.0), func(T(1234.38)));
+ EXPECT_FP_EQ(T(-1234.0), func(T(-1234.38)));
+ EXPECT_FP_EQ(T(1234.0), func(T(1234.96)));
+ EXPECT_FP_EQ(T(-1234.0), func(T(-1234.96)));
}
void testRange(TruncFunc func) {
- constexpr int COUNT = 100'000;
- constexpr StorageType STEP = LIBC_NAMESPACE::cpp::max(
- static_cast<StorageType>(STORAGE_MAX / COUNT), StorageType(1));
- StorageType v = 0;
- for (int i = 0; i <= COUNT; ++i, v += STEP) {
- FPBits xbits(v);
- T x = xbits.get_val();
- if (xbits.is_inf_or_nan())
+ constexpr StorageType COUNT = 100'000;
+ constexpr StorageType STEP = STORAGE_MAX / COUNT;
+ for (StorageType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
+ T x = FPBits(v).get_val();
+ if (isnan(x) || isinf(x))
continue;
ASSERT_MPFR_MATCH(mpfr::Operation::Trunc, x, func(x), 0.0);
diff --git a/libc/test/src/math/ceilf16_test.cpp b/libc/test/src/math/ceilf16_test.cpp
deleted file mode 100644
index a6ec922836a75..0000000000000
--- a/libc/test/src/math/ceilf16_test.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-//===-- Unittests for ceilf16 ---------------------------------------------===//
-//
-// 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 "CeilTest.h"
-
-#include "src/math/ceilf16.h"
-
-LIST_CEIL_TESTS(float16, LIBC_NAMESPACE::ceilf16)
diff --git a/libc/test/src/math/floorf16_test.cpp b/libc/test/src/math/floorf16_test.cpp
deleted file mode 100644
index ca5160e927035..0000000000000
--- a/libc/test/src/math/floorf16_test.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-//===-- Unittests for floorf16 --------------------------------------------===//
-//
-// 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 "FloorTest.h"
-
-#include "src/math/floorf16.h"
-
-LIST_FLOOR_TESTS(float16, LIBC_NAMESPACE::floorf16)
diff --git a/libc/test/src/math/roundevenf16_test.cpp b/libc/test/src/math/roundevenf16_test.cpp
deleted file mode 100644
index 911a32c9f73f4..0000000000000
--- a/libc/test/src/math/roundevenf16_test.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-//===-- Unittests for roundevenf16 ----------------------------------------===//
-//
-// 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 "RoundEvenTest.h"
-
-#include "src/math/roundevenf16.h"
-
-LIST_ROUNDEVEN_TESTS(float16, LIBC_NAMESPACE::roundevenf16)
diff --git a/libc/test/src/math/roundf16_test.cpp b/libc/test/src/math/roundf16_test.cpp
deleted file mode 100644
index 54ead855934db..0000000000000
--- a/libc/test/src/math/roundf16_test.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-//===-- Unittests for roundf16 --------------------------------------------===//
-//
-// 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 "RoundTest.h"
-
-#include "src/math/roundf16.h"
-
-LIST_ROUND_TESTS(float16, LIBC_NAMESPACE::roundf16)
diff --git a/libc/test/src/math/truncf16_test.cpp b/libc/test/src/math/truncf16_test.cpp
deleted file mode 100644
index 832d88ec84f8e..0000000000000
--- a/libc/test/src/math/truncf16_test.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-//===-- Unittests for truncf16 --------------------------------------------===//
-//
-// 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 "TruncTest.h"
-
-#include "src/math/truncf16.h"
-
-LIST_TRUNC_TESTS(float16, LIBC_NAMESPACE::truncf16)
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index a9177fa050f86..18a8ac044a9bb 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -12,7 +12,6 @@
#include "src/__support/CPP/string_view.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/fpbits_str.h"
-#include "src/__support/macros/properties/types.h"
#include "test/UnitTest/FPMatcher.h"
#include "hdr/math_macros.h"
@@ -31,12 +30,6 @@ namespace mpfr {
// precision compared to the floating point precision.
template <typename T> struct ExtraPrecision;
-#ifdef LIBC_TYPES_HAS_FLOAT16
-template <> struct ExtraPrecision<float16> {
- static constexpr unsigned int VALUE = 128;
-};
-#endif
-
template <> struct ExtraPrecision<float> {
static constexpr unsigned int VALUE = 128;
};
@@ -92,16 +85,9 @@ class MPFRNumber {
// We use explicit EnableIf specializations to disallow implicit
// conversions. Implicit conversions can potentially lead to loss of
- // precision. We exceptionally allow implicit conversions from float16
- // to float, as the MPFR API does not support float16, thus requiring
- // conversion to a higher-precision format.
+ // precision.
template <typename XType,
- cpp::enable_if_t<cpp::is_same_v<float, XType>
-#ifdef LIBC_TYPES_HAS_FLOAT16
- || cpp::is_same_v<float16, XType>
-#endif
- ,
- int> = 0>
+ cpp::enable_if_t<cpp::is_same_v<float, XType>, int> = 0>
explicit MPFRNumber(XType x,
unsigned int precision = ExtraPrecision<XType>::VALUE,
RoundingMode rounding = RoundingMode::Nearest)
@@ -543,8 +529,8 @@ class MPFRNumber {
// If the control reaches here, it means that this number and input are
// of the same sign but different exponent. In such a case, ULP error is
// calculated as sum of two parts.
- thisAsT = FPBits<T>(thisAsT).abs().get_val();
- input = FPBits<T>(input).abs().get_val();
+ thisAsT = std::abs(thisAsT);
+ input = std::abs(input);
T min = thisAsT > input ? input : thisAsT;
T max = thisAsT > input ? thisAsT : input;
int minExponent = FPBits<T>(min).get_exponent();
@@ -599,14 +585,6 @@ template <> long double MPFRNumber::as<long double>() const {
return mpfr_get_ld(value, mpfr_rounding);
}
-#ifdef LIBC_TYPES_HAS_FLOAT16
-template <> float16 MPFRNumber::as<float16>() const {
- // TODO: Either prove that this cast won't cause double-rounding errors, or
- // find a better way to get a float16.
- return static_cast<float16>(mpfr_get_d(value, mpfr_rounding));
-}
-#endif
-
namespace internal {
template <typename InputType>
@@ -785,10 +763,6 @@ template void explain_unary_operation_single_output_error<double>(
Operation op, double, double, double, RoundingMode);
template void explain_unary_operation_single_output_error<long double>(
Operation op, long double, long double, double, RoundingMode);
-#ifdef LIBC_TYPES_HAS_FLOAT16
-template void explain_unary_operation_sin...
[truncated]
|
lntue
approved these changes
Jun 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts commit fda1e4b.
The commit caused Buildbot failures: