-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc][math][c23] Add fsub{,l,f128} and remainderf128 C23 math functions #101576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc][math][c23] Add fsub{,l,f128} and remainderf128 C23 math functions #101576
Conversation
@llvm/pr-subscribers-libc Author: None (aaryanshukla) Changes
Patch is 20.67 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/101576.diff 26 Files Affected:
diff --git a/libc/config/darwin/arm/entrypoints.txt b/libc/config/darwin/arm/entrypoints.txt
index d09b4e34b951c..6aaf5d46678d0 100644
--- a/libc/config/darwin/arm/entrypoints.txt
+++ b/libc/config/darwin/arm/entrypoints.txt
@@ -180,6 +180,8 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.frexp
libc.src.math.frexpf
libc.src.math.frexpl
+ libc.src.math.fsub
+ libc.src.math.fsubl
libc.src.math.hypot
libc.src.math.hypotf
libc.src.math.ilogb
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index 1cff157c629df..e7a33761e5cbb 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -147,6 +147,8 @@ set(TARGET_LIBM_ENTRYPOINTS
#libc.src.math.frexp
#libc.src.math.frexpf
#libc.src.math.frexpl
+ #libc.src.math.fsub
+ #libc.src.math.fsubl
#libc.src.math.hypot
#libc.src.math.hypotf
#libc.src.math.ilogb
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index ff0bf0ea345d3..57e92ecdbb014 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -435,6 +435,8 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fromfpxl
libc.src.math.fsqrt
libc.src.math.fsqrtl
+ libc.src.math.fsub
+ libc.src.math.fsubl
libc.src.math.getpayload
libc.src.math.getpayloadf
libc.src.math.hypot
@@ -638,6 +640,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.frexpf128
libc.src.math.fromfpf128
libc.src.math.fromfpxf128
+ libc.src.math.fsubf128
libc.src.math.getpayloadf128
libc.src.math.ilogbf128
libc.src.math.ldexpf128
@@ -653,6 +656,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.nextafterf128
libc.src.math.nextdownf128
libc.src.math.nextupf128
+ libc.src.math.remainderf128
libc.src.math.remquof128
libc.src.math.rintf128
libc.src.math.roundf128
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 90aae962080cd..71d75960a03d8 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -293,6 +293,8 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fromfpx
libc.src.math.fromfpxf
libc.src.math.fromfpxl
+ libc.src.math.fsub
+ libc.src.math.fsubl
libc.src.math.getpayload
libc.src.math.getpayloadf
libc.src.math.hypot
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 8443ef417b479..a3fbd7494b100 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -458,6 +458,8 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fromfpxl
libc.src.math.fsqrt
libc.src.math.fsqrtl
+ libc.src.math.fsub
+ libc.src.math.fsubl
libc.src.math.getpayload
libc.src.math.getpayloadf
libc.src.math.hypot
@@ -594,6 +596,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.fromfpf128
libc.src.math.fromfpxf128
libc.src.math.fsqrtf128
+ libc.src.math.fsubf128
libc.src.math.getpayloadf128
libc.src.math.ilogbf128
libc.src.math.ldexpf128
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index f737cca7f15b6..eee6a0c756d89 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -458,6 +458,8 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fromfpxl
libc.src.math.fsqrt
libc.src.math.fsqrtl
+ libc.src.math.fsub
+ libc.src.math.fsubl
libc.src.math.getpayload
libc.src.math.getpayloadf
libc.src.math.hypot
@@ -683,6 +685,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.fromfpf128
libc.src.math.fromfpxf128
libc.src.math.fsqrtf128
+ libc.src.math.fsubf128
libc.src.math.getpayloadf128
libc.src.math.ilogbf128
libc.src.math.ldexpf128
@@ -698,6 +701,7 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.nextafterf128
libc.src.math.nextdownf128
libc.src.math.nextupf128
+ libc.src.math.remainderf128
libc.src.math.remquof128
libc.src.math.rintf128
libc.src.math.roundevenf128
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index e45219a9070e3..c611e4ae7e11b 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -193,6 +193,8 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.frexp
libc.src.math.frexpf
libc.src.math.frexpl
+ libc.src.math.fsub
+ libc.src.math.fsubl
libc.src.math.hypot
libc.src.math.hypotf
libc.src.math.ilogb
diff --git a/libc/newhdrgen/yaml/math.yaml b/libc/newhdrgen/yaml/math.yaml
index ce562c653a6d2..cdd90e994c94c 100644
--- a/libc/newhdrgen/yaml/math.yaml
+++ b/libc/newhdrgen/yaml/math.yaml
@@ -794,6 +794,14 @@ functions:
arguments:
- type: long double
- type: long double
+ - name: remainderf128
+ standards:
+ - llvm_libc_ext
+ return_type: float128
+ arguments:
+ - type: float128
+ - type: float128
+ guard: LIBC_TYPES_HAS_FLOAT128
- name: remquo
standards:
- stdc
@@ -1540,6 +1548,28 @@ functions:
- type: int
- type: unsigned int
guard: LIBC_TYPES_HAS_FLOAT16
+ - name: fsub
+ standards:
+ - stdc
+ return_type: float
+ arguments:
+ - type: double
+ - type: double
+ - name: fsubl
+ standards:
+ - stdc
+ return_type: float
+ arguments:
+ - type: long double
+ - type: long double
+ - name: fsubf128
+ standards:
+ - llvm_libc_ext
+ return_type: float
+ arguments:
+ - type: float128
+ - type: float128
+ guard: LIBC_TYPES_HAS_FLOAT128
- name: getpayloadf16
standards:
- stdc
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index bd022ad88d884..92eb20e5e61fe 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -260,6 +260,10 @@ add_math_entrypoint_object(fromfpxl)
add_math_entrypoint_object(fromfpxf16)
add_math_entrypoint_object(fromfpxf128)
+add_math_entrypoint_object(fsub)
+add_math_entrypoint_object(fsubl)
+add_math_entrypoint_object(fsubf128)
+
add_math_entrypoint_object(getpayload)
add_math_entrypoint_object(getpayloadf)
add_math_entrypoint_object(getpayloadf16)
@@ -382,6 +386,7 @@ add_math_entrypoint_object(remainder)
add_math_entrypoint_object(remainderf)
add_math_entrypoint_object(remainderl)
add_math_entrypoint_object(remainderf16)
+add_math_entrypoint_object(remainderf128)
add_math_entrypoint_object(remquo)
add_math_entrypoint_object(remquof)
diff --git a/libc/src/math/fsub.h b/libc/src/math/fsub.h
new file mode 100644
index 0000000000000..f17f0fd3ec307
--- /dev/null
+++ b/libc/src/math/fsub.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for fsub --------------------------*- 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_FSUB_H
+#define LLVM_LIBC_SRC_MATH_FSUB_H
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float fsub(double x, double y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_FSUB_H
diff --git a/libc/src/math/fsubf128.h b/libc/src/math/fsubf128.h
new file mode 100644
index 0000000000000..4f41c7d8bb04d
--- /dev/null
+++ b/libc/src/math/fsubf128.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for fsubf128 ----------------------*- 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_FSUBF128_H
+#define LLVM_LIBC_SRC_MATH_FSUBF128_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float fsubf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_FSUBF128_H
diff --git a/libc/src/math/fsubl.h b/libc/src/math/fsubl.h
new file mode 100644
index 0000000000000..32570ca3dc0f7
--- /dev/null
+++ b/libc/src/math/fsubl.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for fsubl -------------------------*- 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_FSUBL_H
+#define LLVM_LIBC_SRC_MATH_FSUBL_H
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float fsubl(long double x, long double y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_FSUBL_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 927d97578316e..4c312b7360af7 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -2823,6 +2823,43 @@ add_entrypoint_object(
-O3
)
+add_entrypoint_object(
+ fsub
+ SRCS
+ fsub.cpp
+ HDRS
+ ../fsub.h
+ DEPENDS
+ libc.src.__support.FPUtil.generic.add_sub
+ COMPILE_OPTIONS
+ -O3
+)
+
+add_entrypoint_object(
+ fsubl
+ SRCS
+ fsubl.cpp
+ HDRS
+ ../fsubl.h
+ DEPENDS
+ libc.src.__support.FPUtil.generic.add_sub
+ COMPILE_OPTIONS
+ -O3
+)
+
+add_entrypoint_object(
+ fsubf128
+ SRCS
+ fsubf128.cpp
+ HDRS
+ ../fsubf128.h
+ DEPENDS
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.generic.add_sub
+ COMPILE_OPTIONS
+ -O3
+)
+
add_entrypoint_object(
sqrt
SRCS
@@ -2983,6 +3020,19 @@ add_entrypoint_object(
-O3
)
+add_entrypoint_object(
+ remainderf128
+ SRCS
+ remainderf128.cpp
+ HDRS
+ ../remainderf128.h
+ DEPENDS
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.division_and_remainder_operations
+ COMPILE_OPTIONS
+ -O3
+)
+
add_entrypoint_object(
hypotf
SRCS
diff --git a/libc/src/math/generic/fsub.cpp b/libc/src/math/generic/fsub.cpp
new file mode 100644
index 0000000000000..97e28015c0487
--- /dev/null
+++ b/libc/src/math/generic/fsub.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fsub 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/fsub.h"
+#include "src/__support/FPUtil/generic/add_sub.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, fsub, (double x, double y)) {
+ return fputil::generic::sub<float>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fsubf128.cpp b/libc/src/math/generic/fsubf128.cpp
new file mode 100644
index 0000000000000..3efb34992b748
--- /dev/null
+++ b/libc/src/math/generic/fsubf128.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fsubf128 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/fsubf128.h"
+#include "src/__support/FPUtil/generic/add_sub.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, fsubf128, (float128 x, float128 y)) {
+ return fputil::generic::sub<float>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/fsubl.cpp b/libc/src/math/generic/fsubl.cpp
new file mode 100644
index 0000000000000..cad5a2d5d452a
--- /dev/null
+++ b/libc/src/math/generic/fsubl.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fsubl 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/fsubl.h"
+#include "src/__support/FPUtil/generic/add_sub.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, fsubl, (long double x, long double y)) {
+ return fputil::generic::sub<float>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/remainderf128.cpp b/libc/src/math/generic/remainderf128.cpp
new file mode 100644
index 0000000000000..52b6c5149fdcf
--- /dev/null
+++ b/libc/src/math/generic/remainderf128.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of remainderf128 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/remainderf128.h"
+#include "src/__support/FPUtil/DivisionAndRemainderOperations.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float128, remainderf128, (float128 x, float128 y)) {
+ int quotient;
+ return fputil::remquo(x, y, quotient);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/remainderf128.h b/libc/src/math/remainderf128.h
new file mode 100644
index 0000000000000..57f770a853d68
--- /dev/null
+++ b/libc/src/math/remainderf128.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for remainderf128 -----------------*- 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_REMAINDERF128_H
+#define LLVM_LIBC_SRC_MATH_REMAINDERF128_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+float128 remainderf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_REMAINDERF128_H
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index cc5955903b20d..644b74a0ac0a9 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -2294,6 +2294,45 @@ add_fp_unittest(
libc.src.math.fsqrtl
)
+add_fp_unittest(
+ fsub_test
+ NEED_MPFR
+ SUITE
+ libc-math-unittests
+ SRCS
+ fsub_test.cpp
+ HDRS
+ SubTest.h
+ DEPENDS
+ libc.src.math.fsub
+)
+
+add_fp_unittest(
+ fsubl_test
+ NEED_MPFR
+ SUITE
+ libc-math-unittests
+ SRCS
+ fsubl_test.cpp
+ HDRS
+ SubTest.h
+ DEPENDS
+ libc.src.math.fsubl
+)
+
+add_fp_unittest(
+ fsubf128_test
+ NEED_MPFR
+ SUITE
+ libc-math-unittests
+ SRCS
+ fsubf128_test.cpp
+ HDRS
+ SubTest.h
+ DEPENDS
+ libc.src.math.fsubf128
+)
+
add_fp_unittest(
dsqrtl_test
NEED_MPFR
diff --git a/libc/test/src/math/fsub_test.cpp b/libc/test/src/math/fsub_test.cpp
new file mode 100644
index 0000000000000..3c825f7f28af4
--- /dev/null
+++ b/libc/test/src/math/fsub_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fsub ------------------------------------------------===//
+//
+// 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/fsub.h"
+
+LIST_SUB_TESTS(float, double, LIBC_NAMESPACE::fsub)
diff --git a/libc/test/src/math/fsubf128_test.cpp b/libc/test/src/math/fsubf128_test.cpp
new file mode 100644
index 0000000000000..8f46d91116bde
--- /dev/null
+++ b/libc/test/src/math/fsubf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fsubf128 --------------------------------------------===//
+//
+// 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/fsubf128.h"
+
+LIST_SUB_TESTS(float, float128, LIBC_NAMESPACE::fsubf128)
diff --git a/libc/test/src/math/fsubl_test.cpp b/libc/test/src/math/fsubl_test.cpp
new file mode 100644
index 0000000000000..8723432603b00
--- /dev/null
+++ b/libc/test/src/math/fsubl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fsubl -----------------------------------------------===//
+//
+// 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/fsubl.h"
+
+LIST_SUB_TESTS(float, long double, LIBC_NAMESPACE::fsubl)
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index faca71b8b5bc4..622dc1ee50d86 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -4227,6 +4227,42 @@ add_fp_unittest(
libc.src.math.fsqrtf128
)
+add_fp_unittest(
+ fsub_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ fsub_test.cpp
+ HDRS
+ SubTest.h
+ DEPENDS
+ libc.src.math.fsub
+)
+
+add_fp_unittest(
+ fsubl_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ fsubl_test.cpp
+ HDRS
+ SubTest.h
+ DEPENDS
+ libc.src.math.fsubl
+)
+
+add_fp_unittest(
+ fsubf128_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ fsubf128_test.cpp
+ HDRS
+ SubTest.h
+ DEPENDS
+ libc.src.math.fsubf128
+)
+
add_fp_unittest(
dsqrtl_test
SUITE
diff --git a/libc/test/src/math/smoke/fsub_test.cpp b/libc/test/src/math/smoke/fsub_test.cpp
new file mode 100644
index 0000000000000..3c825f7f28af4
--- /dev/null
+++ b/libc/test/src/math/smoke/fsub_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fsub ------------------------------------------------===//
+//
+// 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/fsub.h"
+
+LIST_SUB_TESTS(float, double, LIBC_NAMESPACE::fsub)
diff --git a/libc/test/src/math/smoke/fsubf128_test.cpp b/libc/test/src/math/smoke/fsubf128_test.cpp
new file mode 100644
index 0000000000000..8f46d91116bde
--- /dev/null
+++ b/libc/test/src/math/smoke/fsubf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fsubf128 --------------------------------------------===//
+//
+// 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/fsubf128.h"
+
+LIST_SUB_TESTS(float, float128, LIBC_NAMESPACE::fsubf128)
diff --git a/libc/test/src/math/smo...
[truncated]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is seems like there should be a test for remainderf128 as well
@michaelrj-google None of the remainder functions seem to have tests yet. @overmighty |
Right. According to the GitHub Gist history for my to-do list, I had actually caught that on June 8, but I don't remember if I ever talked about it with Tue. |
- added <long double> to <float>
@overmighty was able to get the MPFR tests, will look into ddivl and the rounding issues there. Let me know if this looks good. |
@aaryanshukla @michaelrj-google should I leave remainder tests out then if we do not have any? |
You should probably avoid putting to-do notes in the PR description so that they don't end up in the merge/squash commit message, as in 8f33f1d. |
I forgot that |
libc/utils/MPFRWrapper/MPFRUtils.cpp
Outdated
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<double> &, float, double, RoundingMode); | ||
template void explain_ternary_operation_one_output_error( | ||
Operation, const TernaryInput<long double> &, float, double, RoundingMode); | ||
|
||
template void explain_ternary_operation_one_output_error( | ||
Operation, const TernaryInput<long double> &, double, double, RoundingMode); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: sorting.
You can apply this with git apply path/to/patch.diff
.
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index 1695354565f5..ec81ea2a9d7d 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -1080,20 +1080,18 @@ void explain_ternary_operation_one_output_error(
template void explain_ternary_operation_one_output_error(
Operation, const TernaryInput<float> &, float, double, RoundingMode);
-template void explain_ternary_operation_one_output_error(
- Operation, const TernaryInput<double> &, double, double, RoundingMode);
-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<double> &, float, double, RoundingMode);
+template void explain_ternary_operation_one_output_error(
+ Operation, const TernaryInput<double> &, double, double, RoundingMode);
template void explain_ternary_operation_one_output_error(
Operation, const TernaryInput<long double> &, float, double, RoundingMode);
-
template void explain_ternary_operation_one_output_error(
Operation, const TernaryInput<long double> &, double, double, RoundingMode);
-
+template void
+explain_ternary_operation_one_output_error(Operation,
+ const TernaryInput<long double> &,
+ long double, double, RoundingMode);
#ifdef LIBC_TYPES_HAS_FLOAT16
template void explain_ternary_operation_one_output_error(
Operation, const TernaryInput<float> &, float16, double, RoundingMode);
@@ -1275,15 +1273,14 @@ template bool compare_ternary_operation_one_output(Operation,
const TernaryInput<double> &,
double, double,
RoundingMode);
+template bool compare_ternary_operation_one_output(
+ Operation, const TernaryInput<long double> &, float, double, RoundingMode);
+template bool compare_ternary_operation_one_output(
+ Operation, const TernaryInput<long double> &, double, double, RoundingMode);
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);
-template bool compare_ternary_operation_one_output(
- Operation, const TernaryInput<long double> &, float, double, RoundingMode);
#ifdef LIBC_TYPES_HAS_FLOAT16
template bool compare_ternary_operation_one_output(Operation,
const TernaryInput<float> &,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will first merge fdiv and then match the MPFRwrapper.
|
Co-authored-by: OverMighty <[email protected]>
Co-authored-by: OverMighty <[email protected]>
Co-authored-by: OverMighty <[email protected]>
Co-authored-by: OverMighty <[email protected]>
Co-authored-by: OverMighty <[email protected]>
Co-authored-by: OverMighty <[email protected]>
Co-authored-by: OverMighty <[email protected]>
Co-authored-by: OverMighty <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with whitespace nits.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/71/builds/3805 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/179/builds/3719 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/131/builds/3772 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/171/builds/3708 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/183/builds/2415 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/11/builds/2979 Here is the relevant piece of the build log for the reference:
|
No description provided.