[libc-commits] [libc] Add generic sqrt root headers to libc sqrt specializations (PR #135237)

Drew Lewis via libc-commits libc-commits at lists.llvm.org
Thu Apr 10 12:00:25 PDT 2025


https://github.com/calewis created https://github.com/llvm/llvm-project/pull/135237

This header is needed to provide the declaration for the sqrt template.  You can build without these in the CMake build, but not having this include in the architecture specific headers makes them not self contained.  

>From 0a5e53f7fcb752cbe1609dd426e678db448d6b2b Mon Sep 17 00:00:00 2001
From: Drew Lewis <cannada at google.com>
Date: Thu, 10 Apr 2025 18:58:13 +0000
Subject: [PATCH] Add generic sqrt root headers to libc sqrt specializations

---
 libc/src/__support/FPUtil/aarch64/sqrt.h | 2 ++
 libc/src/__support/FPUtil/arm/sqrt.h     | 2 ++
 libc/src/__support/FPUtil/riscv/sqrt.h   | 2 ++
 libc/src/__support/FPUtil/x86_64/sqrt.h  | 2 ++
 4 files changed, 8 insertions(+)

diff --git a/libc/src/__support/FPUtil/aarch64/sqrt.h b/libc/src/__support/FPUtil/aarch64/sqrt.h
index 2bda8e895b375..4eb576bf2244c 100644
--- a/libc/src/__support/FPUtil/aarch64/sqrt.h
+++ b/libc/src/__support/FPUtil/aarch64/sqrt.h
@@ -18,6 +18,8 @@
 #error "Invalid include"
 #endif
 
+#include "src/__support/FPUtil/generic/sqrt.h"
+
 namespace LIBC_NAMESPACE_DECL {
 namespace fputil {
 
diff --git a/libc/src/__support/FPUtil/arm/sqrt.h b/libc/src/__support/FPUtil/arm/sqrt.h
index 497dbc504b79f..e6cb58c0be817 100644
--- a/libc/src/__support/FPUtil/arm/sqrt.h
+++ b/libc/src/__support/FPUtil/arm/sqrt.h
@@ -18,6 +18,8 @@
 #error "Invalid include"
 #endif
 
+#include "src/__support/FPUtil/generic/sqrt.h"
+
 namespace LIBC_NAMESPACE_DECL {
 namespace fputil {
 
diff --git a/libc/src/__support/FPUtil/riscv/sqrt.h b/libc/src/__support/FPUtil/riscv/sqrt.h
index 14a34359ee32b..8cff03a9fc73e 100644
--- a/libc/src/__support/FPUtil/riscv/sqrt.h
+++ b/libc/src/__support/FPUtil/riscv/sqrt.h
@@ -18,6 +18,8 @@
 #error "Invalid include"
 #endif
 
+#include "src/__support/FPUtil/generic/sqrt.h"
+
 namespace LIBC_NAMESPACE_DECL {
 namespace fputil {
 
diff --git a/libc/src/__support/FPUtil/x86_64/sqrt.h b/libc/src/__support/FPUtil/x86_64/sqrt.h
index eae40cc8829f1..e10447751d216 100644
--- a/libc/src/__support/FPUtil/x86_64/sqrt.h
+++ b/libc/src/__support/FPUtil/x86_64/sqrt.h
@@ -18,6 +18,8 @@
 #error "sqrtss / sqrtsd need SSE2"
 #endif
 
+#include "src/__support/FPUtil/generic/sqrt.h"
+
 namespace LIBC_NAMESPACE_DECL {
 namespace fputil {
 



More information about the libc-commits mailing list