[llvm-branch-commits] [compiler-rt] [libc] [compiler-rt][builtins] libc-backed single-float comparison builtins (PR #212651)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Aug 8 15:03:32 PDT 2026


https://github.com/hulxv updated https://github.com/llvm/llvm-project/pull/212651

>From c2f0ff9007ab6764b1a56c947921c64b0500cb36 Mon Sep 17 00:00:00 2001
From: hulxv <hulxxv at gmail.com>
Date: Wed, 29 Jul 2026 00:28:43 +0300
Subject: [PATCH 1/4] [libc][builtins] add cmp_helper for compiler-rt
 soft-float comparisons

---
 libc/src/__support/builtins/CMakeLists.txt |  7 +++
 libc/src/__support/builtins/cmp_helper.h   | 63 ++++++++++++++++++++++
 2 files changed, 70 insertions(+)
 create mode 100644 libc/src/__support/builtins/cmp_helper.h

diff --git a/libc/src/__support/builtins/CMakeLists.txt b/libc/src/__support/builtins/CMakeLists.txt
index a3e6303f09169..aa3afaf190304 100644
--- a/libc/src/__support/builtins/CMakeLists.txt
+++ b/libc/src/__support/builtins/CMakeLists.txt
@@ -232,6 +232,13 @@ add_header_library(
     truncdfsf2.h
   DEPENDS
     libc.src.__support.builtins.fpconvert_helper
+  cmp_helper
+  HDRS
+    cmp_helper.h
+  DEPENDS
+    libc.src.__support.FPUtil.comparison_operations
+    libc.src.__support.FPUtil.fp_bits
+    libc.src.__support.macros.attributes
     libc.src.__support.macros.config
 )
 
diff --git a/libc/src/__support/builtins/cmp_helper.h b/libc/src/__support/builtins/cmp_helper.h
new file mode 100644
index 0000000000000..6616783cfc3e4
--- /dev/null
+++ b/libc/src/__support/builtins/cmp_helper.h
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 floating-point comparison results for compiler-rt's soft-float
+/// compare builtins.  These mirror compiler-rt's GCC-compatible __le<f>2 /
+/// __ge<f>2 / __unord<f>2 (quiet: they raise no FP exceptions), reusing
+/// LLVM-libc's IEEE comparison predicates, so they can be reused by
+/// compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_CMP_HELPER_H
+#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_CMP_HELPER_H
+
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/FPUtil/comparison_operations.h"
+#include "src/__support/macros/attributes.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace builtins {
+
+// GCC soft-float compare, "LE" convention: -1 if a<b, 0 if a==b, 1 if a>b, and
+// 1 when unordered (either operand is NaN).  Quiet -- raises no FP exceptions,
+// matching compiler-rt's __le<f>2 (which __eq/__ne/__lt/__cmp alias).  NaN is
+// handled up front so the ordering predicates are only reached for non-NaN
+// inputs, where they never signal.
+template <typename T> LIBC_INLINE int cmp_le(T a, T b) {
+  using FPBits = fputil::FPBits<T>;
+  if (FPBits(a).is_nan() || FPBits(b).is_nan())
+    return 1; // LE_UNORDERED
+  if (fputil::equals(a, b))
+    return 0; // LE_EQUAL
+  return fputil::less_than(a, b) ? -1 : 1; // LE_LESS : LE_GREATER
+}
+
+// Same as cmp_le, but unordered yields -1; matches compiler-rt's __ge<f>2
+// (which __gt aliases).
+template <typename T> LIBC_INLINE int cmp_ge(T a, T b) {
+  using FPBits = fputil::FPBits<T>;
+  if (FPBits(a).is_nan() || FPBits(b).is_nan())
+    return -1; // GE_UNORDERED
+  if (fputil::equals(a, b))
+    return 0; // GE_EQUAL
+  return fputil::greater_than(a, b) ? 1 : -1; // GE_GREATER : GE_LESS
+}
+
+// 1 iff either operand is NaN, else 0; matches compiler-rt's __unord<f>2.
+template <typename T> LIBC_INLINE int cmp_unord(T a, T b) {
+  using FPBits = fputil::FPBits<T>;
+  return FPBits(a).is_nan() || FPBits(b).is_nan();
+}
+
+} // namespace builtins
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_CMP_HELPER_H

