[libc-commits] [libc] [llvm] [libc] Add missing MPFR-based tests for math functions (PR #218281)

via libc-commits libc-commits at lists.llvm.org
Sun Aug 23 12:35:10 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: tht2005

<details>
<summary>Changes</summary>

BFloat16:
- ceilbf16
- floorbf16
- truncbf16
- roundbf16
- roundevenbf16
- fabsbf16
- frexpbf16
- remquobf16

Float16:
- fabsf16
- frexpf16
- remquof16

Fix https://github.com/llvm/llvm-project/issues/218219

---
Full diff: https://github.com/llvm/llvm-project/pull/218281.diff


17 Files Affected:

- (modified) libc/test/src/math/CMakeLists.txt (+169) 
- (modified) libc/test/src/math/CeilTest.h (+2-2) 
- (modified) libc/test/src/math/FloorTest.h (+2-2) 
- (modified) libc/test/src/math/TruncTest.h (+2-2) 
- (added) libc/test/src/math/ceilbf16_test.cpp (+14) 
- (added) libc/test/src/math/fabsbf16_test.cpp (+14) 
- (added) libc/test/src/math/fabsf16_test.cpp (+13) 
- (added) libc/test/src/math/floorbf16_test.cpp (+14) 
- (added) libc/test/src/math/frexpbf16_test.cpp (+14) 
- (added) libc/test/src/math/frexpf16_test.cpp (+13) 
- (added) libc/test/src/math/remquobf16_test.cpp (+14) 
- (added) libc/test/src/math/remquof16_test.cpp (+13) 
- (added) libc/test/src/math/roundbf16_test.cpp (+14) 
- (added) libc/test/src/math/roundevenbf16_test.cpp (+14) 
- (added) libc/test/src/math/truncbf16_test.cpp (+14) 
- (modified) libc/utils/MPFRWrapper/MPFRUtils.cpp (+28) 
- (modified) utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel (+63) 


``````````diff
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index 9f325673f09f1..d6267df0cfdd3 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -306,6 +306,35 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
+add_fp_unittest(
+  fabsf16_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    fabsf16_test.cpp
+  HDRS
+    FAbsTest.h
+  DEPENDS
+    libc.src.math.fabsf16
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fabsbf16_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    fabsbf16_test.cpp
+  HDRS
+    FAbsTest.h
+  DEPENDS
+    libc.src.math.fabsbf16
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.fp_bits
+)
+
 add_fp_unittest(
   fabsl_test
   NEED_MPFR
@@ -423,6 +452,22 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
+add_fp_unittest(
+  truncbf16_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    truncbf16_test.cpp
+  HDRS
+    TruncTest.h
+  DEPENDS
+    libc.src.math.truncbf16
+    libc.src.__support.CPP.algorithm
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.fp_bits
+)
+
 add_fp_unittest(
   ceil_test
   NEED_MPFR
@@ -499,6 +544,22 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
+add_fp_unittest(
+  ceilbf16_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    ceilbf16_test.cpp
+  HDRS
+    CeilTest.h
+  DEPENDS
+    libc.src.math.ceilbf16
+    libc.src.__support.CPP.algorithm
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.fp_bits
+)
+
 add_fp_unittest(
   floor_test
   NEED_MPFR
@@ -575,6 +636,22 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
+add_fp_unittest(
+  floorbf16_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    floorbf16_test.cpp
+  HDRS
+    FloorTest.h
+  DEPENDS
+    libc.src.math.floorbf16
+    libc.src.__support.CPP.algorithm
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.fp_bits
+)
+
 add_fp_unittest(
   round_test
   NEED_MPFR
@@ -635,6 +712,22 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
+add_fp_unittest(
+  roundbf16_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    roundbf16_test.cpp
+  HDRS
+    RoundTest.h
+  DEPENDS
+    libc.src.math.roundbf16
+    libc.src.__support.CPP.algorithm
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.fp_bits
+)
+
 add_fp_unittest(
   roundf128_test
   NEED_MPFR_F128
@@ -710,6 +803,22 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
+add_fp_unittest(
+  roundevenbf16_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    roundevenbf16_test.cpp
+  HDRS
+    RoundEvenTest.h
+  DEPENDS
+    libc.src.math.roundevenbf16
+    libc.src.__support.CPP.algorithm
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.fp_bits
+)
+
 add_fp_unittest(
   lround_test
   NEED_MPFR
@@ -1466,6 +1575,35 @@ add_fp_unittest(
     libc.src.__support.FPUtil.basic_operations
 )
 
+add_fp_unittest(
+  frexpf16_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    frexpf16_test.cpp
+  HDRS
+    FrexpTest.h
+  DEPENDS
+    libc.src.math.frexpf16
+    libc.src.__support.FPUtil.basic_operations
+)
+
+add_fp_unittest(
+  frexpbf16_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    frexpbf16_test.cpp
+  HDRS
+    FrexpTest.h
+  DEPENDS
+    libc.src.math.frexpbf16
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.bfloat16
+)
+
 add_fp_unittest(
   frexpl_test
   NEED_MPFR
@@ -1929,6 +2067,37 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
+add_fp_unittest(
+  remquof16_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    remquof16_test.cpp
+  HDRS
+    RemQuoTest.h
+  DEPENDS
+    libc.src.math.remquof16
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  remquobf16_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    remquobf16_test.cpp
+  HDRS
+    RemQuoTest.h
+  DEPENDS
+    libc.src.math.remquobf16
+    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.bfloat16
+    libc.src.__support.FPUtil.fp_bits
+)
+
 add_fp_unittest(
   remquo_test
   NEED_MPFR
diff --git a/libc/test/src/math/CeilTest.h b/libc/test/src/math/CeilTest.h
index d30bd200b02ba..29b2e96c3f6ad 100644
--- a/libc/test/src/math/CeilTest.h
+++ b/libc/test/src/math/CeilTest.h
@@ -65,8 +65,8 @@ class CeilTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
     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(124.0), func(T(123.5)));
+    EXPECT_FP_EQ(T(-123.0), func(T(-123.5)));
   }
 
   void testRange(CeilFunc func) {
diff --git a/libc/test/src/math/FloorTest.h b/libc/test/src/math/FloorTest.h
index 0ac31c0306cfa..bbf34164186aa 100644
--- a/libc/test/src/math/FloorTest.h
+++ b/libc/test/src/math/FloorTest.h
@@ -65,8 +65,8 @@ class FloorTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
     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(123.0), func(T(123.5)));
+    EXPECT_FP_EQ(T(-124.0), func(T(-123.5)));
   }
 
   void testRange(FloorFunc func) {
diff --git a/libc/test/src/math/TruncTest.h b/libc/test/src/math/TruncTest.h
index db0f19c83265f..179243e576865 100644
--- a/libc/test/src/math/TruncTest.h
+++ b/libc/test/src/math/TruncTest.h
@@ -65,8 +65,8 @@ class TruncTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
     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(123.0), func(T(123.5)));
+    EXPECT_FP_EQ(T(-123.0), func(T(-123.5)));
   }
 
   void testRange(TruncFunc func) {
diff --git a/libc/test/src/math/ceilbf16_test.cpp b/libc/test/src/math/ceilbf16_test.cpp
new file mode 100644
index 0000000000000..dcaf058344ff0
--- /dev/null
+++ b/libc/test/src/math/ceilbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for ceilbf16 --------------------------------------------===//
+//
+// 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/__support/FPUtil/bfloat16.h"
+#include "src/math/ceilbf16.h"
+
+LIST_CEIL_TESTS(bfloat16, LIBC_NAMESPACE::ceilbf16)
diff --git a/libc/test/src/math/fabsbf16_test.cpp b/libc/test/src/math/fabsbf16_test.cpp
new file mode 100644
index 0000000000000..611050a7775ab
--- /dev/null
+++ b/libc/test/src/math/fabsbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for fabsbf16 --------------------------------------------===//
+//
+// 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 "FAbsTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/fabsbf16.h"
+
+LIST_FABS_TESTS(bfloat16, LIBC_NAMESPACE::fabsbf16)
diff --git a/libc/test/src/math/fabsf16_test.cpp b/libc/test/src/math/fabsf16_test.cpp
new file mode 100644
index 0000000000000..c43bd5090f90b
--- /dev/null
+++ b/libc/test/src/math/fabsf16_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fabsf16 ---------------------------------------------===//
+//
+// 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 "FAbsTest.h"
+
+#include "src/math/fabsf16.h"
+
+LIST_FABS_TESTS(float16, LIBC_NAMESPACE::fabsf16)
diff --git a/libc/test/src/math/floorbf16_test.cpp b/libc/test/src/math/floorbf16_test.cpp
new file mode 100644
index 0000000000000..9cc77cd15aa1c
--- /dev/null
+++ b/libc/test/src/math/floorbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for floorbf16 -------------------------------------------===//
+//
+// 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/__support/FPUtil/bfloat16.h"
+#include "src/math/floorbf16.h"
+
+LIST_FLOOR_TESTS(bfloat16, LIBC_NAMESPACE::floorbf16)
diff --git a/libc/test/src/math/frexpbf16_test.cpp b/libc/test/src/math/frexpbf16_test.cpp
new file mode 100644
index 0000000000000..70c9b63db3a15
--- /dev/null
+++ b/libc/test/src/math/frexpbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for frexpbf16 -------------------------------------------===//
+//
+// 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 "FrexpTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/frexpbf16.h"
+
+LIST_FREXP_TESTS(bfloat16, LIBC_NAMESPACE::frexpbf16)
diff --git a/libc/test/src/math/frexpf16_test.cpp b/libc/test/src/math/frexpf16_test.cpp
new file mode 100644
index 0000000000000..b039d28fe5e92
--- /dev/null
+++ b/libc/test/src/math/frexpf16_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for frexpf16 --------------------------------------------===//
+//
+// 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 "FrexpTest.h"
+
+#include "src/math/frexpf16.h"
+
+LIST_FREXP_TESTS(float16, LIBC_NAMESPACE::frexpf16)
diff --git a/libc/test/src/math/remquobf16_test.cpp b/libc/test/src/math/remquobf16_test.cpp
new file mode 100644
index 0000000000000..3f754bbd28a41
--- /dev/null
+++ b/libc/test/src/math/remquobf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for remquobf16 ------------------------------------------===//
+//
+// 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 "RemQuoTest.h"
+
+#include "src/__support/FPUtil/bfloat16.h"
+#include "src/math/remquobf16.h"
+
+LIST_REMQUO_TESTS(bfloat16, LIBC_NAMESPACE::remquobf16)
diff --git a/libc/test/src/math/remquof16_test.cpp b/libc/test/src/math/remquof16_test.cpp
new file mode 100644
index 0000000000000..18f2aba71aabe
--- /dev/null
+++ b/libc/test/src/math/remquof16_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for remquof16 -------------------------------------------===//
+//
+// 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 "RemQuoTest.h"
+
+#include "src/math/remquof16.h"
+
+LIST_REMQUO_TESTS(float16, LIBC_NAMESPACE::remquof16)
diff --git a/libc/test/src/math/roundbf16_test.cpp b/libc/test/src/math/roundbf16_test.cpp
new file mode 100644
index 0000000000000..51638689e8092
--- /dev/null
+++ b/libc/test/src/math/roundbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for roundbf16 -------------------------------------------===//
+//
+// 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/__support/FPUtil/bfloat16.h"
+#include "src/math/roundbf16.h"
+
+LIST_ROUND_TESTS(bfloat16, LIBC_NAMESPACE::roundbf16)
diff --git a/libc/test/src/math/roundevenbf16_test.cpp b/libc/test/src/math/roundevenbf16_test.cpp
new file mode 100644
index 0000000000000..711c37a4e5115
--- /dev/null
+++ b/libc/test/src/math/roundevenbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for roundevenbf16 ---------------------------------------===//
+//
+// 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/__support/FPUtil/bfloat16.h"
+#include "src/math/roundevenbf16.h"
+
+LIST_ROUNDEVEN_TESTS(bfloat16, LIBC_NAMESPACE::roundevenbf16)
diff --git a/libc/test/src/math/truncbf16_test.cpp b/libc/test/src/math/truncbf16_test.cpp
new file mode 100644
index 0000000000000..970fa69b3c7a1
--- /dev/null
+++ b/libc/test/src/math/truncbf16_test.cpp
@@ -0,0 +1,14 @@
+//===-- Unittests for truncbf16 -------------------------------------------===//
+//
+// 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/__support/FPUtil/bfloat16.h"
+#include "src/math/truncbf16.h"
+
+LIST_TRUNC_TESTS(bfloat16, LIBC_NAMESPACE::truncbf16)
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index bc32b11466e5a..6d920a45b3182 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -332,6 +332,12 @@ template void explain_unary_operation_two_outputs_error<double>(
 template void explain_unary_operation_two_outputs_error<long double>(
     Operation, long double, const BinaryOutput<long double> &, double,
     RoundingMode);
+#ifdef LIBC_TYPES_HAS_FLOAT16
+template void explain_unary_operation_two_outputs_error<float16>(
+    Operation, float16, const BinaryOutput<float16> &, double, RoundingMode);
+#endif
+template void explain_unary_operation_two_outputs_error<bfloat16>(
+    Operation, bfloat16, const BinaryOutput<bfloat16> &, double, RoundingMode);
 
 template <typename T>
 void explain_binary_operation_two_outputs_error(
@@ -368,6 +374,14 @@ template void explain_binary_operation_two_outputs_error<double>(
 template void explain_binary_operation_two_outputs_error<long double>(
     Operation, const BinaryInput<long double> &,
     const BinaryOutput<long double> &, double, RoundingMode);
+#ifdef LIBC_TYPES_HAS_FLOAT16
+template void explain_binary_operation_two_outputs_error<float16>(
+    Operation, const BinaryInput<float16> &, const BinaryOutput<float16> &, double,
+    RoundingMode);
+#endif
+template void explain_binary_operation_two_outputs_error<bfloat16>(
+    Operation, const BinaryInput<bfloat16> &, const BinaryOutput<bfloat16> &, double,
+    RoundingMode);
 
 template <typename InputType, typename OutputType>
 void explain_binary_operation_one_output_error(
@@ -605,6 +619,12 @@ template bool compare_unary_operation_two_outputs<double>(
 template bool compare_unary_operation_two_outputs<long double>(
     Operation, long double, const BinaryOutput<long double> &, double,
     RoundingMode);
+#ifdef LIBC_TYPES_HAS_FLOAT16
+template bool compare_unary_operation_two_outputs<float16>(
+    Operation, float16, const BinaryOutput<float16> &, double, RoundingMode);
+#endif
+template bool compare_unary_operation_two_outputs<bfloat16>(
+    Operation, bfloat16, const BinaryOutput<bfloat16> &, double, RoundingMode);
 
 template <typename T>
 bool compare_binary_operation_two_outputs(Operation op,
@@ -639,6 +659,14 @@ template bool compare_binary_operation_two_outputs<double>(
 template bool compare_binary_operation_two_outputs<long double>(
     Operation, const BinaryInput<long double> &,
     const BinaryOutput<long double> &, double, RoundingMode);
+#ifdef LIBC_TYPES_HAS_FLOAT16
+template bool compare_binary_operation_two_outputs<float16>(
+    Operation, const BinaryInput<float16> &, const BinaryOutput<float16> &, double,
+    RoundingMode);
+#endif
+template bool compare_binary_operation_two_outputs<bfloat16>(
+    Operation, const BinaryInput<bfloat16> &, const BinaryOutput<bfloat16> &, double,
+    RoundingMode);
 
 template <typename InputType, typename OutputType>
 bool compare_binary_operation_one_output(Operation op,
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
index 601db61b6a6fc..d8914aa3b8ec7 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
@@ -59,6 +59,12 @@ math_mpfr_test(
     hdrs = ["CeilTest.h"],
 )
 
+math_mpfr_test(
+    name = "ceilbf16",
+    hdrs = ["CeilTest.h"],
+    deps = ["//libc:__support_fputil_bfloat16"],
+)
+
 math_mpfr_test(
     name = "ceilf128",
     hdrs = ["CeilTest.h"],
@@ -149,6 +155,17 @@ math_mpfr_test(
     hdrs = ["FAbsTest.h"],
 )
 
+math_mpfr_test(
+    name = "fabsf16",
+    hdrs = ["FAbsTest.h"],
+)
+
+math_mpfr_test(
+    name = "fabsbf16",
+    hdrs = ["FAbsTest.h"],
+    deps = ["//libc:__support_fputil_bfloat16"],
+)
+
 math_mpfr_test(
     name = "fabsl",
     hdrs = ["FAbsTest.h"],
@@ -226,6 +243,12 @@ math_mpfr_test(
     hdrs = ["FloorTest.h"],
 )
 
+math_mpfr_test(
+    name = "floorbf16",
+    hdrs = ["FloorTest.h"],
+    deps = ["//libc:__support_fputil_bfloat16"],
+)
+
 # TODO: Add fma, fmaf, fmal, fmul, fmull tests.  Missing stdlib/rand dependency.
 
 # math_mpfr_test(name = "f16mul")
@@ -246,6 +269,17 @@ math_mpfr_test(
     hdrs = ["FrexpTest.h"],
 )
 
+math_mpfr_test(
+    name = "frexpf16",
+    hdrs = ["FrexpTest.h"],
+)
+
+math_mpfr_test(
+    name = "frexpbf16",
+    hdrs = ["FrexpTest.h"],
+    deps = ["//libc:__support_fputil_bfloat16"],
+)
+
 math_mpfr_test(
     name = "frexpl",
     hdrs = ["FrexpTest.h"],
@@ -450,6 +484,17 @@ math_mpfr_test(
     hdrs = ["RemQuoTest.h"],
 )
 
+math_mpfr_test(
+    name = "remquof16",
+    hdrs = ["RemQuoTest.h"],
+)
+
+math_mpfr_test(
+    name = "remquobf16",
+    hdrs = ["RemQuoTest.h"],
+    deps = ["//libc:__support_fputil_bfloat16"],
+)
+
 math_mpfr_test(
     name = "remquol",
     hdrs = ["RemQuoTest.h"],
@@ -495,6 +540,12 @@ math_mpfr_test(
     hdrs = ["RoundEvenTest.h"],
 )
 
+math_mpfr_test(
+    name = "roundevenbf16",
+    hdrs = ["RoundEvenTest.h"],
+    deps = ["//libc:__support_fputil_bfloat16"],
+)
+
 math_mpfr_test(
     name = "round",
     hdrs = ["RoundTest.h"],
@@ -505,6 +556,12 @@ math_mpfr_test(
     hdrs = ["RoundTest.h"],
 )
 
+math_mpfr_test(
+    name = "roundbf16",
+    hdrs = ["RoundTest.h"],
+    deps = ["//libc:__support_fputil_bfloat16"],
+)
+
 math_mpfr_test(
     name = "roundl",
     hdrs = ["RoundTest.h"],
@@ -635,6 +692,12 @@ math_mpfr_test(
     hdrs = ["TruncTest.h"],
 )
 
+math_mpfr_test(
+    name = "truncbf16",
+    hdrs = ["TruncTest.h"],
+    deps = ["//libc:__support_fputil_bfloat16"],
+)
+
 math_mpfr_test(name = "cbrtf16")
 
 math_mpfr_test(name = "cosf16")

``````````

</details>


https://github.com/llvm/llvm-project/pull/218281


More information about the libc-commits mailing list