[libc-commits] [compiler-rt] [libc] [llvm] [compiler-rt][builtins] add libc-backed arithmetic builtins (PR #207092)
via libc-commits
libc-commits at lists.llvm.org
Sat Jul 4 13:03:12 PDT 2026
https://github.com/hulxv updated https://github.com/llvm/llvm-project/pull/207092
>From 8c4de3219b6cdf6215c3e5eb790179aaea526414 Mon Sep 17 00:00:00 2001
From: hulxv <hulxxv at gmail.com>
Date: Thu, 28 May 2026 02:12:37 +0300
Subject: [PATCH 1/7] [compiler-rt][builtins] introduce libc math routines
---
.../compiler-rt-libc-builtins-tests.yml | 58 +++++++++++++++++++
compiler-rt/lib/builtins/CMakeLists.txt | 24 ++++++++
compiler-rt/lib/builtins/addtf3.cpp | 22 +++++++
compiler-rt/lib/builtins/fp_libc_config.h | 26 +++++++++
4 files changed, 130 insertions(+)
create mode 100644 .github/workflows/compiler-rt-libc-builtins-tests.yml
create mode 100644 compiler-rt/lib/builtins/addtf3.cpp
create mode 100644 compiler-rt/lib/builtins/fp_libc_config.h
diff --git a/.github/workflows/compiler-rt-libc-builtins-tests.yml b/.github/workflows/compiler-rt-libc-builtins-tests.yml
new file mode 100644
index 0000000000000..3dab28c0387a7
--- /dev/null
+++ b/.github/workflows/compiler-rt-libc-builtins-tests.yml
@@ -0,0 +1,58 @@
+# Pre-commit CI for the compiler-rt + LLVM-libc builtins integration.
+name: compiler-rt + libc Builtins Tests
+permissions:
+ contents: read
+on:
+ pull_request:
+ branches: ["main"]
+ paths:
+ - "compiler-rt/lib/builtins/**"
+ - "compiler-rt/test/builtins/**"
+ - "libc/shared/builtins.h"
+ - "libc/shared/builtins/**"
+ - "libc/src/__support/builtins/**"
+ - "libc/src/__support/FPUtil/**"
+ - ".github/workflows/compiler-rt-libc-builtins-tests.yml"
+
+jobs:
+ build:
+ name: builtins (${{ matrix.os }})
+ if: github.repository_owner == 'llvm'
+ runs-on: ${{ matrix.os }}
+ container:
+ image: ${{ (startsWith(matrix.os, 'ubuntu-24.04-arm') && 'ghcr.io/llvm/arm64v8/libc-ubuntu-24.04') || 'ghcr.io/llvm/libc-ubuntu-24.04' }}
+ options: >-
+ --privileged
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-24.04, ubuntu-24.04-arm]
+
+ steps:
+ - uses: actions/checkout at de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+
+ - name: Configure CMake
+ shell: bash
+ run: |
+ cmake \
+ -B build \
+ -S llvm \
+ -G Ninja \
+ -DCMAKE_C_COMPILER=clang-23 \
+ -DCMAKE_CXX_COMPILER=clang++-23 \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DLLVM_ENABLE_ASSERTIONS=ON \
+ -DLLVM_ENABLE_PROJECTS=clang \
+ -DLLVM_ENABLE_RUNTIMES="compiler-rt" \
+ -DCOMPILER_RT_USE_LIBC_MATH=ON \
+ -DCOMPILER_RT_INCLUDE_TESTS=ON
+
+ - name: Test compiler-rt builtins
+ shell: bash
+ run: |
+ cmake \
+ --build build \
+ --parallel \
+ --target check-builtins
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index 0d52b582a8f26..e128fea6a3415 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -243,6 +243,30 @@ set(GENERIC_TF_SOURCES
trunctfsf2.c
)
+option(COMPILER_RT_USE_LIBC_MATH
+ "Use LLVM libc math routines for floating-point builtins" OFF)
+
+# Swap the legacy soft-float <name>.c builtin in <list> for the libc-backed
+# <name>.cpp implementation (which delegates to LIBC_NAMESPACE::shared::*).
+macro(use_libc_builtin list_var name)
+ list(REMOVE_ITEM ${list_var} ${name}.c)
+ list(APPEND ${list_var} ${name}.cpp)
+endmacro()
+
+if(COMPILER_RT_USE_LIBC_MATH)
+ include(FindLibcCommonUtils)
+ if(NOT TARGET llvm-libc-common-utilities)
+ message(FATAL_ERROR "LLVM libc is not found at ${libc_path}.")
+ endif()
+
+ get_target_property(_libc_include_dirs llvm-libc-common-utilities
+ INTERFACE_INCLUDE_DIRECTORIES)
+ include_directories(SYSTEM ${_libc_include_dirs})
+ add_definitions(-DCOMPILER_RT_USE_LIBC_MATH)
+
+ use_libc_builtin(GENERIC_TF_SOURCES addtf3)
+endif()
+
option(COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN
"Skip the atomic builtin (these should normally be provided by a shared library)"
On)
diff --git a/compiler-rt/lib/builtins/addtf3.cpp b/compiler-rt/lib/builtins/addtf3.cpp
new file mode 100644
index 0000000000000..ae4dbd5772cfb
--- /dev/null
+++ b/compiler-rt/lib/builtins/addtf3.cpp
@@ -0,0 +1,22 @@
+//===-- lib/addtf3.cpp - Quad-precision addition (libc-backed) --*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __addtf3 implemented on top of LLVM-libc's shared::addtf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/addtf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __addtf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::addtf3(a, b);
+}
diff --git a/compiler-rt/lib/builtins/fp_libc_config.h b/compiler-rt/lib/builtins/fp_libc_config.h
new file mode 100644
index 0000000000000..8264de2492d67
--- /dev/null
+++ b/compiler-rt/lib/builtins/fp_libc_config.h
@@ -0,0 +1,26 @@
+//===-- lib/fp_libc_config.h - LLVM-libc compile config --------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// Compile-time configuration consumed by LLVM-libc's fputil headers when they
+// are included from compiler-rt builtins under COMPILER_RT_USE_LIBC_MATH.
+// Pins the libc namespace to __llvm_libc_rt to avoid clashing with libc's own
+// symbols, and disables errno / FP-exception bookkeeping inside libc routines
+// called from builtins.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef FP_LIBC_CONFIG_H
+#define FP_LIBC_CONFIG_H
+
+#ifndef LIBC_NAMESPACE
+#define LIBC_NAMESPACE __llvm_libc_rt
+#endif
+
+#define LIBC_MATH (LIBC_MATH_NO_ERRNO | LIBC_MATH_NO_EXCEPT)
+
+#endif // FP_LIBC_CONFIG_H
>From 802ff4d5eb00231a0ac7e2f62604d95bb0ab9173 Mon Sep 17 00:00:00 2001
From: hulxv <hulxxv at gmail.com>
Date: Mon, 1 Jun 2026 00:50:36 +0300
Subject: [PATCH 2/7] allow all branches
---
.github/workflows/compiler-rt-libc-builtins-tests.yml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.github/workflows/compiler-rt-libc-builtins-tests.yml b/.github/workflows/compiler-rt-libc-builtins-tests.yml
index 3dab28c0387a7..ba9c9ecf38bdb 100644
--- a/.github/workflows/compiler-rt-libc-builtins-tests.yml
+++ b/.github/workflows/compiler-rt-libc-builtins-tests.yml
@@ -4,7 +4,6 @@ permissions:
contents: read
on:
pull_request:
- branches: ["main"]
paths:
- "compiler-rt/lib/builtins/**"
- "compiler-rt/test/builtins/**"
>From 51d103a482a24b1525f39ef3dc9b4ec55406960c Mon Sep 17 00:00:00 2001
From: hulxv <hulxxv at gmail.com>
Date: Mon, 1 Jun 2026 00:52:23 +0300
Subject: [PATCH 3/7] remove `--privileged`` option
---
.github/workflows/compiler-rt-libc-builtins-tests.yml | 2 --
1 file changed, 2 deletions(-)
diff --git a/.github/workflows/compiler-rt-libc-builtins-tests.yml b/.github/workflows/compiler-rt-libc-builtins-tests.yml
index ba9c9ecf38bdb..66e511b45d95a 100644
--- a/.github/workflows/compiler-rt-libc-builtins-tests.yml
+++ b/.github/workflows/compiler-rt-libc-builtins-tests.yml
@@ -20,8 +20,6 @@ jobs:
runs-on: ${{ matrix.os }}
container:
image: ${{ (startsWith(matrix.os, 'ubuntu-24.04-arm') && 'ghcr.io/llvm/arm64v8/libc-ubuntu-24.04') || 'ghcr.io/llvm/libc-ubuntu-24.04' }}
- options: >-
- --privileged
strategy:
fail-fast: false
matrix:
>From 19d2aaa029e719f0581a4f6a22ccefce4109a586 Mon Sep 17 00:00:00 2001
From: hulxv <hulxxv at gmail.com>
Date: Mon, 1 Jun 2026 00:53:52 +0300
Subject: [PATCH 4/7] remove shell option
---
.github/workflows/compiler-rt-libc-builtins-tests.yml | 2 --
1 file changed, 2 deletions(-)
diff --git a/.github/workflows/compiler-rt-libc-builtins-tests.yml b/.github/workflows/compiler-rt-libc-builtins-tests.yml
index 66e511b45d95a..8605892a701fd 100644
--- a/.github/workflows/compiler-rt-libc-builtins-tests.yml
+++ b/.github/workflows/compiler-rt-libc-builtins-tests.yml
@@ -31,7 +31,6 @@ jobs:
persist-credentials: false
- name: Configure CMake
- shell: bash
run: |
cmake \
-B build \
@@ -47,7 +46,6 @@ jobs:
-DCOMPILER_RT_INCLUDE_TESTS=ON
- name: Test compiler-rt builtins
- shell: bash
run: |
cmake \
--build build \
>From e549f48cbb3073b3a55e78e24e28cda8bf2136b0 Mon Sep 17 00:00:00 2001
From: hulxv <hulxxv at gmail.com>
Date: Fri, 26 Jun 2026 21:42:17 +0300
Subject: [PATCH 5/7] Split "[CI] Add precommit CIs to test compiler-rt + LLVM
libc integration"
---
.../compiler-rt-libc-builtins-tests.yml | 53 -------------------
1 file changed, 53 deletions(-)
delete mode 100644 .github/workflows/compiler-rt-libc-builtins-tests.yml
diff --git a/.github/workflows/compiler-rt-libc-builtins-tests.yml b/.github/workflows/compiler-rt-libc-builtins-tests.yml
deleted file mode 100644
index 8605892a701fd..0000000000000
--- a/.github/workflows/compiler-rt-libc-builtins-tests.yml
+++ /dev/null
@@ -1,53 +0,0 @@
-# Pre-commit CI for the compiler-rt + LLVM-libc builtins integration.
-name: compiler-rt + libc Builtins Tests
-permissions:
- contents: read
-on:
- pull_request:
- paths:
- - "compiler-rt/lib/builtins/**"
- - "compiler-rt/test/builtins/**"
- - "libc/shared/builtins.h"
- - "libc/shared/builtins/**"
- - "libc/src/__support/builtins/**"
- - "libc/src/__support/FPUtil/**"
- - ".github/workflows/compiler-rt-libc-builtins-tests.yml"
-
-jobs:
- build:
- name: builtins (${{ matrix.os }})
- if: github.repository_owner == 'llvm'
- runs-on: ${{ matrix.os }}
- container:
- image: ${{ (startsWith(matrix.os, 'ubuntu-24.04-arm') && 'ghcr.io/llvm/arm64v8/libc-ubuntu-24.04') || 'ghcr.io/llvm/libc-ubuntu-24.04' }}
- strategy:
- fail-fast: false
- matrix:
- os: [ubuntu-24.04, ubuntu-24.04-arm]
-
- steps:
- - uses: actions/checkout at de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- with:
- persist-credentials: false
-
- - name: Configure CMake
- run: |
- cmake \
- -B build \
- -S llvm \
- -G Ninja \
- -DCMAKE_C_COMPILER=clang-23 \
- -DCMAKE_CXX_COMPILER=clang++-23 \
- -DCMAKE_BUILD_TYPE=Release \
- -DLLVM_ENABLE_ASSERTIONS=ON \
- -DLLVM_ENABLE_PROJECTS=clang \
- -DLLVM_ENABLE_RUNTIMES="compiler-rt" \
- -DCOMPILER_RT_USE_LIBC_MATH=ON \
- -DCOMPILER_RT_INCLUDE_TESTS=ON
-
- - name: Test compiler-rt builtins
- run: |
- cmake \
- --build build \
- --parallel \
- --target check-builtins
>From 173cbe6a95cb935cd24a4ea8eb448e61bd901714 Mon Sep 17 00:00:00 2001
From: hulxv <hulxxv at gmail.com>
Date: Thu, 2 Jul 2026 01:16:36 +0300
Subject: [PATCH 6/7] [compiler-rt][builtins] add libc-backed arithmetic
builtins
---
compiler-rt/lib/builtins/CMakeLists.txt | 7 +++++++
compiler-rt/lib/builtins/adddf3.cpp | 22 ++++++++++++++++++++++
compiler-rt/lib/builtins/divdf3.cpp | 22 ++++++++++++++++++++++
compiler-rt/lib/builtins/divtf3.cpp | 22 ++++++++++++++++++++++
compiler-rt/lib/builtins/muldf3.cpp | 22 ++++++++++++++++++++++
compiler-rt/lib/builtins/multf3.cpp | 22 ++++++++++++++++++++++
compiler-rt/lib/builtins/subdf3.cpp | 22 ++++++++++++++++++++++
compiler-rt/lib/builtins/subtf3.cpp | 22 ++++++++++++++++++++++
8 files changed, 161 insertions(+)
create mode 100644 compiler-rt/lib/builtins/adddf3.cpp
create mode 100644 compiler-rt/lib/builtins/divdf3.cpp
create mode 100644 compiler-rt/lib/builtins/divtf3.cpp
create mode 100644 compiler-rt/lib/builtins/muldf3.cpp
create mode 100644 compiler-rt/lib/builtins/multf3.cpp
create mode 100644 compiler-rt/lib/builtins/subdf3.cpp
create mode 100644 compiler-rt/lib/builtins/subtf3.cpp
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index e128fea6a3415..659e149b5a307 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -264,7 +264,14 @@ if(COMPILER_RT_USE_LIBC_MATH)
include_directories(SYSTEM ${_libc_include_dirs})
add_definitions(-DCOMPILER_RT_USE_LIBC_MATH)
+ use_libc_builtin(GENERIC_SOURCES adddf3)
use_libc_builtin(GENERIC_TF_SOURCES addtf3)
+ use_libc_builtin(GENERIC_SOURCES divdf3)
+ use_libc_builtin(GENERIC_TF_SOURCES divtf3)
+ use_libc_builtin(GENERIC_SOURCES muldf3)
+ use_libc_builtin(GENERIC_TF_SOURCES multf3)
+ use_libc_builtin(GENERIC_SOURCES subdf3)
+ use_libc_builtin(GENERIC_TF_SOURCES divtf3)
endif()
option(COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN
diff --git a/compiler-rt/lib/builtins/adddf3.cpp b/compiler-rt/lib/builtins/adddf3.cpp
new file mode 100644
index 0000000000000..0bae3c92c3d3b
--- /dev/null
+++ b/compiler-rt/lib/builtins/adddf3.cpp
@@ -0,0 +1,22 @@
+//===-- lib/adddf3.cpp - Quad-precision addition (libc-backed) --*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __adddf3 implemented on top of LLVM-libc's shared::adddf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/adddf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::adddf3(a, b);
+}
diff --git a/compiler-rt/lib/builtins/divdf3.cpp b/compiler-rt/lib/builtins/divdf3.cpp
new file mode 100644
index 0000000000000..ea01a3c719c51
--- /dev/null
+++ b/compiler-rt/lib/builtins/divdf3.cpp
@@ -0,0 +1,22 @@
+//===-- lib/divdf3.cpp - Quad-precision addition (libc-backed) --*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __divdf3 implemented on top of LLVM-libc's shared::divdf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/divdf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __divdf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::divdf3(a, b);
+}
diff --git a/compiler-rt/lib/builtins/divtf3.cpp b/compiler-rt/lib/builtins/divtf3.cpp
new file mode 100644
index 0000000000000..7b16174ce16d9
--- /dev/null
+++ b/compiler-rt/lib/builtins/divtf3.cpp
@@ -0,0 +1,22 @@
+//===-- lib/divtf3.cpp - Quad-precision addition (libc-backed) --*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __divtf3 implemented on top of LLVM-libc's shared::divtf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/divtf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __divtf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::divtf3(a, b);
+}
diff --git a/compiler-rt/lib/builtins/muldf3.cpp b/compiler-rt/lib/builtins/muldf3.cpp
new file mode 100644
index 0000000000000..d1d4c70fdb837
--- /dev/null
+++ b/compiler-rt/lib/builtins/muldf3.cpp
@@ -0,0 +1,22 @@
+//===-- lib/muldf3.cpp - Quad-precision addition (libc-backed) --*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __muldf3 implemented on top of LLVM-libc's shared::muldf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/muldf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __muldf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::muldf3(a, b);
+}
diff --git a/compiler-rt/lib/builtins/multf3.cpp b/compiler-rt/lib/builtins/multf3.cpp
new file mode 100644
index 0000000000000..bafc7016bddfb
--- /dev/null
+++ b/compiler-rt/lib/builtins/multf3.cpp
@@ -0,0 +1,22 @@
+//===-- lib/multf3.cpp - Quad-precision addition (libc-backed) --*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __multf3 implemented on top of LLVM-libc's shared::multf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/multf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __multf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::multf3(a, b);
+}
diff --git a/compiler-rt/lib/builtins/subdf3.cpp b/compiler-rt/lib/builtins/subdf3.cpp
new file mode 100644
index 0000000000000..c688d7dcab4c9
--- /dev/null
+++ b/compiler-rt/lib/builtins/subdf3.cpp
@@ -0,0 +1,22 @@
+//===-- lib/subdf3.cpp - Quad-precision addition (libc-backed) --*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __subdf3 implemented on top of LLVM-libc's shared::subdf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/subdf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __subdf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::subdf3(a, b);
+}
diff --git a/compiler-rt/lib/builtins/subtf3.cpp b/compiler-rt/lib/builtins/subtf3.cpp
new file mode 100644
index 0000000000000..6868293f4043f
--- /dev/null
+++ b/compiler-rt/lib/builtins/subtf3.cpp
@@ -0,0 +1,22 @@
+//===-- lib/subtf3.cpp - Quad-precision addition (libc-backed) --*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __subtf3 implemented on top of LLVM-libc's shared::subtf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/subtf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __subtf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::subtf3(a, b);
+}
>From fb3d6e517889ce0bbd791da968f62781f0fa4b7d Mon Sep 17 00:00:00 2001
From: hulxv <hulxxv at gmail.com>
Date: Sat, 4 Jul 2026 20:03:09 +0300
Subject: [PATCH 7/7] [compiler-rt][builtins] add libc-backed arithmetic
builtins
---
compiler-rt/lib/builtins/CMakeLists.txt | 9 ++++++
compiler-rt/lib/builtins/adddf3.cpp | 21 ++++++++++++
compiler-rt/lib/builtins/divdf3.cpp | 21 ++++++++++++
compiler-rt/lib/builtins/divtf3.cpp | 22 +++++++++++++
compiler-rt/lib/builtins/muldf3.cpp | 22 +++++++++++++
compiler-rt/lib/builtins/multf3.cpp | 22 +++++++++++++
compiler-rt/lib/builtins/negdf2.cpp | 21 ++++++++++++
compiler-rt/lib/builtins/negsf2.cpp | 22 +++++++++++++
compiler-rt/lib/builtins/subdf3.cpp | 21 ++++++++++++
compiler-rt/lib/builtins/subtf3.cpp | 22 +++++++++++++
libc/shared/builtins.h | 2 ++
libc/shared/builtins/negdf2.h | 29 +++++++++++++++++
libc/shared/builtins/negsf2.h | 29 +++++++++++++++++
libc/src/__support/builtins/CMakeLists.txt | 17 ++++++++++
libc/src/__support/builtins/negdf2.h | 37 ++++++++++++++++++++++
libc/src/__support/builtins/negsf2.h | 37 ++++++++++++++++++++++
libc/test/shared/CMakeLists.txt | 2 ++
libc/test/shared/shared_builtins_test.cpp | 3 +-
18 files changed, 358 insertions(+), 1 deletion(-)
create mode 100644 compiler-rt/lib/builtins/adddf3.cpp
create mode 100644 compiler-rt/lib/builtins/divdf3.cpp
create mode 100644 compiler-rt/lib/builtins/divtf3.cpp
create mode 100644 compiler-rt/lib/builtins/muldf3.cpp
create mode 100644 compiler-rt/lib/builtins/multf3.cpp
create mode 100644 compiler-rt/lib/builtins/negdf2.cpp
create mode 100644 compiler-rt/lib/builtins/negsf2.cpp
create mode 100644 compiler-rt/lib/builtins/subdf3.cpp
create mode 100644 compiler-rt/lib/builtins/subtf3.cpp
create mode 100644 libc/shared/builtins/negdf2.h
create mode 100644 libc/shared/builtins/negsf2.h
create mode 100644 libc/src/__support/builtins/negdf2.h
create mode 100644 libc/src/__support/builtins/negsf2.h
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index e128fea6a3415..3a7751425d73f 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -264,7 +264,16 @@ if(COMPILER_RT_USE_LIBC_MATH)
include_directories(SYSTEM ${_libc_include_dirs})
add_definitions(-DCOMPILER_RT_USE_LIBC_MATH)
+ use_libc_builtin(GENERIC_SOURCES adddf3)
use_libc_builtin(GENERIC_TF_SOURCES addtf3)
+ use_libc_builtin(GENERIC_SOURCES divdf3)
+ use_libc_builtin(GENERIC_TF_SOURCES divtf3)
+ use_libc_builtin(GENERIC_SOURCES muldf3)
+ use_libc_builtin(GENERIC_TF_SOURCES multf3)
+ use_libc_builtin(GENERIC_SOURCES negdf2)
+ use_libc_builtin(GENERIC_SOURCES negsf2)
+ use_libc_builtin(GENERIC_SOURCES subdf3)
+ use_libc_builtin(GENERIC_TF_SOURCES subtf3)
endif()
option(COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN
diff --git a/compiler-rt/lib/builtins/adddf3.cpp b/compiler-rt/lib/builtins/adddf3.cpp
new file mode 100644
index 0000000000000..03da4a1e33fb1
--- /dev/null
+++ b/compiler-rt/lib/builtins/adddf3.cpp
@@ -0,0 +1,21 @@
+//===-- lib/adddf3.cpp - double-precision addition --------------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __adddf3 implemented on top of LLVM-libc's shared::adddf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/adddf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::adddf3(a, b);
+}
diff --git a/compiler-rt/lib/builtins/divdf3.cpp b/compiler-rt/lib/builtins/divdf3.cpp
new file mode 100644
index 0000000000000..50ce7372b0647
--- /dev/null
+++ b/compiler-rt/lib/builtins/divdf3.cpp
@@ -0,0 +1,21 @@
+//===-- lib/divdf3.cpp - double-precision division --------------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __divdf3 implemented on top of LLVM-libc's shared::divdf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/divdf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __divdf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::divdf3(a, b);
+}
diff --git a/compiler-rt/lib/builtins/divtf3.cpp b/compiler-rt/lib/builtins/divtf3.cpp
new file mode 100644
index 0000000000000..bd099280aead6
--- /dev/null
+++ b/compiler-rt/lib/builtins/divtf3.cpp
@@ -0,0 +1,22 @@
+//===-- lib/divtf3.cpp - quad-precision division ----------------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __divtf3 implemented on top of LLVM-libc's shared::divtf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/divtf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __divtf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::divtf3(a, b);
+}
diff --git a/compiler-rt/lib/builtins/muldf3.cpp b/compiler-rt/lib/builtins/muldf3.cpp
new file mode 100644
index 0000000000000..d2effb1c7d665
--- /dev/null
+++ b/compiler-rt/lib/builtins/muldf3.cpp
@@ -0,0 +1,22 @@
+//===-- lib/muldf3.cpp - double-precision multiplication --------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __muldf3 implemented on top of LLVM-libc's shared::muldf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/muldf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __muldf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::muldf3(a, b);
+}
diff --git a/compiler-rt/lib/builtins/multf3.cpp b/compiler-rt/lib/builtins/multf3.cpp
new file mode 100644
index 0000000000000..e8324ca302c6e
--- /dev/null
+++ b/compiler-rt/lib/builtins/multf3.cpp
@@ -0,0 +1,22 @@
+//===-- lib/multf3.cpp - quad-precision multiplication ----------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __multf3 implemented on top of LLVM-libc's shared::multf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/multf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __multf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::multf3(a, b);
+}
diff --git a/compiler-rt/lib/builtins/negdf2.cpp b/compiler-rt/lib/builtins/negdf2.cpp
new file mode 100644
index 0000000000000..cc9f190845cf3
--- /dev/null
+++ b/compiler-rt/lib/builtins/negdf2.cpp
@@ -0,0 +1,21 @@
+//===-- lib/negdf2.cpp - double-precision negation --------------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __negdf2 implemented on top of LLVM-libc's shared::negdf2 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/negdf2.h"
+
+extern "C" COMPILER_RT_ABI fp_t __negdf2(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::negdf2(a, b);
+}
diff --git a/compiler-rt/lib/builtins/negsf2.cpp b/compiler-rt/lib/builtins/negsf2.cpp
new file mode 100644
index 0000000000000..2f23bf64b6b57
--- /dev/null
+++ b/compiler-rt/lib/builtins/negsf2.cpp
@@ -0,0 +1,22 @@
+//===-- lib/negsf2.cpp - single-precision negation --------------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __negsf2 implemented on top of LLVM-libc's shared::negsf2 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/negsf2.h"
+
+extern "C" COMPILER_RT_ABI fp_t __negsf2(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::negsf2(a, b);
+}
diff --git a/compiler-rt/lib/builtins/subdf3.cpp b/compiler-rt/lib/builtins/subdf3.cpp
new file mode 100644
index 0000000000000..8ff5e0dc69976
--- /dev/null
+++ b/compiler-rt/lib/builtins/subdf3.cpp
@@ -0,0 +1,21 @@
+//===-- lib/subdf3.cpp - double-precision subtraction -----------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __subdf3 implemented on top of LLVM-libc's shared::subdf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/subdf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __subdf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::subdf3(a, b);
+}
diff --git a/compiler-rt/lib/builtins/subtf3.cpp b/compiler-rt/lib/builtins/subtf3.cpp
new file mode 100644
index 0000000000000..0880d12ddc50d
--- /dev/null
+++ b/compiler-rt/lib/builtins/subtf3.cpp
@@ -0,0 +1,22 @@
+//===-- lib/subtf3.cpp - quad-precision subtraction -------------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// __subtf3 implemented on top of LLVM-libc's shared::subtf3 instruction.
+//
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/subtf3.h"
+
+extern "C" COMPILER_RT_ABI fp_t __subtf3(fp_t a, fp_t b) {
+ return LIBC_NAMESPACE::shared::subtf3(a, b);
+}
diff --git a/libc/shared/builtins.h b/libc/shared/builtins.h
index 94ff3fb32ee69..455206088751d 100644
--- a/libc/shared/builtins.h
+++ b/libc/shared/builtins.h
@@ -23,6 +23,8 @@
#include "builtins/divtf3.h"
#include "builtins/muldf3.h"
#include "builtins/multf3.h"
+#include "builtins/negdf2.h"
+#include "builtins/negsf2.h"
#include "builtins/subdf3.h"
#include "builtins/subtf3.h"
diff --git a/libc/shared/builtins/negdf2.h b/libc/shared/builtins/negdf2.h
new file mode 100644
index 0000000000000..3322730f39dc6
--- /dev/null
+++ b/libc/shared/builtins/negdf2.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 __negdf2 implementation as shared::negdf2 so
+/// that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_NEGDF2_H
+#define LLVM_LIBC_SHARED_BUILTINS_NEGDF2_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/negdf2.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::negdf2;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_NEGDF2_H
diff --git a/libc/shared/builtins/negsf2.h b/libc/shared/builtins/negsf2.h
new file mode 100644
index 0000000000000..f8919935d8e84
--- /dev/null
+++ b/libc/shared/builtins/negsf2.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 __negsf2 implementation as shared::negsf2 so
+/// that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_NEGSF2_H
+#define LLVM_LIBC_SHARED_BUILTINS_NEGSF2_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/negsf2.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::negsf2;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_NEGSF2_H
diff --git a/libc/src/__support/builtins/CMakeLists.txt b/libc/src/__support/builtins/CMakeLists.txt
index 69b9de039d465..58268fd2d2253 100644
--- a/libc/src/__support/builtins/CMakeLists.txt
+++ b/libc/src/__support/builtins/CMakeLists.txt
@@ -73,3 +73,20 @@ add_header_library(
libc.src.__support.FPUtil.generic.div
libc.src.__support.macros.config
)
+add_header_library(
+ negsf2
+ HDRS
+ negsf2.h
+ DEPENDS
+ libc.src.__support.macros.config
+ libc.src.__support.FPUtil.fp_bits
+)
+
+add_header_library(
+ negdf2
+ HDRS
+ negdf2.h
+ DEPENDS
+ libc.src.__support.macros.config
+ libc.src.__support.FPUtil.fp_bits
+)
diff --git a/libc/src/__support/builtins/negdf2.h b/libc/src/__support/builtins/negdf2.h
new file mode 100644
index 0000000000000..5e9752509a3d7
--- /dev/null
+++ b/libc/src/__support/builtins/negdf2.h
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 __negdf2 implementation as builtins::negdf2
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_NEGDF2_H
+#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_NEGDF2_H
+
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace builtins {
+
+// Double-precision negation
+// Mirrors compiler-rt's __negdf2.
+LIBC_INLINE double negdf2(double x) {
+ using FPBits = fputil::FPBits<double>;
+
+ FPBits bits(x);
+ bits.set_sign(bits.sign().negate());
+ return bits.get_val();
+}
+
+} // namespace builtins
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_NEGDF2_H
diff --git a/libc/src/__support/builtins/negsf2.h b/libc/src/__support/builtins/negsf2.h
new file mode 100644
index 0000000000000..81ab53ca7750c
--- /dev/null
+++ b/libc/src/__support/builtins/negsf2.h
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 __negsf2 implementation as builtins::negsf2
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_NEGSF2_H
+#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_NEGSF2_H
+
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace builtins {
+
+// Single-precision negation
+// Mirrors compiler-rt's __negsf2.
+LIBC_INLINE float negsf2(float x) {
+ using FPBits = fputil::FPBits<float>;
+
+ FPBits bits(x);
+ bits.set_sign(bits.sign().negate());
+ return bits.get_val();
+}
+
+} // namespace builtins
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_NEGSF2_H
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index 7986d5f00ee5b..9882f01cc741d 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -833,6 +833,8 @@ add_fp_unittest(
libc.src.__support.builtins.divtf3
libc.src.__support.builtins.muldf3
libc.src.__support.builtins.multf3
+ libc.src.__support.builtins.negdf3
+ libc.src.__support.builtins.negsf3
libc.src.__support.builtins.subdf3
libc.src.__support.builtins.subtf3
)
diff --git a/libc/test/shared/shared_builtins_test.cpp b/libc/test/shared/shared_builtins_test.cpp
index e7e06452da8bc..4bd0741928b88 100644
--- a/libc/test/shared/shared_builtins_test.cpp
+++ b/libc/test/shared/shared_builtins_test.cpp
@@ -11,13 +11,14 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcSharedBuiltinsTest, AllFloat) {
- // TODO: assertions for shared::*sf3 builtins.
+ EXPECT_FP_EQ(-5.0, LIBC_NAMESPACE::shared::negsf2(5.0));
}
TEST(LlvmLibcSharedBuiltinsTest, AllDouble) {
EXPECT_FP_EQ(3.0, LIBC_NAMESPACE::shared::adddf3(1.0, 2.0));
EXPECT_FP_EQ(3.0, LIBC_NAMESPACE::shared::divdf3(6.0, 2.0));
EXPECT_FP_EQ(6.0, LIBC_NAMESPACE::shared::muldf3(2.0, 3.0));
+ EXPECT_FP_EQ(5.0, LIBC_NAMESPACE::shared::negdf2(-5.0));
EXPECT_FP_EQ(2.0, LIBC_NAMESPACE::shared::subdf3(5.0, 3.0));
}
More information about the libc-commits
mailing list