This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/70117] ppc long double isinf() is wrong?


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

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
So, "simplest" patch:

Index: gcc/builtins.c
===================================================================
--- gcc/builtins.c      (revision 234180)
+++ gcc/builtins.c      (working copy)
@@ -7529,6 +7529,13 @@ fold_builtin_interclass_mathfn (location

   mode = TYPE_MODE (TREE_TYPE (arg));

+  /* Do not perform this simplification for IBM extended double
+     which is made up of two IEEE doubles where only the first
+     one is relevant to the result of isinf, isfinite and isnormal.  */
+  const struct real_format *fmt = FLOAT_MODE_FORMAT (mode);
+  if (fmt->pnan < fmt->p)
+    return NULL_TREE;
+
   /* If there is no optab, try generic code.  */
   switch (DECL_FUNCTION_CODE (fndecl))
     {

but it will end up with libcalls for isinf, isfinite and isnormal for
IBM extended double.  I'm told glibc does the right thing for the gnulib
DBL_MAX.

PPC people should evaluate if that's eventually even more efficient than
the inlining with the comparison against the large constant immediate.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]