ldexpf and ldexpl are only optimized as expected when the target libc
is known to have C99 support, so don't expect those optimizations when
HAVE_C99_RUNTIME is not set by builtins-config.h.

Regstrapped on x86_64-linux-gnu.  Also tested with aarch64-elf and
arm-eabi with gcc-15.  Ok to install?


for  gcc/testsuite/ChangeLog

        * gcc.dg/tree-ssa/ldexp.c: Require HAVE_C99_RUNTIME to test
        ldexpf and ldexpl.
---
 gcc/testsuite/gcc.dg/tree-ssa/ldexp.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldexp.c 
b/gcc/testsuite/gcc.dg/tree-ssa/ldexp.c
index 92bcf588b16ac..98395f9da7674 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ldexp.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldexp.c
@@ -3,6 +3,8 @@
 
 /* { dg-final { scan-assembler-not "\tfmul\t" } } */
 
+#include "../builtins-config.h"
+
 #define TEST(TYPE, BUILTIN, CONST, NAME)                       \
   TYPE test_##NAME##_1(TYPE a, int i)                          \
   {                                                            \
@@ -28,5 +30,9 @@
   }
 
 TEST(double, ldexp, 8.0, double_ldexp)
+#ifdef HAVE_C99_RUNTIME
+/* If libc is not known to have these functions, introduced in C99, the
+   compiler won't optimize them.  */
 TEST(float, ldexpf, 8.0f, float_ldexp)
 TEST(long double, ldexpl, 8.0L, long_ldexp)
+#endif

-- 
Alexandre Oliva, happy hacker            https://blog.lx.oliva.nom.br/
Free Software Activist     FSFLA co-founder     GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity.
Excluding neuro-others for not behaving ""normal"" is *not* inclusive!

Reply via email to