29 changes: 29 additions & 0 deletions libc/test/src/math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2391,6 +2391,35 @@ add_fp_unittest(
libc.src.stdlib.srand
)

add_fp_unittest(
dfmal_test
NEED_MPFR
SUITE
libc-math-unittests
SRCS
dfmal_test.cpp
HDRS
FmaTest.h
DEPENDS
libc.src.math.dfmal
libc.src.stdlib.rand
libc.src.stdlib.srand
)

add_fp_unittest(
dsubl_test
NEED_MPFR
SUITE
libc-math-unittests
SRCS
dsubl_test.cpp
HDRS
SubTest.h
DEPENDS
libc.src.math.dsubl
)


add_subdirectory(generic)
add_subdirectory(smoke)

Expand Down
13 changes: 13 additions & 0 deletions libc/test/src/math/dfmal_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===-- Unittests for dfmal -----------------------------------------------===//
//
// 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 "FmaTest.h"

#include "src/math/dfmal.h"

LIST_NARROWING_FMA_TESTS(double, long double, LIBC_NAMESPACE::dfmal)
13 changes: 13 additions & 0 deletions libc/test/src/math/dsubl_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===-- Unittests for dsubl -----------------------------------------------===//
//
// 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 "SubTest.h"

#include "src/math/dsubl.h"

LIST_SUB_TESTS(double, long double, LIBC_NAMESPACE::dsubl)
60 changes: 56 additions & 4 deletions libc/test/src/math/smoke/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,58 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)

add_fp_unittest(
dfmal_test
SUITE
libc-math-smoke-tests
SRCS
dfmal_test.cpp
HDRS
FmaTest.h
DEPENDS
libc.src.math.dfmal
)

add_fp_unittest(
dfmaf128_test
SUITE
libc-math-smoke-tests
SRCS
dfmaf128_test.cpp
HDRS
FmaTest.h
DEPENDS
libc.src.math.dfmaf128
)

add_fp_unittest(
dsubl_test
SUITE
libc-math-smoke-tests
SRCS
dsubl_test.cpp
HDRS
SubTest.h
DEPENDS
libc.src.errno.errno
libc.hdr.fenv_macros
libc.src.math.dsubl
)

add_fp_unittest(
dsubf128_test
SUITE
libc-math-smoke-tests
SRCS
dsubf128_test.cpp
HDRS
SubTest.h
DEPENDS
libc.hdr.errno_macros
libc.hdr.fenv_macros
libc.src.math.dsubf128
)

add_fp_unittest(
floor_test
SUITE
Expand Down Expand Up @@ -3903,8 +3955,8 @@ add_fp_unittest(
HDRS
SubTest.h
DEPENDS
libc.hdr.errno_macros
libc.hdr.fenv_macros
libc.src.__support.FPUtil.basic_operations
libc.src.math.f16sub
)

Expand All @@ -3917,8 +3969,8 @@ add_fp_unittest(
HDRS
SubTest.h
DEPENDS
libc.hdr.errno_macros
libc.hdr.fenv_macros
libc.src.__support.FPUtil.basic_operations
libc.src.math.f16subf
)

Expand All @@ -3931,8 +3983,8 @@ add_fp_unittest(
HDRS
SubTest.h
DEPENDS
libc.hdr.errno_macros
libc.hdr.fenv_macros
libc.src.__support.FPUtil.basic_operations
libc.src.math.f16subl
)

Expand All @@ -3945,8 +3997,8 @@ add_fp_unittest(
HDRS
SubTest.h
DEPENDS
libc.hdr.errno_macros
libc.hdr.fenv_macros
libc.src.__support.FPUtil.basic_operations
libc.src.math.f16subf128
)

Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/math/smoke/SubTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_SMOKE_SUBTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_SUBTEST_H

#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "test/UnitTest/FEnvSafeTest.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
Expand Down
13 changes: 13 additions & 0 deletions libc/test/src/math/smoke/dfmaf128_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===-- Unittests for dfmaf128 --------------------------------------------===//
//
// 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 "FmaTest.h"

#include "src/math/dfmaf128.h"

LIST_NARROWING_FMA_TESTS(double, float128, LIBC_NAMESPACE::dfmaf128)
13 changes: 13 additions & 0 deletions libc/test/src/math/smoke/dfmal_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===-- Unittests for dfmal -----------------------------------------------===//
//
// 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 "FmaTest.h"

#include "src/math/dfmal.h"

LIST_NARROWING_FMA_TESTS(double, long double, LIBC_NAMESPACE::dfmal)
13 changes: 13 additions & 0 deletions libc/test/src/math/smoke/dsubf128_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===-- Unittests for dsubf128 --------------------------------------------===//
//
// 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 "SubTest.h"

#include "src/math/dsubf128.h"

LIST_SUB_TESTS(double, float128, LIBC_NAMESPACE::dsubf128)
13 changes: 13 additions & 0 deletions libc/test/src/math/smoke/dsubl_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===-- Unittests for dsubl -----------------------------------------------===//
//
// 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 "SubTest.h"

#include "src/math/dsubl.h"

LIST_SUB_TESTS(double, long double, LIBC_NAMESPACE::dsubl)
6 changes: 6 additions & 0 deletions libc/utils/MPFRWrapper/MPFRUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,9 @@ template void
explain_ternary_operation_one_output_error(Operation,
const TernaryInput<long double> &,
long double, double, RoundingMode);

template void explain_ternary_operation_one_output_error(
Operation, const TernaryInput<long double> &, double, double, RoundingMode);
#ifdef LIBC_TYPES_HAS_FLOAT16
template void explain_ternary_operation_one_output_error(
Operation, const TernaryInput<float> &, float16, double, RoundingMode);
Expand Down Expand Up @@ -1271,6 +1274,9 @@ template bool
compare_ternary_operation_one_output(Operation,
const TernaryInput<long double> &,
long double, double, RoundingMode);

template bool compare_ternary_operation_one_output(
Operation, const TernaryInput<long double> &, double, double, RoundingMode);
#ifdef LIBC_TYPES_HAS_FLOAT16
template bool compare_ternary_operation_one_output(Operation,
const TernaryInput<float> &,
Expand Down