--- /dev/null
+/* Define __FP_BUILTIN_DENORMAL.
+ Copyright (C) 2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _MATH_H
+# error "Never use <bits/fp-builtin-denormal.h> directly; include <math.h> instead."
+#endif
+
+/* __FP_BUILTIN_DENORMAL is define to 1 if compiler supports handling
+ pseudo-normal numbers with builtins. Pseudo-normal are defined onlyi
+ Intel double extended-precision floating point (long double), so
+ assume 1 to enable the math optimization. */
+#define __FP_BUILTIN_DENORMAL 1
bits/floatn-common.h \
bits/floatn.h \
bits/flt-eval-method.h \
+ bits/fp-builtin-denormal.h \
bits/fp-fast.h \
bits/fp-logb.h \
bits/iscanonical.h \
FP_NORMAL
};
+#include <bits/fp-builtin-denormal.h>
+
/* GCC bug 66462 means we cannot use the math builtins with -fsignaling-nan,
so disable builtins if this is enabled. When fixed in a newer GCC,
the __SUPPORT_SNAN__ check may be skipped for those versions. */
/* Return number of classification appropriate for X. */
# if ((__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \
|| __glibc_clang_prereq (2,8)) \
+ && __FP_BUILTIN_DENORMAL \
&& (!defined __OPTIMIZE_SIZE__ || defined __cplusplus)
/* The check for __cplusplus allows the use of the builtin, even
when optimization for size is on. This is provided for
/* Return nonzero value if X is neither zero, subnormal, Inf, nor NaN. */
# if (__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \
- || __glibc_clang_prereq (2,8)
+ || __glibc_clang_prereq (2,8) \
+ && __FP_BUILTIN_DENORMAL
# define isnormal(x) __builtin_isnormal (x)
# else
# define isnormal(x) (fpclassify (x) == FP_NORMAL)
--- /dev/null
+/* Define __FP_BUILTIN_DENORMAL.
+ Copyright (C) 2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _MATH_H
+# error "Never use <bits/fp-builtin-denormal.h> directly; include <math.h> instead."
+#endif
+
+/* clang does not handle pseudo-normal with builtins. */
+#ifdef __clang__
+# define __FP_BUILTIN_DENORMAL 0
+#else
+# define __FP_BUILTIN_DENORMAL 1
+#endif