[libc][math][c++23] Add {ceil,floor,round,roundeven,trunc}bf16 math functions (#152352)

This PR implements the following basic math functions for BFloat16 type
along with the tests:
- ceilbf16
- floorbf16
- roundbf16
- roundevenbf16
- truncbf16

---------

Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
This commit is contained in:
Krishna Pandey
2025-08-08 09:45:22 +05:30
committed by GitHub
parent 7d886fab74
commit 15a705dc93
34 changed files with 501 additions and 8 deletions

View File

@@ -757,7 +757,12 @@ endif()
list(APPEND TARGET_LIBM_ENTRYPOINTS
# bfloat16 entrypoints
libc.src.math.ceilbf16
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
)
if(LIBC_COMPILER_HAS_FIXED_POINT)

View File

@@ -760,7 +760,12 @@ endif()
list(APPEND TARGET_LIBM_ENTRYPOINTS
# bfloat16 entrypoints
libc.src.math.ceilbf16
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
)
if(LIBC_COMPILER_HAS_FIXED_POINT)

View File

@@ -760,7 +760,12 @@ endif()
list(APPEND TARGET_LIBM_ENTRYPOINTS
# bfloat16 entrypoints
libc.src.math.ceilbf16
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
)
if(LIBC_COMPILER_HAS_FIXED_POINT)

View File

@@ -590,7 +590,12 @@ endif()
list(APPEND TARGET_LIBM_ENTRYPOINTS
# bfloat16 entrypoints
libc.src.math.ceilbf16
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
)
if(LIBC_COMPILER_HAS_FIXED_POINT)

View File

@@ -233,7 +233,12 @@ set(TARGET_LIBM_ENTRYPOINTS
list(APPEND TARGET_LIBM_ENTRYPOINTS
# bfloat16 entrypoints
libc.src.math.ceilbf16
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
)
set(TARGET_LLVMLIBC_ENTRYPOINTS

View File

@@ -616,7 +616,12 @@ endif()
list(APPEND TARGET_LIBM_ENTRYPOINTS
# bfloat16 entrypoints
libc.src.math.ceilbf16
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
)
set(TARGET_LLVMLIBC_ENTRYPOINTS

View File

@@ -617,7 +617,12 @@ endif()
list(APPEND TARGET_LIBM_ENTRYPOINTS
# bfloat16 entrypoints
libc.src.math.ceilbf16
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
)
set(TARGET_LLVMLIBC_ENTRYPOINTS

View File

@@ -844,7 +844,12 @@ endif()
list(APPEND TARGET_LIBM_ENTRYPOINTS
# bfloat16 entrypoints
libc.src.math.ceilbf16
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
)
if(LLVM_LIBC_FULL_BUILD)

View File

@@ -460,7 +460,12 @@ set(TARGET_LIBM_ENTRYPOINTS
list(APPEND TARGET_LIBM_ENTRYPOINTS
# bfloat16 entrypoints
libc.src.math.ceilbf16
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
)
set(TARGET_LLVMLIBC_ENTRYPOINTS

View File

@@ -863,7 +863,12 @@ endif()
list(APPEND TARGET_LIBM_ENTRYPOINTS
# bfloat16 entrypoints
libc.src.math.ceilbf16
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
)
if(LIBC_COMPILER_HAS_FIXED_POINT)

View File

@@ -893,10 +893,14 @@ if(LIBC_TYPES_HAS_FLOAT128)
)
endif()
list(APPEND TARGET_LIBM_ENTRYPOINTS
# bfloat16 entrypoints
libc.src.math.ceilbf16
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
)
if(LIBC_COMPILER_HAS_FIXED_POINT)

View File

@@ -306,7 +306,12 @@ set(TARGET_LIBM_ENTRYPOINTS
list(APPEND TARGET_LIBM_ENTRYPOINTS
# bfloat16 entrypoints
libc.src.math.ceilbf16
libc.src.math.fabsbf16
libc.src.math.floorbf16
libc.src.math.roundbf16
libc.src.math.roundevenbf16
libc.src.math.truncbf16
)
set(TARGET_LLVMLIBC_ENTRYPOINTS

View File

@@ -91,6 +91,7 @@ add_math_entrypoint_object(ceilf)
add_math_entrypoint_object(ceill)
add_math_entrypoint_object(ceilf16)
add_math_entrypoint_object(ceilf128)
add_math_entrypoint_object(ceilbf16)
add_math_entrypoint_object(copysign)
add_math_entrypoint_object(copysignf)
@@ -214,6 +215,7 @@ add_math_entrypoint_object(floorf)
add_math_entrypoint_object(floorl)
add_math_entrypoint_object(floorf16)
add_math_entrypoint_object(floorf128)
add_math_entrypoint_object(floorbf16)
add_math_entrypoint_object(fma)
add_math_entrypoint_object(fmaf)
@@ -463,12 +465,14 @@ add_math_entrypoint_object(roundf)
add_math_entrypoint_object(roundl)
add_math_entrypoint_object(roundf16)
add_math_entrypoint_object(roundf128)
add_math_entrypoint_object(roundbf16)
add_math_entrypoint_object(roundeven)
add_math_entrypoint_object(roundevenf)
add_math_entrypoint_object(roundevenl)
add_math_entrypoint_object(roundevenf16)
add_math_entrypoint_object(roundevenf128)
add_math_entrypoint_object(roundevenbf16)
add_math_entrypoint_object(scalbln)
add_math_entrypoint_object(scalblnf)
@@ -546,6 +550,7 @@ add_math_entrypoint_object(truncf)
add_math_entrypoint_object(truncl)
add_math_entrypoint_object(truncf16)
add_math_entrypoint_object(truncf128)
add_math_entrypoint_object(truncbf16)
add_math_entrypoint_object(ufromfp)
add_math_entrypoint_object(ufromfpf)

21
libc/src/math/ceilbf16.h Normal file
View File

@@ -0,0 +1,21 @@
//===-- Implementation header for ceilbf16 ----------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_SRC_MATH_CEILBF16_H
#define LLVM_LIBC_SRC_MATH_CEILBF16_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
bfloat16 ceilbf16(bfloat16 x);
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_MATH_CEILBF16_H

21
libc/src/math/floorbf16.h Normal file
View File

@@ -0,0 +1,21 @@
//===-- Implementation header for floorbf16 ---------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_SRC_MATH_FLOORBF16_H
#define LLVM_LIBC_SRC_MATH_FLOORBF16_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
bfloat16 floorbf16(bfloat16 x);
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_MATH_FLOORBF16_H

View File

@@ -156,6 +156,22 @@ add_entrypoint_object(
libc.src.__support.FPUtil.nearest_integer_operations
)
add_entrypoint_object(
ceilbf16
SRCS
ceilbf16.cpp
HDRS
../ceilbf16.h
DEPENDS
libc.src.__support.common
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.nearest_integer_operations
libc.src.__support.macros.config
libc.src.__support.macros.properties.types
FLAGS
ROUND_OPT
)
add_entrypoint_object(
daddl
SRCS
@@ -801,6 +817,22 @@ add_entrypoint_object(
libc.src.__support.FPUtil.nearest_integer_operations
)
add_entrypoint_object(
truncbf16
SRCS
truncbf16.cpp
HDRS
../truncbf16.h
DEPENDS
libc.src.__support.common
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.nearest_integer_operations
libc.src.__support.macros.config
libc.src.__support.macros.properties.types
FLAGS
ROUND_OPT
)
add_entrypoint_object(
floor
SRCS
@@ -861,6 +893,22 @@ add_entrypoint_object(
libc.src.__support.FPUtil.nearest_integer_operations
)
add_entrypoint_object(
floorbf16
SRCS
floorbf16.cpp
HDRS
../floorbf16.h
DEPENDS
libc.src.__support.common
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.nearest_integer_operations
libc.src.__support.macros.config
libc.src.__support.macros.properties.types
FLAGS
ROUND_OPT
)
add_entrypoint_object(
round
SRCS
@@ -921,6 +969,22 @@ add_entrypoint_object(
libc.src.__support.FPUtil.nearest_integer_operations
)
add_entrypoint_object(
roundbf16
SRCS
roundbf16.cpp
HDRS
../roundbf16.h
DEPENDS
libc.src.__support.common
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.nearest_integer_operations
libc.src.__support.macros.config
libc.src.__support.macros.properties.types
FLAGS
ROUND_OPT
)
add_entrypoint_object(
roundeven
SRCS
@@ -981,6 +1045,22 @@ add_entrypoint_object(
libc.src.__support.FPUtil.nearest_integer_operations
)
add_entrypoint_object(
roundevenbf16
SRCS
roundevenbf16.cpp
HDRS
../roundevenbf16.h
DEPENDS
libc.src.__support.common
libc.src.__support.FPUtil.bfloat16
libc.src.__support.FPUtil.nearest_integer_operations
libc.src.__support.macros.config
libc.src.__support.macros.properties.types
FLAGS
ROUND_OPT
)
add_entrypoint_object(
lround
SRCS

View File

@@ -0,0 +1,19 @@
//===-- Implementation of ceilbf16 function -------------------------------===//
//
// 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 "src/math/ceilbf16.h"
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, ceilbf16, (bfloat16 x)) { return fputil::ceil(x); }
} // namespace LIBC_NAMESPACE_DECL

View File

@@ -0,0 +1,21 @@
//===-- Implementation of floorbf16 function ------------------------------===//
//
// 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 "src/math/floorbf16.h"
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, floorbf16, (bfloat16 x)) {
return fputil::floor(x);
}
} // namespace LIBC_NAMESPACE_DECL

View File

@@ -0,0 +1,21 @@
//===-- Implementation of roundbf16 function ------------------------------===//
//
// 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 "src/math/roundbf16.h"
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, roundbf16, (bfloat16 x)) {
return fputil::round(x);
}
} // namespace LIBC_NAMESPACE_DECL

View File

@@ -0,0 +1,21 @@
//===-- Implementation of roundevenbf16 function --------------------------===//
//
// 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 "src/math/roundevenbf16.h"
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, roundevenbf16, (bfloat16 x)) {
return fputil::round_using_specific_rounding_mode(x, FP_INT_TONEAREST);
}
} // namespace LIBC_NAMESPACE_DECL

View File

@@ -0,0 +1,21 @@
//===-- Implementation of truncbf16 function ------------------------------===//
//
// 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 "src/math/truncbf16.h"
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/FPUtil/bfloat16.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(bfloat16, truncbf16, (bfloat16 x)) {
return fputil::trunc(x);
}
} // namespace LIBC_NAMESPACE_DECL

22
libc/src/math/roundbf16.h Normal file
View File

@@ -0,0 +1,22 @@
//===-- Implementation header for roundbf16 ---------------------*- C++
//-*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_SRC_MATH_ROUNDBF16_H
#define LLVM_LIBC_SRC_MATH_ROUNDBF16_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
bfloat16 roundbf16(bfloat16 x);
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_MATH_ROUNDBF16_H

View File

@@ -0,0 +1,21 @@
//===-- Implementation header for roundevenbf16 -----------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_SRC_MATH_ROUNDEVENBF16_H
#define LLVM_LIBC_SRC_MATH_ROUNDEVENBF16_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
bfloat16 roundevenbf16(bfloat16 x);
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_MATH_ROUNDEVENBF16_H

21
libc/src/math/truncbf16.h Normal file
View File

@@ -0,0 +1,21 @@
//===-- Implementation header for truncbf16 ---------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_SRC_MATH_TRUNCBF16_H
#define LLVM_LIBC_SRC_MATH_TRUNCBF16_H
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
bfloat16 truncbf16(bfloat16 x);
} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC_MATH_TRUNCBF16_H

View File

@@ -344,6 +344,19 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
truncbf16_test
SUITE
libc-math-smoke-tests
SRCS
truncbf16_test.cpp
HDRS
TruncTest.h
DEPENDS
libc.src.math.truncbf16
libc.src.__support.FPUtil.bfloat16
)
add_fp_unittest(
canonicalize_test
SUITE
@@ -543,6 +556,19 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
ceilbf16_test
SUITE
libc-math-smoke-tests
SRCS
ceilbf16_test.cpp
HDRS
CeilTest.h
DEPENDS
libc.src.math.ceilbf16
libc.src.__support.FPUtil.bfloat16
)
add_fp_unittest(
dfmal_test
SUITE
@@ -663,6 +689,19 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
floorbf16_test
SUITE
libc-math-smoke-tests
SRCS
floorbf16_test.cpp
HDRS
FloorTest.h
DEPENDS
libc.src.math.floorbf16
libc.src.__support.FPUtil.bfloat16
)
add_fp_unittest(
round_test
SUITE
@@ -727,6 +766,19 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
roundbf16_test
SUITE
libc-math-smoke-tests
SRCS
roundbf16_test.cpp
HDRS
RoundTest.h
DEPENDS
libc.src.math.roundbf16
libc.src.__support.FPUtil.bfloat16
)
add_fp_unittest(
roundeven_test
SUITE
@@ -791,6 +843,19 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)
add_fp_unittest(
roundevenbf16_test
SUITE
libc-math-smoke-tests
SRCS
roundevenbf16_test.cpp
HDRS
RoundEvenTest.h
DEPENDS
libc.src.math.roundevenbf16
libc.src.__support.FPUtil.bfloat16
)
add_fp_unittest(
lround_test
SUITE

View File

@@ -59,10 +59,12 @@ public:
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(50.0), func(T(49.62)));
EXPECT_FP_EQ(T(-50.0), func(T(-50.31)));
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(-123.0), func(T(-123.5)));
}
};

View File

@@ -59,10 +59,11 @@ public:
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(50.0), func(T(50.31)));
EXPECT_FP_EQ(T(-50.0), func(T(-49.63)));
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(-124.0), func(T(-123.5)));
}
};

View File

@@ -59,8 +59,10 @@ public:
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(50.0), func(T(49.63)));
EXPECT_FP_EQ(T(-50.0), func(T(-50.31)));
EXPECT_FP_EQ(T(124.0), func(T(123.5)));
EXPECT_FP_EQ(T(-124.0), func(T(-123.5)));
EXPECT_FP_EQ(T(124.0), func(T(123.96)));
EXPECT_FP_EQ(T(-124.0), func(T(-123.96)));
}

View File

@@ -61,8 +61,8 @@ public:
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)));
}
};

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)