>From 4dcea704e9b971130a3c45455edcb95bd744fcdc Mon Sep 17 00:00:00 2001
From: hulxv <hulxxv at gmail.com>
Date: Wed, 29 Jul 2026 02:14:36 +0300
Subject: [PATCH 2/4] fix format

---
 libc/src/__support/builtins/cmp_helper.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/src/__support/builtins/cmp_helper.h b/libc/src/__support/builtins/cmp_helper.h
index 6616783cfc3e4..7cbfb70287f59 100644
--- a/libc/src/__support/builtins/cmp_helper.h
+++ b/libc/src/__support/builtins/cmp_helper.h
@@ -36,7 +36,7 @@ template <typename T> LIBC_INLINE int cmp_le(T a, T b) {
   if (FPBits(a).is_nan() || FPBits(b).is_nan())
     return 1; // LE_UNORDERED
   if (fputil::equals(a, b))
-    return 0; // LE_EQUAL
+    return 0;                              // LE_EQUAL
   return fputil::less_than(a, b) ? -1 : 1; // LE_LESS : LE_GREATER
 }
 
@@ -47,7 +47,7 @@ template <typename T> LIBC_INLINE int cmp_ge(T a, T b) {
   if (FPBits(a).is_nan() || FPBits(b).is_nan())
     return -1; // GE_UNORDERED
   if (fputil::equals(a, b))
-    return 0; // GE_EQUAL
+    return 0;                                 // GE_EQUAL
   return fputil::greater_than(a, b) ? 1 : -1; // GE_GREATER : GE_LESS
 }
 

>From b21ea8525d6c97d6bb647bed4c703d50d01f2b5c Mon Sep 17 00:00:00 2001
From: hulxv <hulxxv at gmail.com>
Date: Wed, 29 Jul 2026 01:24:14 +0300
Subject: [PATCH 3/4] [compiler-rt][builtins] libc-backed single-float
 comparison builtins

---
 compiler-rt/lib/builtins/CMakeLists.txt    |  1 +
 compiler-rt/lib/builtins/comparesf2.cpp    | 54 ++++++++++++++++++++++
 libc/shared/builtins.h                     |  3 ++
 libc/shared/builtins/gesf2.h               | 29 ++++++++++++
 libc/shared/builtins/lesf2.h               | 29 ++++++++++++
 libc/shared/builtins/unordsf2.h            | 29 ++++++++++++
 libc/src/__support/builtins/CMakeLists.txt | 17 +++++++
 libc/src/__support/builtins/gesf2.h        | 30 ++++++++++++
 libc/src/__support/builtins/lesf2.h        | 30 ++++++++++++
 libc/src/__support/builtins/unordsf2.h     | 30 ++++++++++++
 libc/test/shared/CMakeLists.txt            |  3 ++
 libc/test/shared/shared_builtins_test.cpp  | 15 ++++++
 12 files changed, 270 insertions(+)
 create mode 100644 compiler-rt/lib/builtins/comparesf2.cpp
 create mode 100644 libc/shared/builtins/gesf2.h
 create mode 100644 libc/shared/builtins/lesf2.h
 create mode 100644 libc/shared/builtins/unordsf2.h
 create mode 100644 libc/src/__support/builtins/gesf2.h
 create mode 100644 libc/src/__support/builtins/lesf2.h
 create mode 100644 libc/src/__support/builtins/unordsf2.h

diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index e7827f2201b43..2dd2935882143 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -288,6 +288,7 @@ if(COMPILER_RT_USE_LIBC_MATH)
   use_libc_builtin(GENERIC_SOURCES    adddf3)
   use_libc_builtin(GENERIC_SOURCES    addsf3)
   use_libc_builtin(GENERIC_TF_SOURCES addtf3)
