[libc-commits] [libc] ae1d75e - [libc][math] Guard f16 math headers to fix certain 32-bit ARM builds (#200715)
via libc-commits
libc-commits at lists.llvm.org
Mon Jun 1 01:58:38 PDT 2026
Author: Sonal Pinto
Date: 2026-06-01T10:58:34+02:00
New Revision: ae1d75e6071e51fff924c6904852fc3a2ae56687
URL: https://github.com/llvm/llvm-project/commit/ae1d75e6071e51fff924c6904852fc3a2ae56687
DIFF: https://github.com/llvm/llvm-project/commit/ae1d75e6071e51fff924c6904852fc3a2ae56687.diff
LOG: [libc][math] Guard f16 math headers to fix certain 32-bit ARM builds (#200715)
Wrap hypotf16.h and expxf16_utils.h in LIBC_TYPES_HAS_FLOAT16 macros
like other flaot16 math headers. This fixes build breaks on systems
where float16 is unsupported (like some 32-bit ARM).
Added:
Modified:
libc/src/__support/math/expxf16_utils.h
libc/src/__support/math/hypotf16.h
Removed:
################################################################################
diff --git a/libc/src/__support/math/expxf16_utils.h b/libc/src/__support/math/expxf16_utils.h
index 0375eaf179b9f..33f66a93df631 100644
--- a/libc/src/__support/math/expxf16_utils.h
+++ b/libc/src/__support/math/expxf16_utils.h
@@ -9,6 +9,10 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_EXPXF16_UTILS_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_EXPXF16_UTILS_H
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
#include "hdr/stdint_proxy.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/cast.h"
@@ -238,4 +242,6 @@ LIBC_INLINE_VAR constexpr cpp::array<float, 32> ONE_OVER_F_F = {
} // namespace LIBC_NAMESPACE_DECL
+#endif // LIBC_TYPES_HAS_FLOAT16
+
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_EXPXF16_UTILS_H
diff --git a/libc/src/__support/math/hypotf16.h b/libc/src/__support/math/hypotf16.h
index 07e8a0566b8ec..f93500977f0e7 100644
--- a/libc/src/__support/math/hypotf16.h
+++ b/libc/src/__support/math/hypotf16.h
@@ -9,6 +9,10 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_HYPOTF16_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_HYPOTF16_H
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/cast.h"
@@ -96,4 +100,6 @@ LIBC_INLINE float16 hypotf16(float16 x, float16 y) {
} // namespace LIBC_NAMESPACE_DECL
+#endif // LIBC_TYPES_HAS_FLOAT16
+
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_HYPOTF16_H
More information about the libc-commits
mailing list