https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67771

--- Comment #7 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> 
---
(In reply to John Paul Adrian Glaubitz from comment #6)
> (In reply to Joseph S. Myers from comment #5)
> > Various glibc functions work around this using FIX_INT_FP_CONVERT_ZERO, I
> > suppose the new log10f implementation taken from CORE-MATH needs such a
> > workaround as well.
> 
> @Adhemerval: Do you think you could add such a workaround for 32-bit PowerPC?

This fixes the issues on glibc for powerpc for !HAVE_PPC_FCFID:

diff --git a/sysdeps/ieee754/flt-32/e_log10f.c
b/sysdeps/ieee754/flt-32/e_log10f.c
index 03d9e281f3..46cd5edd70 100644
--- a/sysdeps/ieee754/flt-32/e_log10f.c
+++ b/sysdeps/ieee754/flt-32/e_log10f.c
@@ -27,6 +27,7 @@ SOFTWARE.
 #include <math.h>
 #include <stdint.h>
 #include <libm-alias-finite.h>
+#include <fix-int-fp-convert-zero.h>
 #include "math_config.h"

 static __attribute__ ((noinline)) float
@@ -129,7 +130,12 @@ __ieee754_log10f (float x)
   unsigned je = e + 1;
   je = (je * 0x4d104d4) >> 28;
   if (__glibc_unlikely (ux == st[je].u))
-    return je;
+    {
+      float r = je;
+      if (FIX_INT_FP_CONVERT_ZERO && r == -0.0f)
+        return 0.0;
+      return r;
+    }

   double tz = asdouble (((int64_t) m | ((int64_t) 1023 << 23)) << (52 - 23));
   double z = tz * ix - 1, z2 = z * z;

I will send a patch.

Reply via email to