+  use_libc_builtin(GENERIC_SOURCES    comparesf2)
   use_libc_builtin(GENERIC_SOURCES    divdf3)
   use_libc_builtin(GENERIC_SOURCES    divsf3)
   use_libc_builtin(GENERIC_TF_SOURCES divtf3)
diff --git a/compiler-rt/lib/builtins/comparesf2.cpp b/compiler-rt/lib/builtins/comparesf2.cpp
new file mode 100644
index 0000000000000..4db28588f4afc
--- /dev/null
+++ b/compiler-rt/lib/builtins/comparesf2.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+/// This file implements compiler-rt's float comparison routines
+/// (__lesf2/__gesf2/__unordsf2 and their aliases) on top of LLVM-libc's shared
+/// comparison builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#define SINGLE_PRECISION
+#include "fp_lib.h"
+
+#include "fp_compare_impl.inc"
+#include "fp_libc_config.h"
+#include "shared/builtins/gesf2.h"
+#include "shared/builtins/lesf2.h"
+#include "shared/builtins/unordsf2.h"
+
+extern "C" {
+
+COMPILER_RT_ABI CMP_RESULT __lesf2(fp_t a, fp_t b) {
+  return LIBC_NAMESPACE::shared::lesf2(a, b);
+}
+#if defined(__ELF__)
+COMPILER_RT_ALIAS(__lesf2, __cmpsf2)
+#endif
+COMPILER_RT_ALIAS(__lesf2, __eqsf2)
+COMPILER_RT_ALIAS(__lesf2, __ltsf2)
+COMPILER_RT_ALIAS(__lesf2, __nesf2)
+
+COMPILER_RT_ABI CMP_RESULT __gesf2(fp_t a, fp_t b) {
+  return LIBC_NAMESPACE::shared::gesf2(a, b);
+}
+COMPILER_RT_ALIAS(__gesf2, __gtsf2)
+
+COMPILER_RT_ABI CMP_RESULT __unordsf2(fp_t a, fp_t b) {
+  return LIBC_NAMESPACE::shared::unordsf2(a, b);
+}
+
+#if defined(__ARM_EABI__)
+#if defined(COMPILER_RT_ARMHF_TARGET)
+AEABI_RTABI int __aeabi_fcmpun(fp_t a, fp_t b) { return __unordsf2(a, b); }
+#else
+COMPILER_RT_ALIAS(__unordsf2, __aeabi_fcmpun)
+#endif
+#endif
+
+} // extern "C"
diff --git a/libc/shared/builtins.h b/libc/shared/builtins.h
index 21c2bed4a0af1..592ba3589dc47 100644
--- a/libc/shared/builtins.h
+++ b/libc/shared/builtins.h
@@ -51,6 +51,8 @@
 #include "builtins/floatunsisf.h"
 #include "builtins/floatuntidf.h"
 #include "builtins/floatuntisf.h"
+#include "builtins/gesf2.h"
+#include "builtins/lesf2.h"
 #include "builtins/muldf3.h"
 #include "builtins/mulsf3.h"
 #include "builtins/multf3.h"
@@ -63,5 +65,6 @@
 #include "builtins/trunctfdf2.h"
 #include "builtins/trunctfsf2.h"
 #include "builtins/trunctfxf2.h"
+#include "builtins/unordsf2.h"
 
 #endif // LLVM_LIBC_SHARED_BUILTINS_H
