[libc-commits] [libc] 096f9d0 - [libc] Initial support so that libc-shared-tests can be built with pp64le (#188882)
via libc-commits
libc-commits at lists.llvm.org
Wed Apr 1 17:55:49 PDT 2026
Author: lntue
Date: 2026-04-01T20:55:44-04:00
New Revision: 096f9d0aa8edb8bad77e8061a6aa9cbf61bcb5ac
URL: https://github.com/llvm/llvm-project/commit/096f9d0aa8edb8bad77e8061a6aa9cbf61bcb5ac
DIFF: https://github.com/llvm/llvm-project/commit/096f9d0aa8edb8bad77e8061a6aa9cbf61bcb5ac.diff
LOG: [libc] Initial support so that libc-shared-tests can be built with pp64le (#188882)
Added:
libc/config/linux/power/config.json
libc/config/linux/power/entrypoints.txt
libc/config/linux/power/headers.txt
Modified:
libc/cmake/modules/LLVMLibCArchitectures.cmake
libc/src/__support/FPUtil/generic/sqrt.h
Removed:
################################################################################
diff --git a/libc/cmake/modules/LLVMLibCArchitectures.cmake b/libc/cmake/modules/LLVMLibCArchitectures.cmake
index b24ea353df484..921057706c5e9 100644
--- a/libc/cmake/modules/LLVMLibCArchitectures.cmake
+++ b/libc/cmake/modules/LLVMLibCArchitectures.cmake
@@ -184,6 +184,8 @@ elseif(LIBC_TARGET_ARCHITECTURE STREQUAL "nvptx")
set(LIBC_TARGET_ARCHITECTURE_IS_NVPTX TRUE)
elseif(LIBC_TARGET_ARCHITECTURE STREQUAL "spirv")
set(LIBC_TARGET_ARCHITECTURE_IS_SPIRV TRUE)
+elseif(LIBC_TARGET_ARCHITECTURE STREQUAL "power")
+ set(LIBC_TARGET_ARCHITECTURE_IS_POWERPC TRUE)
else()
message(FATAL_ERROR
"Unsupported libc target architecture ${LIBC_TARGET_ARCHITECTURE}")
diff --git a/libc/config/linux/power/config.json b/libc/config/linux/power/config.json
new file mode 100644
index 0000000000000..22e47df31bb6e
--- /dev/null
+++ b/libc/config/linux/power/config.json
@@ -0,0 +1,7 @@
+{
+ "string": {
+ "LIBC_CONF_STRING_LENGTH_IMPL": {
+ "value": "element"
+ }
+ }
+}
diff --git a/libc/config/linux/power/entrypoints.txt b/libc/config/linux/power/entrypoints.txt
new file mode 100644
index 0000000000000..f133d4f0d20cf
--- /dev/null
+++ b/libc/config/linux/power/entrypoints.txt
@@ -0,0 +1,14 @@
+
+set(TARGET_LIBC_ENTRYPOINTS
+ libc.src.errno.errno
+)
+
+set(TARGET_LIBM_ENTRYPOINTS)
+
+set(TARGET_LIBMVEC_ENTRYPOINTS)
+
+set(TARGET_LLVMLIBC_ENTRYPOINTS
+ ${TARGET_LIBC_ENTRYPOINTS}
+ ${TARGET_LIBM_ENTRYPOINTS}
+ ${TARGET_LIBMVEC_ENTRYPOINTS}
+)
diff --git a/libc/config/linux/power/headers.txt b/libc/config/linux/power/headers.txt
new file mode 100644
index 0000000000000..8b96869309bfa
--- /dev/null
+++ b/libc/config/linux/power/headers.txt
@@ -0,0 +1 @@
+set(TARGET_PUBLIC_HEADERS)
diff --git a/libc/src/__support/FPUtil/generic/sqrt.h b/libc/src/__support/FPUtil/generic/sqrt.h
index 2295fdf85a114..4e452a87050b1 100644
--- a/libc/src/__support/FPUtil/generic/sqrt.h
+++ b/libc/src/__support/FPUtil/generic/sqrt.h
@@ -9,7 +9,6 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_FPUTIL_GENERIC_SQRT_H
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_GENERIC_SQRT_H
-#include "sqrt_80_bit_long_double.h"
#include "src/__support/CPP/bit.h" // countl_zero
#include "src/__support/CPP/type_traits.h"
#include "src/__support/FPUtil/FEnvImpl.h"
@@ -22,6 +21,10 @@
#include "hdr/fenv_macros.h"
+#ifdef LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80
+#include "sqrt_80_bit_long_double.h"
+#endif // !LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80
+
namespace LIBC_NAMESPACE_DECL {
namespace fputil {
@@ -52,7 +55,7 @@ template <>
LIBC_INLINE void normalize<long double>(int &exponent, uint64_t &mantissa) {
normalize<double>(exponent, mantissa);
}
-#elif !defined(LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80)
+#elif defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
template <>
LIBC_INLINE void normalize<long double>(int &exponent, UInt128 &mantissa) {
const uint64_t hi_bits = static_cast<uint64_t>(mantissa >> 64);
@@ -76,8 +79,10 @@ LIBC_INLINE static constexpr cpp::enable_if_t<
sqrt(InType x) {
if constexpr (internal::SpecialLongDouble<OutType>::VALUE &&
internal::SpecialLongDouble<InType>::VALUE) {
+#ifdef LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80
// Special 80-bit long double.
return x86::sqrt(x);
+#endif // !LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80
} else {
// IEEE floating points formats.
using OutFPBits = FPBits<OutType>;
More information about the libc-commits
mailing list