[libc-commits] [libc] [llvm] [libc][math] Adds total ordering functions for float80 (PR #238685)
via libc-commits
libc-commits at lists.llvm.org
Wed Nov 4 01:57:27 PST 2026
https://github.com/Sukumarsawant updated https://github.com/llvm/llvm-project/pull/238685
>From d20cb2a360a5bee761b3db1b33db1377a8274a91 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Wed, 4 Nov 2026 10:10:29 +0530
Subject: [PATCH 1/3] adds totalorderf80 functions
---
libc/config/baremetal/aarch64/entrypoints.txt | 2 +
libc/config/baremetal/arm/entrypoints.txt | 2 +
libc/config/baremetal/hexagon/entrypoints.txt | 2 +
libc/config/baremetal/riscv/entrypoints.txt | 2 +
libc/config/darwin/aarch64/entrypoints.txt | 2 +
libc/config/darwin/x86_64/entrypoints.txt | 2 +
libc/config/freebsd/x86_64/entrypoints.txt | 2 +
libc/config/gpu/amdgpu/entrypoints.txt | 2 +
libc/config/gpu/nvptx/entrypoints.txt | 2 +
libc/config/linux/aarch64/entrypoints.txt | 2 +
libc/config/linux/arm/entrypoints.txt | 2 +
libc/config/linux/riscv/entrypoints.txt | 2 +
libc/config/linux/x86_64/entrypoints.txt | 2 +
libc/config/windows/entrypoints.txt | 2 +
libc/docs/headers/math/index.md | 4 +-
libc/shared/math.h | 2 +
libc/shared/math/totalorderf80.h | 28 ++++++++++++++
libc/shared/math/totalordermagf80.h | 28 ++++++++++++++
libc/src/__support/math/CMakeLists.txt | 20 ++++++++++
libc/src/__support/math/totalorderf80.h | 33 ++++++++++++++++
libc/src/__support/math/totalordermagf80.h | 34 +++++++++++++++++
libc/src/math/CMakeLists.txt | 2 +
libc/src/math/generic/CMakeLists.txt | 22 +++++++++++
libc/src/math/generic/totalorderf80.cpp | 29 ++++++++++++++
libc/src/math/generic/totalordermagf80.cpp | 29 ++++++++++++++
libc/src/math/totalorderf80.h | 27 +++++++++++++
libc/src/math/totalordermagf80.h | 27 +++++++++++++
libc/test/shared/CMakeLists.txt | 4 ++
.../shared/shared_math_constexpr_test.cpp | 9 +++++
libc/test/shared/shared_math_test.cpp | 8 ++++
libc/test/src/math/smoke/CMakeLists.txt | 26 +++++++++++++
.../src/math/smoke/totalorderf80_test.cpp | 21 ++++++++++
.../src/math/smoke/totalordermagf80_test.cpp | 22 +++++++++++
.../llvm-project-overlay/libc/BUILD.bazel | 38 +++++++++++++++++++
.../libc/test/src/math/smoke/BUILD.bazel | 16 ++++++++
35 files changed, 455 insertions(+), 2 deletions(-)
create mode 100644 libc/shared/math/totalorderf80.h
create mode 100644 libc/shared/math/totalordermagf80.h
create mode 100644 libc/src/__support/math/totalorderf80.h
create mode 100644 libc/src/__support/math/totalordermagf80.h
create mode 100644 libc/src/math/generic/totalorderf80.cpp
create mode 100644 libc/src/math/generic/totalordermagf80.cpp
create mode 100644 libc/src/math/totalorderf80.h
create mode 100644 libc/src/math/totalordermagf80.h
create mode 100644 libc/test/src/math/smoke/totalorderf80_test.cpp
create mode 100644 libc/test/src/math/smoke/totalordermagf80_test.cpp
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index 57478a3ef9a228..11ad7feaaabc86 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -635,10 +635,12 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.totalorder
libc.src.math.totalorderf
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalorderl
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 104c1b8ef3912d..b083112410fe64 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -647,10 +647,12 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.totalorder
libc.src.math.totalorderf
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalorderl
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
diff --git a/libc/config/baremetal/hexagon/entrypoints.txt b/libc/config/baremetal/hexagon/entrypoints.txt
index a7617ec243e278..c4876402a580a8 100644
--- a/libc/config/baremetal/hexagon/entrypoints.txt
+++ b/libc/config/baremetal/hexagon/entrypoints.txt
@@ -815,7 +815,9 @@ if(LIBC_TYPES_HAS_FLOAT128)
libc.src.math.setpayloadsigf128
libc.src.math.sqrtf128
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.truncf128
libc.src.math.ufromfpf128
libc.src.math.ufromfpxf128
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 32f57aee84807d..150b878f274306 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -638,10 +638,12 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.totalorder
libc.src.math.totalorderf
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalorderl
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index 2b8e0a0f62d035..791aa7a19c3866 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -457,10 +457,12 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.totalorder
libc.src.math.totalorderf
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalorderl
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index d2855fe5e18071..62479a8693e542 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -360,7 +360,9 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.totalorderbf16
libc.src.math.totalordermagbf16
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.ufromfpbf16
libc.src.math.ufromfpxbf16
)
diff --git a/libc/config/freebsd/x86_64/entrypoints.txt b/libc/config/freebsd/x86_64/entrypoints.txt
index 8b998d0b75cc61..a01c3bd6b91358 100644
--- a/libc/config/freebsd/x86_64/entrypoints.txt
+++ b/libc/config/freebsd/x86_64/entrypoints.txt
@@ -408,10 +408,12 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.totalorder
libc.src.math.totalorderf
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalorderl
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.totalordermagl
libc.src.math.ufromfp
libc.src.math.ufromfpf
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index 585af5623bc713..026436dfab9664 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -576,10 +576,12 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.totalorder
libc.src.math.totalorderf
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalorderl
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index 1b13cd31d05901..b98fb8a7e902fb 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -573,10 +573,12 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.totalorder
libc.src.math.totalorderf
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalorderl
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 4b04f8995be49f..f504f087515d42 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -879,10 +879,12 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.totalorder
libc.src.math.totalorderf
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalorderl
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 984cff2570158d..15817143565629 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -655,10 +655,12 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.totalorder
libc.src.math.totalorderf
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalorderl
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index f15e8e6d4f80d4..9d354ab9a0ff11 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -942,10 +942,12 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.totalorder
libc.src.math.totalorderf
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalorderl
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index f31143b6965a6a..091580ee6ff9f3 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -964,10 +964,12 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.totalorder
libc.src.math.totalorderf
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalorderl
libc.src.math.totalordermag
libc.src.math.totalordermagf
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.totalordermagl
libc.src.math.trunc
libc.src.math.truncf
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index 550a3b461467fe..2805795f0b85f9 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -372,7 +372,9 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.tanhf
libc.src.math.tanpif
libc.src.math.totalorderf128
+ libc.src.math.totalorderf80
libc.src.math.totalordermagf128
+ libc.src.math.totalordermagf80
libc.src.math.trunc
libc.src.math.truncf
libc.src.math.truncf128
diff --git a/libc/docs/headers/math/index.md b/libc/docs/headers/math/index.md
index d138caa5eb34aa..8df3cd80e34998 100644
--- a/libc/docs/headers/math/index.md
+++ b/libc/docs/headers/math/index.md
@@ -156,8 +156,8 @@ log
| scalbn | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.6.19 | F.10.3.19 |
| setpayload | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | F.10.13.2 | N/A |
| setpayloadsig | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | F.10.13.3 | N/A |
-| totalorder | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | F.10.12.1 | N/A |
-| totalordermag | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | F.10.12.2 | N/A |
+| totalorder | {{ check }} | {{ check }} | {{ check }} | | {{ check }} | {{ check }} | {{ check }} | F.10.12.1 | N/A |
+| totalordermag | {{ check }} | {{ check }} | {{ check }} | | {{ check }} | {{ check }} | {{ check }} | F.10.12.2 | N/A |
| trunc | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.9.9 | F.10.6.9 |
| ufromfp | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.9.10 | F.10.6.10 |
| ufromfpx | {{ check }} | {{ check }} | | | {{ check }} | {{ check }} | {{ check }} | 7.12.9.11 | F.10.6.11 |
diff --git a/libc/shared/math.h b/libc/shared/math.h
index bf490aa4738b41..c7a99047d61619 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -505,12 +505,14 @@
#include "math/totalorderbf16.h"
#include "math/totalorderf.h"
#include "math/totalorderf128.h"
+#include "math/totalorderf80.h"
#include "math/totalorderf16.h"
#include "math/totalorderl.h"
#include "math/totalordermag.h"
#include "math/totalordermagbf16.h"
#include "math/totalordermagf.h"
#include "math/totalordermagf128.h"
+#include "math/totalordermagf80.h"
#include "math/totalordermagf16.h"
#include "math/totalordermagl.h"
#include "math/trunc.h"
diff --git a/libc/shared/math/totalorderf80.h b/libc/shared/math/totalorderf80.h
new file mode 100644
index 00000000000000..a4cb2f5b2e347f
--- /dev/null
+++ b/libc/shared/math/totalorderf80.h
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Shared totalorderf80 function.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_TOTALORDERF80_H
+#define LLVM_LIBC_SHARED_MATH_TOTALORDERF80_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/totalorderf80.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::totalorderf80;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_TOTALORDERF80_H
diff --git a/libc/shared/math/totalordermagf80.h b/libc/shared/math/totalordermagf80.h
new file mode 100644
index 00000000000000..8191980af32fb5
--- /dev/null
+++ b/libc/shared/math/totalordermagf80.h
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Shared totalordermagf80 function.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_TOTALORDERMAGF80_H
+#define LLVM_LIBC_SHARED_MATH_TOTALORDERMAGF80_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/totalordermagf80.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::totalordermagf80;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_TOTALORDERMAGF80_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index ba3edda2843149..d14a52716643a8 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -6323,6 +6323,16 @@ add_header_library(
libc.src.__support.macros.config
)
+add_header_library(
+ totalorderf80
+ HDRS
+ totalorderf80.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.FPUtil.float80
+ libc.src.__support.macros.config
+)
+
add_header_library(
totalorderf16
HDRS
@@ -6380,6 +6390,16 @@ add_header_library(
libc.src.__support.macros.config
)
+add_header_library(
+ totalordermagf80
+ HDRS
+ totalordermagf80.h
+ DEPENDS
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.FPUtil.float80
+ libc.src.__support.macros.config
+)
+
add_header_library(
totalordermagf16
HDRS
diff --git a/libc/src/__support/math/totalorderf80.h b/libc/src/__support/math/totalorderf80.h
new file mode 100644
index 00000000000000..07315623df03d8
--- /dev/null
+++ b/libc/src/__support/math/totalorderf80.h
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Implementation of the totalorderf80 function.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_TOTALORDERF80_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_TOTALORDERF80_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/float80.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+using LIBC_NAMESPACE::fputil::Float80;
+
+LIBC_INLINE constexpr int totalorderf80(const Float80 *x, const Float80 *y) {
+ return static_cast<int>(fputil::totalorder(*x, *y));
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_TOTALORDERF80_H
diff --git a/libc/src/__support/math/totalordermagf80.h b/libc/src/__support/math/totalordermagf80.h
new file mode 100644
index 00000000000000..29003d69e6f4ff
--- /dev/null
+++ b/libc/src/__support/math/totalordermagf80.h
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Implementation of the totalordermagf80 function.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_TOTALORDERMAGF80_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_TOTALORDERMAGF80_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/float80.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+using LIBC_NAMESPACE::fputil::Float80;
+
+LIBC_INLINE constexpr int totalordermagf80(const Float80 *x,
+ const Float80 *y) {
+ return static_cast<int>(fputil::totalordermag(*x, *y));
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_TOTALORDERMAGF80_H
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index 08728a02809359..b5aa8dc5f8d142 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -626,6 +626,7 @@ add_math_entrypoint_object(totalorderf)
add_math_entrypoint_object(totalorderl)
add_math_entrypoint_object(totalorderf16)
add_math_entrypoint_object(totalorderf128)
+add_math_entrypoint_object(totalorderf80)
add_math_entrypoint_object(totalorderbf16)
add_math_entrypoint_object(totalordermag)
@@ -633,6 +634,7 @@ add_math_entrypoint_object(totalordermagf)
add_math_entrypoint_object(totalordermagl)
add_math_entrypoint_object(totalordermagf16)
add_math_entrypoint_object(totalordermagf128)
+add_math_entrypoint_object(totalordermagf80)
add_math_entrypoint_object(totalordermagbf16)
add_math_entrypoint_object(trunc)
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index b7444dd916d006..e7511ba7fbe820 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -4450,6 +4450,17 @@ add_entrypoint_object(
libc.src.__support.math.totalorderf128
)
+add_entrypoint_object(
+ totalorderf80
+ SRCS
+ totalorderf80.cpp
+ HDRS
+ ../totalorderf80.h
+ DEPENDS
+ libc.src.__support.CPP.bit
+ libc.src.__support.math.totalorderf80
+)
+
add_entrypoint_object(
totalorderbf16
SRCS
@@ -4511,6 +4522,17 @@ add_entrypoint_object(
libc.src.__support.math.totalordermagf128
)
+add_entrypoint_object(
+ totalordermagf80
+ SRCS
+ totalordermagf80.cpp
+ HDRS
+ ../totalordermagf80.h
+ DEPENDS
+ libc.src.__support.CPP.bit
+ libc.src.__support.math.totalordermagf80
+)
+
add_entrypoint_object(
totalordermagbf16
SRCS
diff --git a/libc/src/math/generic/totalorderf80.cpp b/libc/src/math/generic/totalorderf80.cpp
new file mode 100644
index 00000000000000..f39adb1a43a33f
--- /dev/null
+++ b/libc/src/math/generic/totalorderf80.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Implementation of the totalorderf80 function.
+///
+//===----------------------------------------------------------------------===//
+
+#include "src/math/totalorderf80.h"
+#include "src/__support/CPP/bit.h"
+#include "src/__support/math/totalorderf80.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+using LIBC_NAMESPACE::fputil::Float80;
+
+LLVM_LIBC_FUNCTION(int, totalorderf80,
+ (const float80 *x, const float80 *y)) {
+ Float80 x_f80 = cpp::bit_cast<Float80>(*x);
+ Float80 y_f80 = cpp::bit_cast<Float80>(*y);
+ return math::totalorderf80(&x_f80, &y_f80);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/totalordermagf80.cpp b/libc/src/math/generic/totalordermagf80.cpp
new file mode 100644
index 00000000000000..c29b9fdf2d6adc
--- /dev/null
+++ b/libc/src/math/generic/totalordermagf80.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Implementation of the totalordermagf80 function.
+///
+//===----------------------------------------------------------------------===//
+
+#include "src/math/totalordermagf80.h"
+#include "src/__support/CPP/bit.h"
+#include "src/__support/math/totalordermagf80.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+using LIBC_NAMESPACE::fputil::Float80;
+
+LLVM_LIBC_FUNCTION(int, totalordermagf80,
+ (const float80 *x, const float80 *y)) {
+ Float80 x_f80 = cpp::bit_cast<Float80>(*x);
+ Float80 y_f80 = cpp::bit_cast<Float80>(*y);
+ return math::totalordermagf80(&x_f80, &y_f80);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/totalorderf80.h b/libc/src/math/totalorderf80.h
new file mode 100644
index 00000000000000..69a5d265fdba02
--- /dev/null
+++ b/libc/src/math/totalorderf80.h
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Public declaration of the totalorderf80 entrypoint.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_MATH_TOTALORDERF80_H
+#define LLVM_LIBC_SRC_MATH_TOTALORDERF80_H
+
+#include "src/__support/FPUtil/float80.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+int totalorderf80(const float80 *x, const float80 *y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_TOTALORDERF80_H
diff --git a/libc/src/math/totalordermagf80.h b/libc/src/math/totalordermagf80.h
new file mode 100644
index 00000000000000..5b44d794c3c951
--- /dev/null
+++ b/libc/src/math/totalordermagf80.h
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Public declaration of the totalordermagf80 entrypoint.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_MATH_TOTALORDERMAGF80_H
+#define LLVM_LIBC_SRC_MATH_TOTALORDERMAGF80_H
+
+#include "src/__support/FPUtil/float80.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+int totalordermagf80(const float80 *x, const float80 *y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_TOTALORDERMAGF80_H
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index 554f8d2bdcfac2..8a0e371efa7b82 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -535,12 +535,14 @@ else()
libc.src.__support.math.totalorderbf16
libc.src.__support.math.totalorderf
libc.src.__support.math.totalorderf128
+ libc.src.__support.math.totalorderf80
libc.src.__support.math.totalorderf16
libc.src.__support.math.totalorderl
libc.src.__support.math.totalordermag
libc.src.__support.math.totalordermagbf16
libc.src.__support.math.totalordermagf
libc.src.__support.math.totalordermagf128
+ libc.src.__support.math.totalordermagf80
libc.src.__support.math.totalordermagf16
libc.src.__support.math.totalordermagl
)
@@ -858,12 +860,14 @@ else()
libc.src.__support.math.totalorderbf16
libc.src.__support.math.totalorderf
libc.src.__support.math.totalorderf128
+ libc.src.__support.math.totalorderf80
libc.src.__support.math.totalorderf16
libc.src.__support.math.totalorderl
libc.src.__support.math.totalordermag
libc.src.__support.math.totalordermagbf16
libc.src.__support.math.totalordermagf
libc.src.__support.math.totalordermagf128
+ libc.src.__support.math.totalordermagf80
libc.src.__support.math.totalordermagf16
libc.src.__support.math.totalordermagl
)
diff --git a/libc/test/shared/shared_math_constexpr_test.cpp b/libc/test/shared/shared_math_constexpr_test.cpp
index 9c43100afda879..6d5f06531d156a 100644
--- a/libc/test/shared/shared_math_constexpr_test.cpp
+++ b/libc/test/shared/shared_math_constexpr_test.cpp
@@ -444,6 +444,15 @@ static_assert(Float80(0.0) ==
Float80(0.0)));
static_assert(Float80(1.0) ==
LIBC_NAMESPACE::shared::fdimf80(Float80(1.0), Float80(0.0)));
+constexpr Float80 TOTALORDERF80_X = Float80(0.0);
+constexpr Float80 TOTALORDERF80_Y = Float80(0.0);
+static_assert(1 == LIBC_NAMESPACE::shared::totalorderf80(&TOTALORDERF80_X,
+ &TOTALORDERF80_Y));
+constexpr Float80 TOTALORDERMAGF80_X = Float80(0.0);
+constexpr Float80 TOTALORDERMAGF80_Y = Float80(0.0);
+static_assert(1 ==
+ LIBC_NAMESPACE::shared::totalordermagf80(&TOTALORDERMAGF80_X,
+ &TOTALORDERMAGF80_Y));
static_assert(Float128(1.0) ==
LIBC_NAMESPACE::shared::fdimf128(Float128(1.0), Float128(0.0)));
static_assert(Float128(0.0) ==
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index e03cde286ef7e9..524513f66eb06f 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -706,6 +706,14 @@ TEST(LlvmLibcSharedMathTest, AllFloat80) {
Float80(0.0), Float80(0.0)));
EXPECT_FP_EQ(Float80(0.0),
LIBC_NAMESPACE::shared::fdimf80(Float80(0.0), Float80(0.0)));
+ Float80 totalorderf80_x = Float80(0.0);
+ Float80 totalorderf80_y = Float80(0.0);
+ EXPECT_EQ(1, LIBC_NAMESPACE::shared::totalorderf80(&totalorderf80_x,
+ &totalorderf80_y));
+ Float80 totalordermagf80_x = Float80(0.0);
+ Float80 totalordermagf80_y = Float80(0.0);
+ EXPECT_EQ(1, LIBC_NAMESPACE::shared::totalordermagf80(&totalordermagf80_x,
+ &totalordermagf80_y));
}
#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index b3315c10db0d01..b1cebbf92b7cab 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -5666,6 +5666,19 @@ add_fp_unittest(
libc.src.__support.FPUtil.float128
)
+add_fp_unittest(
+ totalorderf80_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ totalorderf80_test.cpp
+ HDRS
+ TotalOrderTest.h
+ DEPENDS
+ libc.src.math.totalorderf80
+ libc.src.__support.FPUtil.float80
+)
+
add_fp_unittest(
totalorderbf16_test
SUITE
@@ -5740,6 +5753,19 @@ add_fp_unittest(
libc.src.__support.FPUtil.float128
)
+add_fp_unittest(
+ totalordermagf80_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ totalordermagf80_test.cpp
+ HDRS
+ TotalOrderMagTest.h
+ DEPENDS
+ libc.src.math.totalordermagf80
+ libc.src.__support.FPUtil.float80
+)
+
add_fp_unittest(
totalordermagbf16_test
SUITE
diff --git a/libc/test/src/math/smoke/totalorderf80_test.cpp b/libc/test/src/math/smoke/totalorderf80_test.cpp
new file mode 100644
index 00000000000000..f20c7ccfebd11e
--- /dev/null
+++ b/libc/test/src/math/smoke/totalorderf80_test.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Smoke tests for totalorderf80.
+///
+//===----------------------------------------------------------------------===//
+
+#include "TotalOrderTest.h"
+
+#include "src/__support/FPUtil/float80.h"
+#include "src/math/totalorderf80.h"
+
+using LIBC_NAMESPACE::fputil::Float80;
+
+LIST_TOTALORDER_TESTS(Totalorderf80, Float80, LIBC_NAMESPACE::totalorderf80)
diff --git a/libc/test/src/math/smoke/totalordermagf80_test.cpp b/libc/test/src/math/smoke/totalordermagf80_test.cpp
new file mode 100644
index 00000000000000..6db81a91687e59
--- /dev/null
+++ b/libc/test/src/math/smoke/totalordermagf80_test.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Smoke tests for totalordermagf80.
+///
+//===----------------------------------------------------------------------===//
+
+#include "TotalOrderMagTest.h"
+
+#include "src/__support/FPUtil/float80.h"
+#include "src/math/totalordermagf80.h"
+
+using LIBC_NAMESPACE::fputil::Float80;
+
+LIST_TOTALORDERMAG_TESTS(Totalordermagf80, Float80,
+ LIBC_NAMESPACE::totalordermagf80)
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index c59f23190dbcca..473f6ca5ee966e 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -12379,6 +12379,16 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_totalorderf80",
+ hdrs = ["src/__support/math/totalorderf80.h"],
+ deps = [
+ ":__support_fputil_basic_operations",
+ ":__support_fputil_float80",
+ ":__support_macros_config",
+ ],
+)
+
libc_support_library(
name = "__support_math_totalorderf16",
hdrs = ["src/__support/math/totalorderf16.h"],
@@ -12436,6 +12446,16 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_totalordermagf80",
+ hdrs = ["src/__support/math/totalordermagf80.h"],
+ deps = [
+ ":__support_fputil_basic_operations",
+ ":__support_fputil_float80",
+ ":__support_macros_config",
+ ],
+)
+
libc_support_library(
name = "__support_math_totalordermagf16",
hdrs = ["src/__support/math/totalordermagf16.h"],
@@ -16424,6 +16444,15 @@ libc_math_function(
],
)
+libc_math_function(
+ name = "totalorderf80",
+ additional_deps = [
+ ":__support_cpp_bit",
+ ":__support_fputil_float80",
+ ":__support_math_totalorderf80",
+ ],
+)
+
libc_math_function(
name = "totalorderf16",
additional_deps = [
@@ -16468,6 +16497,15 @@ libc_math_function(
],
)
+libc_math_function(
+ name = "totalordermagf80",
+ additional_deps = [
+ ":__support_cpp_bit",
+ ":__support_fputil_float80",
+ ":__support_math_totalordermagf80",
+ ],
+)
+
libc_math_function(
name = "totalordermagf16",
additional_deps = [
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel
index f4e28658fb3f8f..c9bb3bf8f9a420 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel
@@ -2411,6 +2411,14 @@ math_test(
],
)
+math_test(
+ name = "totalorderf80",
+ hdrs = ["TotalOrderTest.h"],
+ deps = [
+ "//libc:__support_fputil_float80",
+ ],
+)
+
math_test(
name = "totalorderf16",
hdrs = ["TotalOrderTest.h"],
@@ -2447,6 +2455,14 @@ math_test(
],
)
+math_test(
+ name = "totalordermagf80",
+ hdrs = ["TotalOrderMagTest.h"],
+ deps = [
+ "//libc:__support_fputil_float80",
+ ],
+)
+
math_test(
name = "totalordermagf16",
hdrs = ["TotalOrderMagTest.h"],
>From ac0449334886a1de27f26d1ba7c0d9a58dfcb482 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Wed, 4 Nov 2026 12:00:44 +0530
Subject: [PATCH 2/3] clang-format
---
libc/shared/math.h | 4 ++--
libc/src/__support/math/totalordermagf80.h | 3 +--
libc/src/math/generic/totalorderf80.cpp | 3 +--
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/libc/shared/math.h b/libc/shared/math.h
index c7a99047d61619..5c9dffcb513c29 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -505,15 +505,15 @@
#include "math/totalorderbf16.h"
#include "math/totalorderf.h"
#include "math/totalorderf128.h"
-#include "math/totalorderf80.h"
#include "math/totalorderf16.h"
+#include "math/totalorderf80.h"
#include "math/totalorderl.h"
#include "math/totalordermag.h"
#include "math/totalordermagbf16.h"
#include "math/totalordermagf.h"
#include "math/totalordermagf128.h"
-#include "math/totalordermagf80.h"
#include "math/totalordermagf16.h"
+#include "math/totalordermagf80.h"
#include "math/totalordermagl.h"
#include "math/trunc.h"
#include "math/truncbf16.h"
diff --git a/libc/src/__support/math/totalordermagf80.h b/libc/src/__support/math/totalordermagf80.h
index 29003d69e6f4ff..e9388d8102ea66 100644
--- a/libc/src/__support/math/totalordermagf80.h
+++ b/libc/src/__support/math/totalordermagf80.h
@@ -23,8 +23,7 @@ namespace math {
using LIBC_NAMESPACE::fputil::Float80;
-LIBC_INLINE constexpr int totalordermagf80(const Float80 *x,
- const Float80 *y) {
+LIBC_INLINE constexpr int totalordermagf80(const Float80 *x, const Float80 *y) {
return static_cast<int>(fputil::totalordermag(*x, *y));
}
diff --git a/libc/src/math/generic/totalorderf80.cpp b/libc/src/math/generic/totalorderf80.cpp
index f39adb1a43a33f..ccc56777b57797 100644
--- a/libc/src/math/generic/totalorderf80.cpp
+++ b/libc/src/math/generic/totalorderf80.cpp
@@ -19,8 +19,7 @@ namespace LIBC_NAMESPACE_DECL {
using LIBC_NAMESPACE::fputil::Float80;
-LLVM_LIBC_FUNCTION(int, totalorderf80,
- (const float80 *x, const float80 *y)) {
+LLVM_LIBC_FUNCTION(int, totalorderf80, (const float80 *x, const float80 *y)) {
Float80 x_f80 = cpp::bit_cast<Float80>(*x);
Float80 y_f80 = cpp::bit_cast<Float80>(*y);
return math::totalorderf80(&x_f80, &y_f80);
>From 5c5eba52ace7db3381743e873ea361dc16a84560 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Wed, 4 Nov 2026 12:02:43 +0530
Subject: [PATCH 3/3] clang-format
More information about the libc-commits
mailing list