diff --git a/libc/shared/builtins/gesf2.h b/libc/shared/builtins/gesf2.h
new file mode 100644
index 0000000000000..81b0d3972d280
--- /dev/null
+++ b/libc/shared/builtins/gesf2.h
@@ -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
+/// This header exposes LLVM-libc's __gesf2 implementation as shared::gesf2 so
+/// that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_GESF2_H
+#define LLVM_LIBC_SHARED_BUILTINS_GESF2_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/gesf2.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::gesf2;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_GESF2_H
diff --git a/libc/shared/builtins/lesf2.h b/libc/shared/builtins/lesf2.h
new file mode 100644
index 0000000000000..3fec6d3f0366f
--- /dev/null
+++ b/libc/shared/builtins/lesf2.h
@@ -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
+/// This header exposes LLVM-libc's __lesf2 implementation as shared::lesf2 so
+/// that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_LESF2_H
+#define LLVM_LIBC_SHARED_BUILTINS_LESF2_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/lesf2.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::lesf2;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_LESF2_H
diff --git a/libc/shared/builtins/unordsf2.h b/libc/shared/builtins/unordsf2.h
new file mode 100644
index 0000000000000..eb2c4d4c0483e
--- /dev/null
+++ b/libc/shared/builtins/unordsf2.h
@@ -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
+/// This header exposes LLVM-libc's __unordsf2 implementation as
+/// shared::unordsf2 so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_UNORDSF2_H
+#define LLVM_LIBC_SHARED_BUILTINS_UNORDSF2_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/unordsf2.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::unordsf2;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_UNORDSF2_H
diff --git a/libc/src/__support/builtins/CMakeLists.txt b/libc/src/__support/builtins/CMakeLists.txt
index aa3afaf190304..da47cc044613b 100644
--- a/libc/src/__support/builtins/CMakeLists.txt
+++ b/libc/src/__support/builtins/CMakeLists.txt
@@ -249,6 +249,11 @@ add_header_library(
   DEPENDS
     libc.hdr.stdint_proxy
     libc.src.__support.builtins.fixint_helper
+  lesf2
+  HDRS
+    lesf2.h
+  DEPENDS
+    libc.src.__support.builtins.cmp_helper
     libc.src.__support.macros.config
 )
 
@@ -271,6 +276,11 @@ add_header_library(
   DEPENDS
     libc.hdr.stdint_proxy
     libc.src.__support.builtins.fixint_helper
+  gesf2
+  HDRS
+    gesf2.h
+  DEPENDS
+    libc.src.__support.builtins.cmp_helper
     libc.src.__support.macros.config
 )
 
@@ -492,4 +502,11 @@ add_header_library(
     libc.src.__support.builtins.floatint_helper
     libc.src.__support.macros.config
     libc.src.__support.macros.properties.types
+)
+  unordsf2
+  HDRS
+    unordsf2.h
+  DEPENDS
+    libc.src.__support.builtins.cmp_helper
+    libc.src.__support.macros.config
 )
