19 changes: 19 additions & 0 deletions libc/src/math/generic/f16sub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//===-- Implementation of f16sub 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/f16sub.h"
#include "src/__support/FPUtil/generic/add_sub.h"
#include "src/__support/common.h"

namespace LIBC_NAMESPACE {

LLVM_LIBC_FUNCTION(float16, f16sub, (double x, double y)) {
return fputil::generic::sub<float16>(x, y);
}

} // namespace LIBC_NAMESPACE
19 changes: 19 additions & 0 deletions libc/src/math/generic/f16subf128.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//===-- Implementation of f16subf128 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/f16subf128.h"
#include "src/__support/FPUtil/generic/add_sub.h"
#include "src/__support/common.h"

namespace LIBC_NAMESPACE {

LLVM_LIBC_FUNCTION(float16, f16subf128, (float128 x, float128 y)) {
return fputil::generic::sub<float16>(x, y);
}

} // namespace LIBC_NAMESPACE
19 changes: 19 additions & 0 deletions libc/src/math/generic/f16subl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//===-- Implementation of f16subl 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/f16subl.h"
#include "src/__support/FPUtil/generic/add_sub.h"
#include "src/__support/common.h"

namespace LIBC_NAMESPACE {

LLVM_LIBC_FUNCTION(float16, f16subl, (long double x, long double y)) {
return fputil::generic::sub<float16>(x, y);
}

} // namespace LIBC_NAMESPACE
52 changes: 52 additions & 0 deletions libc/test/src/math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1996,6 +1996,19 @@ add_fp_unittest(
libc.src.__support.FPUtil.fp_bits
)

add_fp_unittest(
f16add_test
NEED_MPFR
SUITE
libc-math-unittests
SRCS
f16add_test.cpp
HDRS
AddTest.h
DEPENDS
libc.src.math.f16add
)

add_fp_unittest(
f16addf_test
NEED_MPFR
Expand All @@ -2009,6 +2022,32 @@ add_fp_unittest(
libc.src.math.f16addf
)

add_fp_unittest(
f16addl_test
NEED_MPFR
SUITE
libc-math-unittests
SRCS
f16addl_test.cpp
HDRS
AddTest.h
DEPENDS
libc.src.math.f16addl
)

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

add_fp_unittest(
f16subf_test
NEED_MPFR
Expand All @@ -2022,6 +2061,19 @@ add_fp_unittest(
libc.src.math.f16subf
)

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

add_fp_unittest(
f16div_test
NEED_MPFR
Expand Down
13 changes: 13 additions & 0 deletions libc/test/src/math/f16add_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===-- Unittests for f16add ----------------------------------------------===//
//
// 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 "AddTest.h"

#include "src/math/f16add.h"

LIST_ADD_TESTS(float16, double, LIBC_NAMESPACE::f16add)
13 changes: 13 additions & 0 deletions libc/test/src/math/f16addl_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===-- Unittests for f16addl ---------------------------------------------===//
//
// 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 "AddTest.h"

#include "src/math/f16addl.h"

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

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

LIST_SUB_TESTS(float16, long double, LIBC_NAMESPACE::f16subl)
87 changes: 87 additions & 0 deletions libc/test/src/math/smoke/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3643,6 +3643,21 @@ add_fp_unittest(
libc.src.math.setpayloadsigf16
)

add_fp_unittest(
f16add_test
SUITE
libc-math-smoke-tests
SRCS
f16add_test.cpp
HDRS
AddTest.h
DEPENDS
libc.hdr.errno_macros
libc.hdr.fenv_macros
libc.src.__support.FPUtil.basic_operations
libc.src.math.f16add
)

add_fp_unittest(
f16addf_test
SUITE
Expand All @@ -3658,6 +3673,50 @@ add_fp_unittest(
libc.src.math.f16addf
)

add_fp_unittest(
f16addl_test
SUITE
libc-math-smoke-tests
SRCS
f16addl_test.cpp
HDRS
AddTest.h
DEPENDS
libc.hdr.errno_macros
libc.hdr.fenv_macros
libc.src.__support.FPUtil.basic_operations
libc.src.math.f16addl
)

add_fp_unittest(
f16addf128_test
SUITE
libc-math-smoke-tests
SRCS
f16addf128_test.cpp
HDRS
AddTest.h
DEPENDS
libc.hdr.errno_macros
libc.hdr.fenv_macros
libc.src.__support.FPUtil.basic_operations
libc.src.math.f16addf128
)

add_fp_unittest(
f16sub_test
SUITE
libc-math-smoke-tests
SRCS
f16sub_test.cpp
HDRS
SubTest.h
DEPENDS
libc.hdr.fenv_macros
libc.src.__support.FPUtil.basic_operations
libc.src.math.f16sub
)

add_fp_unittest(
f16subf_test
SUITE
Expand All @@ -3672,6 +3731,34 @@ add_fp_unittest(
libc.src.math.f16subf
)

add_fp_unittest(
f16subl_test
SUITE
libc-math-smoke-tests
SRCS
f16subl_test.cpp
HDRS
SubTest.h
DEPENDS
libc.hdr.fenv_macros
libc.src.__support.FPUtil.basic_operations
libc.src.math.f16subl
)

add_fp_unittest(
f16subf128_test
SUITE
libc-math-smoke-tests
SRCS
f16subf128_test.cpp
HDRS
SubTest.h
DEPENDS
libc.hdr.fenv_macros
libc.src.__support.FPUtil.basic_operations
libc.src.math.f16subf128
)

add_fp_unittest(
f16div_test
SUITE
Expand Down
13 changes: 13 additions & 0 deletions libc/test/src/math/smoke/f16add_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===-- Unittests for f16add ----------------------------------------------===//
//
// 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 "AddTest.h"

#include "src/math/f16add.h"

LIST_ADD_TESTS(float16, double, LIBC_NAMESPACE::f16add)
13 changes: 13 additions & 0 deletions libc/test/src/math/smoke/f16addf128_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===-- Unittests for f16addf128 ------------------------------------------===//
//
// 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 "AddTest.h"

#include "src/math/f16addf128.h"

LIST_ADD_TESTS(float16, float128, LIBC_NAMESPACE::f16addf128)
13 changes: 13 additions & 0 deletions libc/test/src/math/smoke/f16addl_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===-- Unittests for f16addl ---------------------------------------------===//
//
// 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 "AddTest.h"

#include "src/math/f16addl.h"

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

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

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

LIST_SUB_TESTS(float16, long double, LIBC_NAMESPACE::f16subl)