[libc-commits] [libc] [libc][math] Remove direct call to generic support headers to maintain platform specificity. (PR #178543)

Muhammad Bassiouni via libc-commits libc-commits at lists.llvm.org
Wed Jan 28 15:46:21 PST 2026


https://github.com/bassiounix created https://github.com/llvm/llvm-project/pull/178543

None

>From 3216d366e8e8c8f58377b54ec7f6d9d037b98361 Mon Sep 17 00:00:00 2001
From: bassiounix <muhammad.m.bassiouni at gmail.com>
Date: Thu, 29 Jan 2026 01:16:37 +0200
Subject: [PATCH] [libc][math] Remove direct call to generic support headers to
 maintain platform specificity.

---
 libc/src/__support/math/CMakeLists.txt | 10 +++++-----
 libc/src/__support/math/dsqrtl.h       |  4 ++--
 libc/src/__support/math/fsqrt.h        |  6 ++----
 libc/src/__support/math/fsqrtf128.h    |  4 ++--
 libc/src/__support/math/fsqrtl.h       |  4 ++--
 5 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index c1bd566c1efcd..9ac8e820b9cf6 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -471,7 +471,7 @@ add_header_library(
   HDRS
     dsqrtl.h
   DEPENDS
-    libc.src.__support.FPUtil.generic.sqrt
+    libc.src.__support.FPUtil.sqrt
 )
 
 add_header_library(
@@ -598,7 +598,7 @@ add_header_library(
   HDRS
     f16sqrtl.h
   DEPENDS
-    libc.src.__support.FPUtil.generic.sqrt
+    libc.src.__support.FPUtil.sqrt
     libc.src.__support.macros.properties.types
 )
 
@@ -616,7 +616,7 @@ add_header_library(
   HDRS
     fsqrt.h
   DEPENDS
-    libc.src.__support.FPUtil.generic.sqrt
+    libc.src.__support.FPUtil.sqrt
 )
 
 add_header_library(
@@ -624,7 +624,7 @@ add_header_library(
   HDRS
     fsqrtl.h
   DEPENDS
-    libc.src.__support.FPUtil.generic.sqrt
+    libc.src.__support.FPUtil.sqrt
 )
 
 add_header_library(
@@ -1065,7 +1065,7 @@ add_header_library(
   HDRS
     fsqrtf128.h
   DEPENDS
-    libc.src.__support.FPUtil.generic.sqrt
+    libc.src.__support.FPUtil.sqrt
     libc.src.__support.macros.properties.types
 )
 
diff --git a/libc/src/__support/math/dsqrtl.h b/libc/src/__support/math/dsqrtl.h
index e66b6502d27c4..ddbe6a8f0dc7d 100644
--- a/libc/src/__support/math/dsqrtl.h
+++ b/libc/src/__support/math/dsqrtl.h
@@ -9,13 +9,13 @@
 #ifndef LLVM_LIBC_SRC___SUPPORT_MATH_DSQRTL_H
 #define LLVM_LIBC_SRC___SUPPORT_MATH_DSQRTL_H
 
-#include "src/__support/FPUtil/generic/sqrt.h"
+#include "src/__support/FPUtil/sqrt.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr double dsqrtl(long double x) {
+LIBC_INLINE static double dsqrtl(long double x) {
   return fputil::sqrt<double>(x);
 }
 
diff --git a/libc/src/__support/math/fsqrt.h b/libc/src/__support/math/fsqrt.h
index 8dd6afc7845f0..1d1783c15287d 100644
--- a/libc/src/__support/math/fsqrt.h
+++ b/libc/src/__support/math/fsqrt.h
@@ -9,15 +9,13 @@
 #ifndef LLVM_LIBC_SRC___SUPPORT_MATH_FSQRT_H
 #define LLVM_LIBC_SRC___SUPPORT_MATH_FSQRT_H
 
-#include "src/__support/FPUtil/generic/sqrt.h"
+#include "src/__support/FPUtil/sqrt.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr float fsqrt(double x) {
-  return fputil::sqrt<float>(x);
-}
+LIBC_INLINE static float fsqrt(double x) { return fputil::sqrt<float>(x); }
 
 } // namespace math
 
diff --git a/libc/src/__support/math/fsqrtf128.h b/libc/src/__support/math/fsqrtf128.h
index 8ca274eff6888..6ae3d50175d1d 100644
--- a/libc/src/__support/math/fsqrtf128.h
+++ b/libc/src/__support/math/fsqrtf128.h
@@ -13,7 +13,7 @@
 
 #ifdef LIBC_TYPES_HAS_FLOAT128
 
-#include "src/__support/FPUtil/generic/sqrt.h"
+#include "src/__support/FPUtil/sqrt.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
 
@@ -21,7 +21,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr float fsqrtf128(float128 x) {
+LIBC_INLINE static float fsqrtf128(float128 x) {
   return fputil::sqrt<float>(x);
 }
 
diff --git a/libc/src/__support/math/fsqrtl.h b/libc/src/__support/math/fsqrtl.h
index 3033f0a5242f3..0dc5d0abd65a6 100644
--- a/libc/src/__support/math/fsqrtl.h
+++ b/libc/src/__support/math/fsqrtl.h
@@ -9,13 +9,13 @@
 #ifndef LLVM_LIBC_SRC___SUPPORT_MATH_FSQRTL_H
 #define LLVM_LIBC_SRC___SUPPORT_MATH_FSQRTL_H
 
-#include "src/__support/FPUtil/generic/sqrt.h"
+#include "src/__support/FPUtil/sqrt.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr float fsqrtl(long double x) {
+LIBC_INLINE static float fsqrtl(long double x) {
   return fputil::sqrt<float>(x);
 }
 



More information about the libc-commits mailing list