diff --git a/libc/src/__support/builtins/gesf2.h b/libc/src/__support/builtins/gesf2.h
new file mode 100644
index 0000000000000..14523acce5be7
--- /dev/null
+++ b/libc/src/__support/builtins/gesf2.h
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+/// This header exposes LLVM-libc's __gesf2 implementation as builtins::gesf2 so
+/// that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_GESF2_H
+#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_GESF2_H
+
+#include "src/__support/builtins/cmp_helper.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace builtins {
+
+// Greater-equal comparison of float; mirrors compiler-rt's __gesf2.
+LIBC_INLINE int gesf2(float a, float b) { return cmp_ge(a, b); }
+
+} // namespace builtins
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_GESF2_H
diff --git a/libc/src/__support/builtins/lesf2.h b/libc/src/__support/builtins/lesf2.h
new file mode 100644
index 0000000000000..8358198d90df1
--- /dev/null
+++ b/libc/src/__support/builtins/lesf2.h
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+/// This header exposes LLVM-libc's __lesf2 implementation as builtins::lesf2 so
+/// that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_LESF2_H
+#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_LESF2_H
+
+#include "src/__support/builtins/cmp_helper.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace builtins {
+
+// Less-equal comparison of float; mirrors compiler-rt's __lesf2.
+LIBC_INLINE int lesf2(float a, float b) { return cmp_le(a, b); }
+
+} // namespace builtins
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_LESF2_H
diff --git a/libc/src/__support/builtins/unordsf2.h b/libc/src/__support/builtins/unordsf2.h
new file mode 100644
index 0000000000000..23268413863e5
--- /dev/null
+++ b/libc/src/__support/builtins/unordsf2.h
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+/// This header exposes LLVM-libc's __unordsf2 implementation as
+/// builtins::unordsf2 so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_UNORDSF2_H
+#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_UNORDSF2_H
+
+#include "src/__support/builtins/cmp_helper.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace builtins {
+
+// Unordered comparison of float; mirrors compiler-rt's __unordsf2.
+LIBC_INLINE int unordsf2(float a, float b) { return cmp_unord(a, b); }
+
+} // namespace builtins
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_UNORDSF2_H
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index 49232caf377bc..681f17de5b9ec 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -862,6 +862,8 @@ add_fp_unittest(
     libc.src.__support.builtins.floatunsisf
     libc.src.__support.builtins.floatuntidf
     libc.src.__support.builtins.floatuntisf
+    libc.src.__support.builtins.gesf2
+    libc.src.__support.builtins.lesf2
     libc.src.__support.builtins.muldf3
     libc.src.__support.builtins.mulsf3
     libc.src.__support.builtins.multf3
@@ -875,6 +877,7 @@ add_fp_unittest(
     libc.src.__support.builtins.trunctfsf2
     libc.src.__support.builtins.trunctfxf2
     libc.src.__support.uint128
+    libc.src.__support.builtins.unordsf2
 )
 
 add_fp_unittest(
diff --git a/libc/test/shared/shared_builtins_test.cpp b/libc/test/shared/shared_builtins_test.cpp
index eb1c566d6b179..771d16e001328 100644
--- a/libc/test/shared/shared_builtins_test.cpp
+++ b/libc/test/shared/shared_builtins_test.cpp
@@ -61,3 +61,18 @@ TEST(LlvmLibcSharedBuiltinsTest, TruncateConversion) {
 #endif // LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80
 #endif // LIBC_TYPES_HAS_FLOAT128
 }
+
+TEST(LlvmLibcSharedBuiltinsTest, SingleCompare) {
+  const float aNaN =
+      LIBC_NAMESPACE::fputil::FPBits<float>::quiet_nan().get_val();
+  EXPECT_EQ(-1, shared::gesf2(1.0f, 2.0f));
+  EXPECT_EQ(0, shared::gesf2(1.0f, 1.0f));
+  EXPECT_EQ(1, shared::gesf2(2.0f, 1.0f));
+  EXPECT_EQ(-1, shared::gesf2(aNaN, 1.0f));
+  EXPECT_EQ(-1, shared::lesf2(1.0f, 2.0f));
+  EXPECT_EQ(0, shared::lesf2(1.0f, 1.0f));
+  EXPECT_EQ(1, shared::lesf2(2.0f, 1.0f));
+  EXPECT_EQ(1, shared::lesf2(aNaN, 1.0f));
+  EXPECT_EQ(0, shared::unordsf2(1.0f, 2.0f));
+  EXPECT_EQ(1, shared::unordsf2(aNaN, 1.0f));
+}

>From 15ddc543c0be40d2e21a338c43955ea047bf3f17 Mon Sep 17 00:00:00 2001
From: hulxv <hulxxv at gmail.com>
Date: Sun, 9 Aug 2026 00:49:29 +0300
Subject: [PATCH 4/4] conflict

---
 libc/src/__support/builtins/CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libc/src/__support/builtins/CMakeLists.txt b/libc/src/__support/builtins/CMakeLists.txt
index da47cc044613b..6602a581d4c82 100644
--- a/libc/src/__support/builtins/CMakeLists.txt
+++ b/libc/src/__support/builtins/CMakeLists.txt
@@ -232,6 +232,9 @@ add_header_library(
     truncdfsf2.h
   DEPENDS
     libc.src.__support.builtins.fpconvert_helper
+)
+
+add_header_library(
   cmp_helper
   HDRS
     cmp_helper.h



More information about the llvm-branch-commits mailing list