This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/70117] ppc long double isinf() is wrong?
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 14 Mar 2016 15:05:21 +0000
- Subject: [Bug target/70117] ppc long double isinf() is wrong?
- Auto-submitted: auto-generated
- References: <bug-70117-4 at http dot gcc dot gnu dot org/bugzilla/>
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.