diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt index f5f5c437685a2..0420d826ae630 100644 --- a/libc/config/linux/aarch64/entrypoints.txt +++ b/libc/config/linux/aarch64/entrypoints.txt @@ -512,11 +512,13 @@ if(LIBC_TYPES_HAS_FLOAT128) libc.src.math.lroundf128 libc.src.math.modff128 libc.src.math.nanf128 + libc.src.math.nearbyintf128 libc.src.math.nextafterf128 libc.src.math.nextdownf128 libc.src.math.nextupf128 libc.src.math.rintf128 libc.src.math.roundf128 + libc.src.math.scalbnf128 libc.src.math.sqrtf128 libc.src.math.truncf128 ) diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt index 71289789158f4..59233022a0f8e 100644 --- a/libc/config/linux/riscv/entrypoints.txt +++ b/libc/config/linux/riscv/entrypoints.txt @@ -520,11 +520,13 @@ if(LIBC_TYPES_HAS_FLOAT128) libc.src.math.lroundf128 libc.src.math.modff128 libc.src.math.nanf128 + libc.src.math.nearbyintf128 libc.src.math.nextafterf128 libc.src.math.nextdownf128 libc.src.math.nextupf128 libc.src.math.rintf128 libc.src.math.roundf128 + libc.src.math.scalbnf128 libc.src.math.sqrtf128 libc.src.math.truncf128 ) diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt index 6bb53cb76220f..45413b138b22f 100644 --- a/libc/config/linux/x86_64/entrypoints.txt +++ b/libc/config/linux/x86_64/entrypoints.txt @@ -555,12 +555,14 @@ if(LIBC_TYPES_HAS_FLOAT128) libc.src.math.lroundf128 libc.src.math.modff128 libc.src.math.nanf128 + libc.src.math.nearbyintf128 libc.src.math.nextafterf128 libc.src.math.nextdownf128 libc.src.math.nextupf128 libc.src.math.rintf128 libc.src.math.roundevenf128 libc.src.math.roundf128 + libc.src.math.scalbnf128 libc.src.math.sqrtf128 libc.src.math.truncf128 libc.src.math.ufromfpf128 diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst index 7a7b6c9c8db5d..28503e1d13ab5 100644 --- a/libc/docs/math/index.rst +++ b/libc/docs/math/index.rst @@ -188,7 +188,7 @@ Basic Operations +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ | nan | |check| | |check| | |check| | | |check| | 7.12.11.2 | F.10.8.2 | +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ -| nearbyint | |check| | |check| | |check| | | | 7.12.9.3 | F.10.6.3 | +| nearbyint | |check| | |check| | |check| | | |check| | 7.12.9.3 | F.10.6.3 | +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ | nextafter | |check| | |check| | |check| | | |check| | 7.12.11.3 | F.10.8.3 | +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ @@ -208,7 +208,7 @@ Basic Operations +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ | roundeven | |check| | |check| | |check| | | |check| | 7.12.9.8 | F.10.6.8 | +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ -| scalbn | |check| | |check| | |check| | | | 7.12.6.19 | F.10.3.19 | +| scalbn | |check| | |check| | |check| | | |check| | 7.12.6.19 | F.10.3.19 | +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ | trunc | |check| | |check| | |check| | | |check| | 7.12.9.9 | F.10.6.9 | +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td index 63d0449867114..2670ea53c5f18 100644 --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -599,6 +599,7 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"nearbyint", RetValSpec, [ArgSpec]>, FunctionSpec<"nearbyintf", RetValSpec, [ArgSpec]>, FunctionSpec<"nearbyintl", RetValSpec, [ArgSpec]>, + GuardedFunctionSpec<"nearbyintf128", RetValSpec, [ArgSpec], "LIBC_TYPES_HAS_FLOAT128">, FunctionSpec<"nextafterf", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"nextafter", RetValSpec, [ArgSpec, ArgSpec]>, @@ -642,6 +643,7 @@ def StdC : StandardSpec<"stdc"> { FunctionSpec<"scalbn", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"scalbnf", RetValSpec, [ArgSpec, ArgSpec]>, FunctionSpec<"scalbnl", RetValSpec, [ArgSpec, ArgSpec]>, + GuardedFunctionSpec<"scalbnf128", RetValSpec, [ArgSpec, ArgSpec], "LIBC_TYPES_HAS_FLOAT128">, FunctionSpec<"nanf", RetValSpec, [ArgSpec]>, FunctionSpec<"nan", RetValSpec, [ArgSpec]>, diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt index e8f699fabe365..c34c58575441d 100644 --- a/libc/src/math/CMakeLists.txt +++ b/libc/src/math/CMakeLists.txt @@ -252,6 +252,7 @@ add_math_entrypoint_object(nanf128) add_math_entrypoint_object(nearbyint) add_math_entrypoint_object(nearbyintf) add_math_entrypoint_object(nearbyintl) +add_math_entrypoint_object(nearbyintf128) add_math_entrypoint_object(nextafter) add_math_entrypoint_object(nextafterf) @@ -301,6 +302,7 @@ add_math_entrypoint_object(roundevenf128) add_math_entrypoint_object(scalbn) add_math_entrypoint_object(scalbnf) add_math_entrypoint_object(scalbnl) +add_math_entrypoint_object(scalbnf128) add_math_entrypoint_object(sincos) add_math_entrypoint_object(sincosf) diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt index 574e000b82a8f..daaf505008ca1 100644 --- a/libc/src/math/generic/CMakeLists.txt +++ b/libc/src/math/generic/CMakeLists.txt @@ -704,7 +704,7 @@ add_entrypoint_object( DEPENDS libc.src.__support.FPUtil.nearest_integer_operations COMPILE_OPTIONS - -O2 + -O3 ) add_entrypoint_object( @@ -716,7 +716,7 @@ add_entrypoint_object( DEPENDS libc.src.__support.FPUtil.nearest_integer_operations COMPILE_OPTIONS - -O2 + -O3 ) add_entrypoint_object( @@ -728,7 +728,20 @@ add_entrypoint_object( DEPENDS libc.src.__support.FPUtil.nearest_integer_operations COMPILE_OPTIONS - -O2 + -O3 +) + +add_entrypoint_object( + nearbyintf128 + SRCS + nearbyintf128.cpp + HDRS + ../nearbyintf128.h + DEPENDS + libc.src.__support.macros.properties.types + libc.src.__support.FPUtil.nearest_integer_operations + COMPILE_OPTIONS + -O3 ) add_object_library( @@ -2949,6 +2962,19 @@ add_entrypoint_object( -O3 ) +add_entrypoint_object( + scalbnf128 + SRCS + scalbnf128.cpp + HDRS + ../scalbnf128.h + DEPENDS + libc.src.__support.macros.properties.types + libc.src.__support.FPUtil.manipulation_functions + COMPILE_OPTIONS + -O3 +) + add_entrypoint_object( fmaf SRCS diff --git a/libc/src/math/generic/nearbyintf128.cpp b/libc/src/math/generic/nearbyintf128.cpp new file mode 100644 index 0000000000000..fca3587f5b58a --- /dev/null +++ b/libc/src/math/generic/nearbyintf128.cpp @@ -0,0 +1,19 @@ +//===-- Implementation of nearbyintf128 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/nearbyintf128.h" +#include "src/__support/FPUtil/NearestIntegerOperations.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(float128, nearbyintf128, (float128 x)) { + return fputil::round_using_current_rounding_mode(x); +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/scalbnf128.cpp b/libc/src/math/generic/scalbnf128.cpp new file mode 100644 index 0000000000000..be3d29ed27e98 --- /dev/null +++ b/libc/src/math/generic/scalbnf128.cpp @@ -0,0 +1,27 @@ +//===-- Implementation of scalbnf128 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/scalbnf128.h" +#include "src/__support/FPUtil/ManipulationFunctions.h" +#include "src/__support/common.h" + +namespace LIBC_NAMESPACE { + +LLVM_LIBC_FUNCTION(float128, scalbnf128, (float128 x, int n)) { +// TODO: should be switched to use `FLT_RADIX` in hdr/float_macros.h" instead +// see: https://github.com/llvm/llvm-project/issues/90496 +#if !defined(__FLT_RADIX__) +#error __FLT_RADIX__ undefined. +#elif __FLT_RADIX__ != 2 +#error __FLT_RADIX__!=2, unimplemented. +#else + return fputil::ldexp(x, n); +#endif +} + +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/nearbyintf128.h b/libc/src/math/nearbyintf128.h new file mode 100644 index 0000000000000..d12754a481009 --- /dev/null +++ b/libc/src/math/nearbyintf128.h @@ -0,0 +1,20 @@ +//===-- Implementation header for nearbyintf128 -----------------*- 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_NEARBYINTF128_H +#define LLVM_LIBC_SRC_MATH_NEARBYINTF128_H + +#include "src/__support/macros/properties/types.h" + +namespace LIBC_NAMESPACE { + +float128 nearbyintf128(float128 x); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_MATH_NEARBYINTF128_H diff --git a/libc/src/math/scalbnf128.h b/libc/src/math/scalbnf128.h new file mode 100644 index 0000000000000..bd3b560fb7cc4 --- /dev/null +++ b/libc/src/math/scalbnf128.h @@ -0,0 +1,20 @@ +//===-- Implementation header for scalbnf128 --------------------*- 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_SCALBNF128_H +#define LLVM_LIBC_SRC_MATH_SCALBNF128_H + +#include "src/__support/macros/properties/types.h" + +namespace LIBC_NAMESPACE { + +float128 scalbnf128(float128 x, int n); + +} // namespace LIBC_NAMESPACE + +#endif // LLVM_LIBC_SRC_MATH_SCALBNF128_H diff --git a/libc/test/UnitTest/FPMatcher.h b/libc/test/UnitTest/FPMatcher.h index a76e0b8ef6f6f..c58c322c981e4 100644 --- a/libc/test/UnitTest/FPMatcher.h +++ b/libc/test/UnitTest/FPMatcher.h @@ -219,4 +219,25 @@ template struct FPTest : public Test { } \ } while (0) +#define EXPECT_FP_EQ_ROUNDING_MODE(expected, actual, rounding_mode) \ + do { \ + using namespace LIBC_NAMESPACE::fputil::testing; \ + ForceRoundingMode __r((rounding_mode)); \ + if (__r.success) { \ + EXPECT_FP_EQ((expected), (actual)); \ + } \ + } while (0) + +#define EXPECT_FP_EQ_ROUNDING_NEAREST(expected, actual) \ + EXPECT_FP_EQ_ROUNDING_MODE((expected), (actual), RoundingMode::Nearest) + +#define EXPECT_FP_EQ_ROUNDING_UPWARD(expected, actual) \ + EXPECT_FP_EQ_ROUNDING_MODE((expected), (actual), RoundingMode::Upward) + +#define EXPECT_FP_EQ_ROUNDING_DOWNWARD(expected, actual) \ + EXPECT_FP_EQ_ROUNDING_MODE((expected), (actual), RoundingMode::Downward) + +#define EXPECT_FP_EQ_ROUNDING_TOWARD_ZERO(expected, actual) \ + EXPECT_FP_EQ_ROUNDING_MODE((expected), (actual), RoundingMode::TowardZero) + #endif // LLVM_LIBC_TEST_UNITTEST_FPMATCHER_H diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt index 55119868bdaa1..102188c332e40 100644 --- a/libc/test/src/math/CMakeLists.txt +++ b/libc/test/src/math/CMakeLists.txt @@ -1650,6 +1650,21 @@ add_fp_unittest( libc.src.__support.FPUtil.normal_float ) +add_fp_unittest( + scalbnf128_test + NEED_MPFR + SUITE + libc-math-unittests + SRCS + scalbnf128_test.cpp + HDRS + ScalbnTest.h + DEPENDS + libc.src.math.scalbnf128 + libc.src.__support.FPUtil.fp_bits + libc.src.__support.FPUtil.normal_float +) + add_fp_unittest( erff_test NEED_MPFR diff --git a/libc/test/src/math/scalbnf128_test.cpp b/libc/test/src/math/scalbnf128_test.cpp new file mode 100644 index 0000000000000..dc259de211489 --- /dev/null +++ b/libc/test/src/math/scalbnf128_test.cpp @@ -0,0 +1,13 @@ +//===-- Unittests for scalbnf128 ------------------------------------------===// +// +// 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 "ScalbnTest.h" + +#include "src/math/scalbnf128.h" + +LIST_SCALBN_TESTS(float128, LIBC_NAMESPACE::scalbnf128) diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt index 22c59c97f6c7f..112b2985829ca 100644 --- a/libc/test/src/math/smoke/CMakeLists.txt +++ b/libc/test/src/math/smoke/CMakeLists.txt @@ -2188,6 +2188,58 @@ add_fp_unittest( UNIT_TEST_ONLY ) +add_fp_unittest( + nearbyint_test + SUITE + libc-math-smoke-tests + SRCS + nearbyint_test.cpp + HDRS + NearbyIntTest.h + DEPENDS + libc.hdr.fenv_macros + libc.src.math.nearbyint +) + +add_fp_unittest( + nearbyintf_test + SUITE + libc-math-smoke-tests + SRCS + nearbyintf_test.cpp + HDRS + NearbyIntTest.h + DEPENDS + libc.hdr.fenv_macros + libc.src.math.nearbyintf +) + +add_fp_unittest( + nearbyintl_test + SUITE + libc-math-smoke-tests + SRCS + nearbyintl_test.cpp + HDRS + NearbyIntTest.h + DEPENDS + libc.hdr.fenv_macros + libc.src.math.nearbyintl +) + +add_fp_unittest( + nearbyintf128_test + SUITE + libc-math-smoke-tests + SRCS + nearbyintf128_test.cpp + HDRS + NearbyIntTest.h + DEPENDS + libc.hdr.fenv_macros + libc.src.math.nearbyintf128 +) + add_fp_unittest( nextafter_test SUITE @@ -2739,7 +2791,6 @@ add_fp_unittest( DEPENDS libc.src.math.scalbn libc.src.__support.FPUtil.fp_bits - libc.src.__support.FPUtil.normal_float ) add_fp_unittest( @@ -2753,7 +2804,6 @@ add_fp_unittest( DEPENDS libc.src.math.scalbnf libc.src.__support.FPUtil.fp_bits - libc.src.__support.FPUtil.normal_float ) add_fp_unittest( @@ -2767,7 +2817,19 @@ add_fp_unittest( DEPENDS libc.src.math.scalbnl libc.src.__support.FPUtil.fp_bits - libc.src.__support.FPUtil.normal_float +) + +add_fp_unittest( + scalbnf128_test + SUITE + libc-math-smoke-tests + SRCS + scalbnf128_test.cpp + HDRS + ScalbnTest.h + DEPENDS + libc.src.math.scalbnf128 + libc.src.__support.FPUtil.fp_bits ) add_fp_unittest( diff --git a/libc/test/src/math/smoke/NearbyIntTest.h b/libc/test/src/math/smoke/NearbyIntTest.h new file mode 100644 index 0000000000000..0051ff9447a7e --- /dev/null +++ b/libc/test/src/math/smoke/NearbyIntTest.h @@ -0,0 +1,100 @@ +//===-- Utility class to test different flavors of nearbyint ----*- 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_TEST_SRC_MATH_NEARBYINTTEST_H +#define LLVM_LIBC_TEST_SRC_MATH_NEARBYINTTEST_H + +#include "hdr/fenv_macros.h" +#include "src/__support/FPUtil/FEnvImpl.h" +#include "src/__support/FPUtil/FPBits.h" +#include "test/UnitTest/FPMatcher.h" +#include "test/UnitTest/Test.h" + +static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO, + FE_TONEAREST}; + +template +class NearbyIntTestTemplate : public LIBC_NAMESPACE::testing::Test { + + DECLARE_SPECIAL_CONSTANTS(T) + +public: + typedef T (*NearbyIntFunc)(T); + + void testNaN(NearbyIntFunc func) { + EXPECT_FP_EQ_ALL_ROUNDING(func(aNaN), aNaN); + } + + void testInfinities(NearbyIntFunc func) { + EXPECT_FP_EQ_ALL_ROUNDING(func(inf), inf); + EXPECT_FP_EQ_ALL_ROUNDING(func(neg_inf), neg_inf); + } + + void testZeroes(NearbyIntFunc func) { + EXPECT_FP_EQ_ALL_ROUNDING(func(zero), zero); + EXPECT_FP_EQ_ALL_ROUNDING(func(neg_zero), neg_zero); + } + + void testIntegers(NearbyIntFunc func) { + EXPECT_FP_EQ_ALL_ROUNDING(func(T(1.0)), T(1.0)); + EXPECT_FP_EQ_ALL_ROUNDING(func(T(-1.0)), T(-1.0)); + + EXPECT_FP_EQ_ALL_ROUNDING(func(T(1234.0)), T(1234.0)); + EXPECT_FP_EQ_ALL_ROUNDING(func(T(-1234.0)), T(-1234.0)); + + EXPECT_FP_EQ_ALL_ROUNDING(func(T(10.0)), T(10.0)); + EXPECT_FP_EQ_ALL_ROUNDING(func(T(-10.0)), T(-10.0)); + + FPBits ints_start(T(0)); + ints_start.set_biased_exponent(FPBits::SIG_LEN + FPBits::EXP_BIAS); + T expected = ints_start.get_val(); + EXPECT_FP_EQ_ALL_ROUNDING(func(expected), expected); + } + + void testSubnormalToNearest(NearbyIntFunc func) { + ASSERT_FP_EQ(func(min_denormal), zero); + ASSERT_FP_EQ(func(-min_denormal), neg_zero); + } + + void testSubnormalTowardZero(NearbyIntFunc func) { + EXPECT_FP_EQ_ROUNDING_TOWARD_ZERO(func(min_denormal), zero); + EXPECT_FP_EQ_ROUNDING_TOWARD_ZERO(func(-min_denormal), neg_zero); + } + + void testSubnormalToPosInf(NearbyIntFunc func) { + EXPECT_FP_EQ_ROUNDING_UPWARD(func(min_denormal), FPBits::one().get_val()); + EXPECT_FP_EQ_ROUNDING_UPWARD(func(-min_denormal), neg_zero); + } + + void testSubnormalToNegInf(NearbyIntFunc func) { + T negative_one = FPBits::one(Sign::NEG).get_val(); + EXPECT_FP_EQ_ROUNDING_DOWNWARD(func(min_denormal), zero); + EXPECT_FP_EQ_ROUNDING_DOWNWARD(func(-min_denormal), negative_one); + } +}; + +#define LIST_NEARBYINT_TESTS(T, func) \ + using LlvmLibcNearbyIntTest = NearbyIntTestTemplate; \ + TEST_F(LlvmLibcNearbyIntTest, TestNaN) { testNaN(&func); } \ + TEST_F(LlvmLibcNearbyIntTest, TestInfinities) { testInfinities(&func); } \ + TEST_F(LlvmLibcNearbyIntTest, TestZeroes) { testZeroes(&func); } \ + TEST_F(LlvmLibcNearbyIntTest, TestIntegers) { testIntegers(&func); } \ + TEST_F(LlvmLibcNearbyIntTest, TestSubnormalToNearest) { \ + testSubnormalToNearest(&func); \ + } \ + TEST_F(LlvmLibcNearbyIntTest, TestSubnormalTowardZero) { \ + testSubnormalTowardZero(&func); \ + } \ + TEST_F(LlvmLibcNearbyIntTest, TestSubnormalToPosInf) { \ + testSubnormalToPosInf(&func); \ + } \ + TEST_F(LlvmLibcNearbyIntTest, TestSubnormalToNegInf) { \ + testSubnormalToNegInf(&func); \ + } + +#endif // LLVM_LIBC_TEST_SRC_MATH_NEARBYINTTEST_H diff --git a/libc/test/src/math/smoke/nearbyint_test.cpp b/libc/test/src/math/smoke/nearbyint_test.cpp new file mode 100644 index 0000000000000..11a5c3372e73e --- /dev/null +++ b/libc/test/src/math/smoke/nearbyint_test.cpp @@ -0,0 +1,13 @@ +//===-- Unittests for nearbyint -------------------------------------------===// +// +// 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 "NearbyIntTest.h" + +#include "src/math/nearbyint.h" + +LIST_NEARBYINT_TESTS(double, LIBC_NAMESPACE::nearbyint) diff --git a/libc/test/src/math/smoke/nearbyintf128_test.cpp b/libc/test/src/math/smoke/nearbyintf128_test.cpp new file mode 100644 index 0000000000000..98fbb2858fafa --- /dev/null +++ b/libc/test/src/math/smoke/nearbyintf128_test.cpp @@ -0,0 +1,13 @@ +//===-- Unittests for nearbyintf128 ---------------------------------------===// +// +// 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 "NearbyIntTest.h" + +#include "src/math/nearbyintf128.h" + +LIST_NEARBYINT_TESTS(float128, LIBC_NAMESPACE::nearbyintf128) diff --git a/libc/test/src/math/smoke/nearbyintf_test.cpp b/libc/test/src/math/smoke/nearbyintf_test.cpp new file mode 100644 index 0000000000000..fd26153cfffb9 --- /dev/null +++ b/libc/test/src/math/smoke/nearbyintf_test.cpp @@ -0,0 +1,13 @@ +//===-- Unittests for nearbyintf ------------------------------------------===// +// +// 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 "NearbyIntTest.h" + +#include "src/math/nearbyintf.h" + +LIST_NEARBYINT_TESTS(float, LIBC_NAMESPACE::nearbyintf) diff --git a/libc/test/src/math/smoke/nearbyintl_test.cpp b/libc/test/src/math/smoke/nearbyintl_test.cpp new file mode 100644 index 0000000000000..a6d81a1439e17 --- /dev/null +++ b/libc/test/src/math/smoke/nearbyintl_test.cpp @@ -0,0 +1,13 @@ +//===-- Unittests for nearbyintl ------------------------------------------===// +// +// 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 "NearbyIntTest.h" + +#include "src/math/nearbyintl.h" + +LIST_NEARBYINT_TESTS(long double, LIBC_NAMESPACE::nearbyintl) diff --git a/libc/test/src/math/smoke/scalbnf128_test.cpp b/libc/test/src/math/smoke/scalbnf128_test.cpp new file mode 100644 index 0000000000000..dc259de211489 --- /dev/null +++ b/libc/test/src/math/smoke/scalbnf128_test.cpp @@ -0,0 +1,13 @@ +//===-- Unittests for scalbnf128 ------------------------------------------===// +// +// 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 "ScalbnTest.h" + +#include "src/math/scalbnf128.h" + +LIST_SCALBN_TESTS(float128, LIBC_NAMESPACE::scalbnf128)