[libc-commits] [libc] [libc] Modified Exponent decomposition functions to work with emulated Float128 (PR #235459)
Harikrishna S via libc-commits
libc-commits at lists.llvm.org
Sun Oct 25 07:42:11 PDT 2026
https://github.com/xFaron created https://github.com/llvm/llvm-project/pull/235459
Modified for all 4 functions in issue #219757
Added Tests for all 4 functions
Referenced PR #216552 for the modifications
Fixes #219757
AI-use : Used AI for understanding codebase and how various files link to each other, and to study referenced PR. Code edits are all mine.
>From b5763fe5e900c149e33644f82cc4ca7c03f45c00 Mon Sep 17 00:00:00 2001
From: Harikrishna S <harikrishnas.x at gmail.com>
Date: Sun, 25 Oct 2026 19:56:38 +0530
Subject: [PATCH 1/2] modify frexpf128, ilogbf128, llogbf128, logbf128 to work
with emul Float128
---
libc/config/baremetal/aarch64/entrypoints.txt | 8 ++++----
libc/config/baremetal/arm/entrypoints.txt | 8 ++++----
libc/config/baremetal/riscv/entrypoints.txt | 8 ++++----
libc/config/darwin/aarch64/entrypoints.txt | 8 ++++----
libc/config/darwin/x86_64/entrypoints.txt | 3 +++
libc/config/freebsd/x86_64/entrypoints.txt | 8 ++++----
libc/config/gpu/amdgpu/entrypoints.txt | 4 ++++
libc/config/gpu/nvptx/entrypoints.txt | 4 ++++
libc/config/linux/aarch64/entrypoints.txt | 8 ++++----
libc/config/linux/arm/entrypoints.txt | 4 ++++
libc/config/linux/riscv/entrypoints.txt | 8 ++++----
libc/config/linux/x86_64/entrypoints.txt | 8 ++++----
libc/config/windows/entrypoints.txt | 3 +++
libc/shared/math/frexpf128.h | 6 ------
libc/shared/math/ilogbf128.h | 6 ------
libc/shared/math/llogbf128.h | 6 ------
libc/shared/math/logbf128.h | 6 ------
libc/src/__support/math/CMakeLists.txt | 14 ++++++--------
libc/src/__support/math/frexpf128.h | 12 ++++--------
libc/src/__support/math/ilogbf128.h | 13 ++++---------
libc/src/__support/math/llogbf128.h | 13 ++++---------
libc/src/__support/math/logbf128.h | 13 ++++---------
libc/src/math/frexpf128.h | 5 +++++
libc/src/math/generic/CMakeLists.txt | 4 ++++
libc/src/math/generic/frexpf128.cpp | 7 +++++--
libc/src/math/generic/ilogbf128.cpp | 7 ++++++-
libc/src/math/generic/llogbf128.cpp | 7 ++++++-
libc/src/math/generic/logbf128.cpp | 5 ++++-
libc/src/math/ilogbf128.h | 5 +++++
libc/src/math/llogbf128.h | 5 +++++
libc/src/math/logbf128.h | 5 +++++
libc/test/shared/shared_math_test.cpp | 18 +++++++++---------
32 files changed, 126 insertions(+), 113 deletions(-)
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index a85fa19a92fccf..5e54a56d07ab22 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -473,6 +473,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fmull
libc.src.math.frexp
libc.src.math.frexpf
+ libc.src.math.frexpf128
libc.src.math.frexpl
libc.src.math.fromfp
libc.src.math.fromfpf
@@ -491,6 +492,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.hypotf
libc.src.math.ilogb
libc.src.math.ilogbf
+ libc.src.math.ilogbf128
libc.src.math.ilogbl
libc.src.math.iscanonical
libc.src.math.iscanonicalf
@@ -510,6 +512,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lgammaf
libc.src.math.llogb
libc.src.math.llogbf
+ libc.src.math.llogbf128
libc.src.math.llogbl
libc.src.math.llrint
libc.src.math.llrintf
@@ -528,6 +531,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.log2f
libc.src.math.logb
libc.src.math.logbf
+ libc.src.math.logbf128
libc.src.math.logbl
libc.src.math.logf
libc.src.math.lrint
@@ -777,16 +781,12 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ffmaf128
libc.src.math.fmodf128
libc.src.math.fmulf128
- libc.src.math.frexpf128
libc.src.math.fromfpf128
libc.src.math.fromfpxf128
libc.src.math.fsqrtf128
libc.src.math.fsubf128
libc.src.math.getpayloadf128
- libc.src.math.ilogbf128
libc.src.math.ldexpf128
- libc.src.math.llogbf128
- libc.src.math.logbf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 87fdcd04652303..1505e251790c67 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -485,6 +485,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fmull
libc.src.math.frexp
libc.src.math.frexpf
+ libc.src.math.frexpf128
libc.src.math.frexpl
libc.src.math.fromfp
libc.src.math.fromfpf
@@ -503,6 +504,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.hypotf
libc.src.math.ilogb
libc.src.math.ilogbf
+ libc.src.math.ilogbf128
libc.src.math.ilogbl
libc.src.math.iscanonical
libc.src.math.iscanonicalf
@@ -522,6 +524,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lgammaf
libc.src.math.llogb
libc.src.math.llogbf
+ libc.src.math.llogbf128
libc.src.math.llogbl
libc.src.math.llrint
libc.src.math.llrintf
@@ -540,6 +543,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.log2f
libc.src.math.logb
libc.src.math.logbf
+ libc.src.math.logbf128
libc.src.math.logbl
libc.src.math.logf
libc.src.math.lrint
@@ -788,16 +792,12 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ffmaf128
libc.src.math.fmodf128
libc.src.math.fmulf128
- libc.src.math.frexpf128
libc.src.math.fromfpf128
libc.src.math.fromfpxf128
libc.src.math.fsqrtf128
libc.src.math.fsubf128
libc.src.math.getpayloadf128
- libc.src.math.ilogbf128
libc.src.math.ldexpf128
- libc.src.math.llogbf128
- libc.src.math.logbf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 19397087f3e92c..b1bfe9e1cf6909 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -476,6 +476,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fmull
libc.src.math.frexp
libc.src.math.frexpf
+ libc.src.math.frexpf128
libc.src.math.frexpl
libc.src.math.fromfp
libc.src.math.fromfpf
@@ -494,6 +495,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.hypotf
libc.src.math.ilogb
libc.src.math.ilogbf
+ libc.src.math.ilogbf128
libc.src.math.ilogbl
libc.src.math.iscanonical
libc.src.math.iscanonicalf
@@ -513,6 +515,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lgammaf
libc.src.math.llogb
libc.src.math.llogbf
+ libc.src.math.llogbf128
libc.src.math.llogbl
libc.src.math.llrint
libc.src.math.llrintf
@@ -531,6 +534,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.log2f
libc.src.math.logb
libc.src.math.logbf
+ libc.src.math.logbf128
libc.src.math.logbl
libc.src.math.logf
libc.src.math.lrint
@@ -780,16 +784,12 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ffmaf128
# libc.src.math.fmodf128
libc.src.math.fmulf128
- libc.src.math.frexpf128
libc.src.math.fromfpf128
libc.src.math.fromfpxf128
libc.src.math.fsqrtf128
libc.src.math.fsubf128
libc.src.math.getpayloadf128
- libc.src.math.ilogbf128
libc.src.math.ldexpf128
- libc.src.math.llogbf128
- libc.src.math.logbf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index 5600b82ad3410b..92eac9f5b1190c 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -294,6 +294,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fmull
libc.src.math.frexp
libc.src.math.frexpf
+ libc.src.math.frexpf128
libc.src.math.frexpl
libc.src.math.fromfp
libc.src.math.fromfpf
@@ -312,6 +313,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.hypotf
libc.src.math.ilogb
libc.src.math.ilogbf
+ libc.src.math.ilogbf128
libc.src.math.ilogbl
libc.src.math.iscanonical
libc.src.math.iscanonicalf
@@ -331,6 +333,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lgammaf
libc.src.math.llogb
libc.src.math.llogbf
+ libc.src.math.llogbf128
libc.src.math.llogbl
libc.src.math.llrint
libc.src.math.llrintf
@@ -349,6 +352,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.log2f
libc.src.math.logb
libc.src.math.logbf
+ libc.src.math.logbf128
libc.src.math.logbl
libc.src.math.logf
libc.src.math.lrint
@@ -599,16 +603,12 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ffmaf128
libc.src.math.fmodf128
libc.src.math.fmulf128
- libc.src.math.frexpf128
libc.src.math.fromfpf128
libc.src.math.fromfpxf128
libc.src.math.fsqrtf128
libc.src.math.fsubf128
libc.src.math.getpayloadf128
- libc.src.math.ilogbf128
libc.src.math.ldexpf128
- libc.src.math.llogbf128
- libc.src.math.logbf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index e3fc845d2ed3af..33eabf5a9b0d0a 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -176,6 +176,7 @@ set(TARGET_LIBM_ENTRYPOINTS
#libc.src.math.fmodf
#libc.src.math.frexp
#libc.src.math.frexpf
+ #libc.src.math.frexpf128
#libc.src.math.frexpl
#libc.src.math.fsub
#libc.src.math.fsubl
@@ -183,6 +184,7 @@ set(TARGET_LIBM_ENTRYPOINTS
#libc.src.math.hypotf
#libc.src.math.ilogb
#libc.src.math.ilogbf
+ #libc.src.math.ilogbf128
#libc.src.math.ilogbl
#libc.src.math.iscanonicalf128
#libc.src.math.isnanf128
@@ -212,6 +214,7 @@ set(TARGET_LIBM_ENTRYPOINTS
#libc.src.math.logf
#libc.src.math.logb
#libc.src.math.logbf
+ #libc.src.math.logbf128
#libc.src.math.logbl
#libc.src.math.modf
#libc.src.math.modff
diff --git a/libc/config/freebsd/x86_64/entrypoints.txt b/libc/config/freebsd/x86_64/entrypoints.txt
index 8f6c178301c2f2..5b315f0432a5b1 100644
--- a/libc/config/freebsd/x86_64/entrypoints.txt
+++ b/libc/config/freebsd/x86_64/entrypoints.txt
@@ -220,6 +220,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fmodl
libc.src.math.frexp
libc.src.math.frexpf
+ libc.src.math.frexpf128
libc.src.math.frexpl
libc.src.math.fsub
libc.src.math.fsubl
@@ -227,6 +228,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.hypotf
libc.src.math.ilogb
libc.src.math.ilogbf
+ libc.src.math.ilogbf128
libc.src.math.ilogbl
libc.src.math.iscanonicalf128
libc.src.math.isnanf128
@@ -253,6 +255,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.logf
libc.src.math.logb
libc.src.math.logbf
+ libc.src.math.logbf128
libc.src.math.logbl
libc.src.math.lrint
libc.src.math.lrintf
@@ -359,6 +362,7 @@ list(APPEND TARGET_LIBM_ENTRYPOINTS
libc.src.math.issignalingl
libc.src.math.llogb
libc.src.math.llogbf
+ libc.src.math.llogbf128
libc.src.math.llogbl
libc.src.math.nextdown
libc.src.math.nextdownf
@@ -532,16 +536,12 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ffmaf128
libc.src.math.fmodf128
libc.src.math.fmulf128
- libc.src.math.frexpf128
libc.src.math.fromfpf128
libc.src.math.fromfpxf128
libc.src.math.fsqrtf128
libc.src.math.fsubf128
libc.src.math.getpayloadf128
- libc.src.math.ilogbf128
libc.src.math.ldexpf128
- libc.src.math.llogbf128
- libc.src.math.logbf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index 2eaef608e9a7ac..2f11e6591b795a 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -415,6 +415,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fmull
libc.src.math.frexp
libc.src.math.frexpf
+ libc.src.math.frexpf128
libc.src.math.frexpl
libc.src.math.fromfp
libc.src.math.fromfpf
@@ -433,6 +434,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.hypotf
libc.src.math.ilogb
libc.src.math.ilogbf
+ libc.src.math.ilogbf128
libc.src.math.ilogbl
libc.src.math.iscanonicalf128
libc.src.math.isnan
@@ -448,6 +450,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lgammaf
libc.src.math.llogb
libc.src.math.llogbf
+ libc.src.math.llogbf128
libc.src.math.llogbl
libc.src.math.llrint
libc.src.math.llrintf
@@ -466,6 +469,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.log2f
libc.src.math.logb
libc.src.math.logbf
+ libc.src.math.logbf128
libc.src.math.logbl
libc.src.math.logf
libc.src.math.lrint
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index 79d0c733ec3c01..5f50e4f989402d 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -411,6 +411,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fmull
libc.src.math.frexp
libc.src.math.frexpf
+ libc.src.math.frexpf128
libc.src.math.frexpl
# FIXME: Broken.
# libc.src.math.fromfp
@@ -430,6 +431,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.hypotf
libc.src.math.ilogb
libc.src.math.ilogbf
+ libc.src.math.ilogbf128
libc.src.math.ilogbl
libc.src.math.iscanonicalf128
libc.src.math.isnan
@@ -445,6 +447,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lgammaf
libc.src.math.llogb
libc.src.math.llogbf
+ libc.src.math.llogbf128
libc.src.math.llogbl
libc.src.math.llrint
libc.src.math.llrintf
@@ -463,6 +466,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.log2f
libc.src.math.logb
libc.src.math.logbf
+ libc.src.math.logbf128
libc.src.math.logbl
libc.src.math.logf
libc.src.math.lrint
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index b2c8d62a65f4e1..251750f0f0f3ff 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -714,6 +714,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fmull
libc.src.math.frexp
libc.src.math.frexpf
+ libc.src.math.frexpf128
libc.src.math.frexpl
libc.src.math.fromfp
libc.src.math.fromfpf
@@ -732,6 +733,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.hypotf
libc.src.math.ilogb
libc.src.math.ilogbf
+ libc.src.math.ilogbf128
libc.src.math.ilogbl
libc.src.math.iscanonical
libc.src.math.iscanonicalf
@@ -751,6 +753,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lgammaf
libc.src.math.llogb
libc.src.math.llogbf
+ libc.src.math.llogbf128
libc.src.math.llogbl
libc.src.math.llrint
libc.src.math.llrintf
@@ -769,6 +772,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.log2f
libc.src.math.logb
libc.src.math.logbf
+ libc.src.math.logbf128
libc.src.math.logbl
libc.src.math.logf
libc.src.math.lrint
@@ -1012,16 +1016,12 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ffmaf128
libc.src.math.fmodf128
libc.src.math.fmulf128
- libc.src.math.frexpf128
libc.src.math.fromfpf128
libc.src.math.fromfpxf128
libc.src.math.fsqrtf128
libc.src.math.fsubf128
libc.src.math.getpayloadf128
- libc.src.math.ilogbf128
libc.src.math.ldexpf128
- libc.src.math.llogbf128
- libc.src.math.logbf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 023d298170c245..2d490693c6f84a 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -505,6 +505,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fmul
libc.src.math.frexp
libc.src.math.frexpf
+ libc.src.math.frexpf128
libc.src.math.frexpl
libc.src.math.fromfp
libc.src.math.fromfpf
@@ -521,6 +522,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.hypotf
libc.src.math.ilogb
libc.src.math.ilogbf
+ libc.src.math.ilogbf128
libc.src.math.ilogbl
libc.src.math.iscanonicalf128
libc.src.math.isnanf128
@@ -531,6 +533,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lgammaf
libc.src.math.llogb
libc.src.math.llogbf
+ libc.src.math.llogbf128
libc.src.math.llogbl
libc.src.math.llrint
libc.src.math.llrintf
@@ -549,6 +552,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.log2f
libc.src.math.logb
libc.src.math.logbf
+ libc.src.math.logbf128
libc.src.math.logbl
libc.src.math.logf
libc.src.math.lrint
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 3bdc686c0e4ce4..d15a219445d1b0 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -771,6 +771,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fmull
libc.src.math.frexp
libc.src.math.frexpf
+ libc.src.math.frexpf128
libc.src.math.frexpl
libc.src.math.fromfp
libc.src.math.fromfpf
@@ -789,6 +790,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.hypotf
libc.src.math.ilogb
libc.src.math.ilogbf
+ libc.src.math.ilogbf128
libc.src.math.ilogbl
libc.src.math.iscanonical
libc.src.math.iscanonicalf
@@ -808,6 +810,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lgammaf
libc.src.math.llogb
libc.src.math.llogbf
+ libc.src.math.llogbf128
libc.src.math.llogbl
libc.src.math.llrint
libc.src.math.llrintf
@@ -826,6 +829,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.log2f
libc.src.math.logb
libc.src.math.logbf
+ libc.src.math.logbf128
libc.src.math.logbl
libc.src.math.logf
libc.src.math.lrint
@@ -1086,16 +1090,12 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ffmaf128
libc.src.math.fmodf128
libc.src.math.fmulf128
- libc.src.math.frexpf128
libc.src.math.fromfpf128
libc.src.math.fromfpxf128
libc.src.math.fsqrtf128
libc.src.math.fsubf128
libc.src.math.getpayloadf128
- libc.src.math.ilogbf128
libc.src.math.ldexpf128
- libc.src.math.llogbf128
- libc.src.math.logbf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 23a588f65d7435..df2241a4be6514 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -793,6 +793,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fmull
libc.src.math.frexp
libc.src.math.frexpf
+ libc.src.math.frexpf128
libc.src.math.frexpl
libc.src.math.fromfp
libc.src.math.fromfpf
@@ -811,6 +812,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.hypotf
libc.src.math.ilogb
libc.src.math.ilogbf
+ libc.src.math.ilogbf128
libc.src.math.ilogbl
libc.src.math.iscanonical
libc.src.math.iscanonicalf
@@ -830,6 +832,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.lgammaf
libc.src.math.llogb
libc.src.math.llogbf
+ libc.src.math.llogbf128
libc.src.math.llogbl
libc.src.math.llrint
libc.src.math.llrintf
@@ -848,6 +851,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.log2f
libc.src.math.logb
libc.src.math.logbf
+ libc.src.math.logbf128
libc.src.math.logbl
libc.src.math.logf
libc.src.math.lrint
@@ -1108,16 +1112,12 @@ if(LIBC_TYPES_HAS_NATIVE_FLOAT128)
libc.src.math.ffmaf128
libc.src.math.fmodf128
libc.src.math.fmulf128
- libc.src.math.frexpf128
libc.src.math.fromfpf128
libc.src.math.fromfpxf128
libc.src.math.fsqrtf128
libc.src.math.fsubf128
libc.src.math.getpayloadf128
- libc.src.math.ilogbf128
libc.src.math.ldexpf128
- libc.src.math.llogbf128
- libc.src.math.logbf128
libc.src.math.modff128
libc.src.math.nanf128
libc.src.math.nextafterf128
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index 1712b2ad26fda4..88f05cfa5889b3 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -253,6 +253,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.fmodl
libc.src.math.frexp
libc.src.math.frexpf
+ libc.src.math.frexpf128
libc.src.math.frexpl
libc.src.math.fsub
libc.src.math.fsubl
@@ -260,6 +261,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.hypotf
libc.src.math.ilogb
libc.src.math.ilogbf
+ libc.src.math.ilogbf128
libc.src.math.ilogbl
libc.src.math.iscanonicalf128
libc.src.math.isnanf128
@@ -286,6 +288,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.logf
libc.src.math.logb
libc.src.math.logbf
+ libc.src.math.logbf128
libc.src.math.logbl
libc.src.math.lrint
libc.src.math.lrintf
diff --git a/libc/shared/math/frexpf128.h b/libc/shared/math/frexpf128.h
index 13b48635a77ba4..4815fa33a874bd 100644
--- a/libc/shared/math/frexpf128.h
+++ b/libc/shared/math/frexpf128.h
@@ -9,10 +9,6 @@
#ifndef LLVM_LIBC_SHARED_MATH_FREXPF128_H
#define LLVM_LIBC_SHARED_MATH_FREXPF128_H
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#include "shared/libc_common.h"
#include "src/__support/math/frexpf128.h"
@@ -24,6 +20,4 @@ using math::frexpf128;
} // namespace shared
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SHARED_MATH_FREXPF128_H
diff --git a/libc/shared/math/ilogbf128.h b/libc/shared/math/ilogbf128.h
index 072cd1bbb7711a..e6a9d32f2464bb 100644
--- a/libc/shared/math/ilogbf128.h
+++ b/libc/shared/math/ilogbf128.h
@@ -9,10 +9,6 @@
#ifndef LLVM_LIBC_SHARED_MATH_ILOGBF128_H
#define LLVM_LIBC_SHARED_MATH_ILOGBF128_H
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#include "shared/libc_common.h"
#include "src/__support/math/ilogbf128.h"
@@ -24,6 +20,4 @@ using math::ilogbf128;
} // namespace shared
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SHARED_MATH_ILOGBF128_H
diff --git a/libc/shared/math/llogbf128.h b/libc/shared/math/llogbf128.h
index f6f945c372f1e5..4bf4b290819873 100644
--- a/libc/shared/math/llogbf128.h
+++ b/libc/shared/math/llogbf128.h
@@ -9,10 +9,6 @@
#ifndef LLVM_LIBC_SHARED_MATH_LLOGBF128_H
#define LLVM_LIBC_SHARED_MATH_LLOGBF128_H
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#include "shared/libc_common.h"
#include "src/__support/math/llogbf128.h"
@@ -24,6 +20,4 @@ using math::llogbf128;
} // namespace shared
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SHARED_MATH_LLOGBF128_H
diff --git a/libc/shared/math/logbf128.h b/libc/shared/math/logbf128.h
index 95c37fe88b8cd5..7549b41c1f8210 100644
--- a/libc/shared/math/logbf128.h
+++ b/libc/shared/math/logbf128.h
@@ -9,10 +9,6 @@
#ifndef LLVM_LIBC_SHARED_MATH_LOGBF128_H
#define LLVM_LIBC_SHARED_MATH_LOGBF128_H
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#include "shared/libc_common.h"
#include "src/__support/math/logbf128.h"
@@ -24,6 +20,4 @@ using math::logbf128;
} // namespace shared
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SHARED_MATH_LOGBF128_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index baac96e76d5435..f4b8149c4c80d7 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -3874,7 +3874,7 @@ add_header_library(
HDRS
frexpf128.h
DEPENDS
- libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.float128
libc.src.__support.FPUtil.manipulation_functions
)
@@ -4059,9 +4059,8 @@ add_header_library(
HDRS
ilogbf128.h
DEPENDS
- libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.float128
libc.src.__support.FPUtil.manipulation_functions
- libc.include.llvm-libc-types.float128
)
add_header_library(
@@ -4128,9 +4127,8 @@ add_header_library(
HDRS
ldexpf128.h
DEPENDS
- libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.float128
libc.src.__support.FPUtil.manipulation_functions
- libc.include.llvm-libc-types.float128
)
add_header_library(
@@ -4138,9 +4136,9 @@ add_header_library(
HDRS
llogbf128.h
DEPENDS
- libc.src.__support.macros.config
+ libc.src.__support.FPUtil.float128
libc.src.__support.FPUtil.manipulation_functions
- libc.include.llvm-libc-types.float128
+ libc.src.__support.macros.config
)
add_header_library(
@@ -5400,8 +5398,8 @@ add_header_library(
HDRS
logbf128.h
DEPENDS
+ libc.src.__support.FPUtil.float128
libc.src.__support.FPUtil.manipulation_functions
- libc.src.__support.macros.properties.types
)
add_header_library(
diff --git a/libc/src/__support/math/frexpf128.h b/libc/src/__support/math/frexpf128.h
index a16e401889cb36..6a3d8469b36abd 100644
--- a/libc/src/__support/math/frexpf128.h
+++ b/libc/src/__support/math/frexpf128.h
@@ -9,19 +9,17 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_FREXPF128_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_FREXPF128_H
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/FPUtil/float128.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
-
namespace math {
-LIBC_INLINE constexpr float128 frexpf128(float128 x, int *exp) {
+using LIBC_NAMESPACE::fputil::Float128;
+
+LIBC_INLINE constexpr Float128 frexpf128(Float128 x, int *exp) {
return fputil::frexp(x, *exp);
}
@@ -29,6 +27,4 @@ LIBC_INLINE constexpr float128 frexpf128(float128 x, int *exp) {
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_FREXPF128_H
diff --git a/libc/src/__support/math/ilogbf128.h b/libc/src/__support/math/ilogbf128.h
index 9ea71fc47c7b50..dee818dc6ab96d 100644
--- a/libc/src/__support/math/ilogbf128.h
+++ b/libc/src/__support/math/ilogbf128.h
@@ -9,26 +9,21 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_ILOGBF128_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_ILOGBF128_H
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/FPUtil/float128.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
-
namespace math {
-LIBC_INLINE constexpr int ilogbf128(float128 x) {
+using LIBC_NAMESPACE::fputil::Float128;
+
+LIBC_INLINE constexpr int ilogbf128(Float128 x) {
return fputil::intlogb<int>(x);
}
} // namespace math
-
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_ILOGBF128_H
diff --git a/libc/src/__support/math/llogbf128.h b/libc/src/__support/math/llogbf128.h
index da925e81d1aa52..38b0b60217a87d 100644
--- a/libc/src/__support/math/llogbf128.h
+++ b/libc/src/__support/math/llogbf128.h
@@ -9,26 +9,21 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_LLOGBF128_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_LLOGBF128_H
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/FPUtil/float128.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
-
namespace math {
-LIBC_INLINE constexpr long llogbf128(float128 x) {
+using LIBC_NAMESPACE::fputil::Float128;
+
+LIBC_INLINE constexpr long llogbf128(Float128 x) {
return fputil::intlogb<long>(x);
}
} // namespace math
-
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_LLOGBF128_H
diff --git a/libc/src/__support/math/logbf128.h b/libc/src/__support/math/logbf128.h
index f4671c0a944273..756d7beec70945 100644
--- a/libc/src/__support/math/logbf128.h
+++ b/libc/src/__support/math/logbf128.h
@@ -9,24 +9,19 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_LOGBF128_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_LOGBF128_H
-#include "include/llvm-libc-types/float128.h"
-
-#ifdef LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/FPUtil/float128.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
-
namespace math {
-LIBC_INLINE constexpr float128 logbf128(float128 x) { return fputil::logb(x); }
+using LIBC_NAMESPACE::fputil::Float128;
-} // namespace math
+LIBC_INLINE constexpr Float128 logbf128(Float128 x) { return fputil::logb(x); }
+} // namespace math
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
-
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_LOGBF128_H
diff --git a/libc/src/math/frexpf128.h b/libc/src/math/frexpf128.h
index e143e6f17ffb31..37db941516a7f8 100644
--- a/libc/src/math/frexpf128.h
+++ b/libc/src/math/frexpf128.h
@@ -9,11 +9,16 @@
#ifndef LLVM_LIBC_SRC_MATH_FREXPF128_H
#define LLVM_LIBC_SRC_MATH_FREXPF128_H
+#include "src/__support/FPUtil/float128.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
+#ifndef LIBC_TYPES_HAS_NATIVE_FLOAT128
+using float128 = LIBC_NAMESPACE::fputil::Float128;
+#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
+
float128 frexpf128(float128 x, int *exp);
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 17f586036396f1..29f25f51969ab3 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -1537,6 +1537,7 @@ add_entrypoint_object(
HDRS
../frexpf128.h
DEPENDS
+ libc.src.__support.CPP.bit
libc.src.__support.math.frexpf128
)
@@ -1598,6 +1599,7 @@ add_entrypoint_object(
HDRS
../ilogbf128.h
DEPENDS
+ libc.src.__support.CPP.bit
libc.src.__support.math.ilogbf128
)
@@ -1685,6 +1687,7 @@ add_entrypoint_object(
HDRS
../llogbf128.h
DEPENDS
+ libc.src.__support.CPP.bit
libc.src.__support.math.llogbf128
)
@@ -1952,6 +1955,7 @@ add_entrypoint_object(
HDRS
../logbf128.h
DEPENDS
+ libc.src.__support.CPP.bit
libc.src.__support.math.logbf128
libc.src.errno.errno
)
diff --git a/libc/src/math/generic/frexpf128.cpp b/libc/src/math/generic/frexpf128.cpp
index 55f7afcf4aea55..ebdd46ae4573f9 100644
--- a/libc/src/math/generic/frexpf128.cpp
+++ b/libc/src/math/generic/frexpf128.cpp
@@ -7,13 +7,16 @@
//===----------------------------------------------------------------------===//
#include "src/math/frexpf128.h"
-
+#include "src/__support/CPP/bit.h"
#include "src/__support/math/frexpf128.h"
namespace LIBC_NAMESPACE_DECL {
+using LIBC_NAMESPACE::fputil::Float128;
+
LLVM_LIBC_FUNCTION(float128, frexpf128, (float128 x, int *exp)) {
- return math::frexpf128(x, exp);
+ return cpp::bit_cast<float128>(
+ math::frexpf128(cpp::bit_cast<Float128>(x), exp));
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/ilogbf128.cpp b/libc/src/math/generic/ilogbf128.cpp
index 2cb6032dfdbb85..cebb08ebea489c 100644
--- a/libc/src/math/generic/ilogbf128.cpp
+++ b/libc/src/math/generic/ilogbf128.cpp
@@ -7,10 +7,15 @@
//===----------------------------------------------------------------------===//
#include "src/math/ilogbf128.h"
+#include "src/__support/CPP/bit.h"
#include "src/__support/math/ilogbf128.h"
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(int, ilogbf128, (float128 x)) { return math::ilogbf128(x); }
+using LIBC_NAMESPACE::fputil::Float128;
+
+LLVM_LIBC_FUNCTION(int, ilogbf128, (float128 x)) {
+ return math::ilogbf128(cpp::bit_cast<Float128>(x));
+}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/llogbf128.cpp b/libc/src/math/generic/llogbf128.cpp
index 6f8f9c4c853b8e..cc81f3a4a55f71 100644
--- a/libc/src/math/generic/llogbf128.cpp
+++ b/libc/src/math/generic/llogbf128.cpp
@@ -7,10 +7,15 @@
//===----------------------------------------------------------------------===//
#include "src/math/llogbf128.h"
+#include "src/__support/CPP/bit.h"
#include "src/__support/math/llogbf128.h"
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(long, llogbf128, (float128 x)) { return math::llogbf128(x); }
+using LIBC_NAMESPACE::fputil::Float128;
+
+LLVM_LIBC_FUNCTION(long, llogbf128, (float128 x)) {
+ return math::llogbf128(cpp::bit_cast<Float128>(x));
+}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/logbf128.cpp b/libc/src/math/generic/logbf128.cpp
index e70a04c6aa1002..b5744f0a8a36c4 100644
--- a/libc/src/math/generic/logbf128.cpp
+++ b/libc/src/math/generic/logbf128.cpp
@@ -7,12 +7,15 @@
//===----------------------------------------------------------------------===//
#include "src/math/logbf128.h"
+#include "src/__support/CPP/bit.h"
#include "src/__support/math/logbf128.h"
namespace LIBC_NAMESPACE_DECL {
+using LIBC_NAMESPACE::fputil::Float128;
+
LLVM_LIBC_FUNCTION(float128, logbf128, (float128 x)) {
- return math::logbf128(x);
+ return cpp::bit_cast<float128>(math::logbf128(cpp::bit_cast<Float128>(x)));
}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/ilogbf128.h b/libc/src/math/ilogbf128.h
index 9ea5e89fdf9930..f102dbe097d333 100644
--- a/libc/src/math/ilogbf128.h
+++ b/libc/src/math/ilogbf128.h
@@ -9,11 +9,16 @@
#ifndef LLVM_LIBC_SRC_MATH_ILOGBF128_H
#define LLVM_LIBC_SRC_MATH_ILOGBF128_H
+#include "src/__support/FPUtil/float128.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
+#ifndef LIBC_TYPES_HAS_NATIVE_FLOAT128
+using float128 = LIBC_NAMESPACE::fputil::Float128;
+#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
+
int ilogbf128(float128 x);
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/llogbf128.h b/libc/src/math/llogbf128.h
index 1ad49320202573..06553f9d12f3ba 100644
--- a/libc/src/math/llogbf128.h
+++ b/libc/src/math/llogbf128.h
@@ -9,11 +9,16 @@
#ifndef LLVM_LIBC_SRC_MATH_LLOGBF128_H
#define LLVM_LIBC_SRC_MATH_LLOGBF128_H
+#include "src/__support/FPUtil/float128.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
+#ifndef LIBC_TYPES_HAS_NATIVE_FLOAT128
+using float128 = LIBC_NAMESPACE::fputil::Float128;
+#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
+
long llogbf128(float128 x);
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/logbf128.h b/libc/src/math/logbf128.h
index 9ce23978707be4..366989810b8a2e 100644
--- a/libc/src/math/logbf128.h
+++ b/libc/src/math/logbf128.h
@@ -9,11 +9,16 @@
#ifndef LLVM_LIBC_SRC_MATH_LOGBF128_H
#define LLVM_LIBC_SRC_MATH_LOGBF128_H
+#include "src/__support/FPUtil/float128.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
+#ifndef LIBC_TYPES_HAS_NATIVE_FLOAT128
+using float128 = LIBC_NAMESPACE::fputil::Float128;
+#endif // LIBC_TYPES_HAS_NATIVE_FLOAT128
+
float128 logbf128(float128 x);
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 5b6663fa6494f6..9172279a5f6689 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -581,6 +581,8 @@ TEST(LlvmLibcSharedMathTest, AllLongDouble) {
// Emulated float128 tests
TEST(LlvmLibcSharedMathTest, AllEmuFloat128) {
+ int exponent;
+
EXPECT_FP_EQ(Float128(0.0),
LIBC_NAMESPACE::shared::atan2f128(Float128(0.0), Float128(0.0)));
EXPECT_FP_EQ(Float128(0.0), LIBC_NAMESPACE::shared::ceilf128(Float128(0.0)));
@@ -590,6 +592,9 @@ TEST(LlvmLibcSharedMathTest, AllEmuFloat128) {
EXPECT_FP_EQ(Float128(0.0),
LIBC_NAMESPACE::shared::fdimf128(Float128(0.0), Float128(0.0)));
EXPECT_FP_EQ(Float128(0.0), LIBC_NAMESPACE::shared::floorf128(Float128(0.0)));
+ EXPECT_FP_EQ_ALL_ROUNDING(Float128(0.75), LIBC_NAMESPACE::shared::frexpf128(
+ Float128(24), &exponent));
+ EXPECT_EQ(exponent, 5);
EXPECT_FP_EQ(Float128(0.0),
LIBC_NAMESPACE::shared::fmaxf128(Float128(0.0), Float128(0.0)));
EXPECT_FP_EQ(Float128(0.0),
@@ -610,13 +615,17 @@ TEST(LlvmLibcSharedMathTest, AllEmuFloat128) {
Float128(0.0), Float128(0.0)));
EXPECT_FP_EQ(Float128(0.0), LIBC_NAMESPACE::shared::fminimum_numf128(
Float128(0.0), Float128(0.0)));
+ EXPECT_EQ(0, LIBC_NAMESPACE::shared::ilogbf128(Float128(1.0)));
EXPECT_EQ(1, LIBC_NAMESPACE::shared::iscanonicalf128(Float128(0.0)));
EXPECT_EQ(0, LIBC_NAMESPACE::shared::isnanf128(Float128(0.0)));
EXPECT_EQ(0, LIBC_NAMESPACE::shared::issignalingf128(Float128(0.0)));
+ EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogbf128(Float128(1.0)));
EXPECT_EQ(0LL, LIBC_NAMESPACE::shared::llrintf128(Float128(0.0)));
EXPECT_EQ(0LL, LIBC_NAMESPACE::shared::llroundf128(Float128(0.0)));
EXPECT_EQ(0L, LIBC_NAMESPACE::shared::lrintf128(Float128(0.0)));
EXPECT_EQ(0L, LIBC_NAMESPACE::shared::lroundf128(Float128(0.0)));
+ EXPECT_FP_EQ(Float128(0.0),
+ LIBC_NAMESPACE::shared::logbf128(Float128(1.0)));
EXPECT_FP_EQ(Float128(0.0),
LIBC_NAMESPACE::shared::nearbyintf128(Float128(0.0)));
EXPECT_FP_EQ(Float128(0.0), LIBC_NAMESPACE::shared::rintf128(Float128(0.0)));
@@ -631,27 +640,18 @@ TEST(LlvmLibcSharedMathTest, AllEmuFloat128) {
TEST(LlvmLibcSharedMathTest, AllFloat128) {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<float128>;
- int exponent;
EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::shared::ffmaf128(
float128(0.0), float128(0.0), float128(0.0)));
EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::shared::fsqrtf128(float128(1.0f)));
- EXPECT_FP_EQ_ALL_ROUNDING(float128(0.75), LIBC_NAMESPACE::shared::frexpf128(
- float128(24), &exponent));
- EXPECT_EQ(exponent, 5);
-
- EXPECT_EQ(3, LIBC_NAMESPACE::shared::ilogbf128(float128(8.0)));
ASSERT_FP_EQ(float128(8 << 5),
LIBC_NAMESPACE::shared::ldexpf128(float128(8), 5));
ASSERT_FP_EQ(float128(-1 * (8 << 5)),
LIBC_NAMESPACE::shared::ldexpf128(float128(-8), 5));
- EXPECT_FP_EQ(float128(0.0), LIBC_NAMESPACE::shared::logbf128(float128(1.0)));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::dfmaf128(
float128(0.0), float128(0.0), float128(0.0)));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::dsqrtf128(float128(0.0)));
- EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogbf128(float128(1.0)));
-
EXPECT_FP_EQ(bfloat16(5.0), LIBC_NAMESPACE::shared::bf16addf128(
float128(2.0), float128(3.0)));
>From 79c0a6cbcc989bf5e8da1098a18608195ad26e23 Mon Sep 17 00:00:00 2001
From: Harikrishna S <harikrishnas.x at gmail.com>
Date: Sun, 25 Oct 2026 20:00:37 +0530
Subject: [PATCH 2/2] ran clang-format
---
libc/test/shared/shared_math_test.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 9172279a5f6689..904ec61f29697a 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -624,8 +624,7 @@ TEST(LlvmLibcSharedMathTest, AllEmuFloat128) {
EXPECT_EQ(0LL, LIBC_NAMESPACE::shared::llroundf128(Float128(0.0)));
EXPECT_EQ(0L, LIBC_NAMESPACE::shared::lrintf128(Float128(0.0)));
EXPECT_EQ(0L, LIBC_NAMESPACE::shared::lroundf128(Float128(0.0)));
- EXPECT_FP_EQ(Float128(0.0),
- LIBC_NAMESPACE::shared::logbf128(Float128(1.0)));
+ EXPECT_FP_EQ(Float128(0.0), LIBC_NAMESPACE::shared::logbf128(Float128(1.0)));
EXPECT_FP_EQ(Float128(0.0),
LIBC_NAMESPACE::shared::nearbyintf128(Float128(0.0)));
EXPECT_FP_EQ(Float128(0.0), LIBC_NAMESPACE::shared::rintf128(Float128(0.0)));
More information about the libc-commits
mailing list