public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: Patrick McGehearty <patrick.mcgehearty@oracle.com>
Cc: <gcc-patches@gcc.gnu.org>, <segher@kernel.crashing.org>
Subject: Re: [PATCH v3] Fix for powerpc64 long double complex divide failure
Date: Thu, 26 Aug 2021 16:34:08 +0000	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2108261625110.64888@digraph.polyomino.org.uk> (raw)
In-Reply-To: <75d073d4-54c5-5601-3750-a674e07b1e95@oracle.com>

On Thu, 26 Aug 2021, Patrick McGehearty via Gcc-patches wrote:

> The only complex divide routines in $HOME/usr/lib64/libgcc_s.so.1 are:
> __divdc3, __divsc3, __divtc3

Because no symbol versions are assigned to the KFmode symbols in the .ver 
files, so they are only exported from libgcc.a.

I think the exclusion of decimal FP arithmetic from shared libgcc is 
deliberate (both to faciliate using the libdfp version instead for some 
purposes, and maybe also to reduce libgcc_s library size and maybe TLS 
usage), but I don't know if the exclusion of KFmode arithmetic is also 
deliberate.

> When I link the version with the call to __divkc3 into an executable,
> the executable contains __divkc3. I just can't tell where the linker
> is finding it.

In libgcc.a, I expect.

> These values were supposed to be created by gcc/c-family/c-cppbuiltin.c.
> They depend on KF being part of
> FOR_EACH_MODE_IN_CLASS (mode_iter, MODE_FLOAT)
> {
>   const char *name = GET_MODE_NAME (mode);
> ...
> }
> 
> Apparently KF is not one of the mode names when building in this
> environment. I've spent some time trying to understand where/how
> the MODE_FLOAT class is constructed, but I have not been able to
> pinpoint what's going wrong.

So that's a key issue to resolve (but presumably this is working for some 
people building libgcc for powerpc64le).

> When I compile/link cdivchkld.c with -mabi=ieeelongdouble -lm
> I get cdivchkld.c:(.text+0x3c4): undefined reference to `__fmaxieee128'
> caused by the reference in the code to LDBL_MAX_EXP.

You need glibc 2.32 or later for __fmaxieee128 (and, generally, for IEEE 
long double support in glibc for powerpc64le).

> I am concerned that in some IBM environments, the build process will
> fall back to using the code in libgcc/libgcc2.c for IBM 128bit float
> complex divide. In that case, the current 1/__LIBGCC_TF_EPSILON__
> value will generate an infinity result which would be
> suboptimal. Changing __LIBGCC_TF_EPSILON__ to __LIBGCC_DF_EPSILON__
> for all platforms avoids the overflow without changing the final
> answers. It only has the effect of doing some scaling without possible
> overflow/underflow when it is not necessary.
> 
> I propose for my next patch I change libgcc/libgcc2.c to use
> __LIBGCC_DF_EPSILON__ instead of __LIBGCC_TF_EPSILON__

I think it's only appropriate to do that in the __LIBGCC_TF_MANT_DIG__ == 
106 case.

-- 
Joseph S. Myers
joseph@codesourcery.com

  reply	other threads:[~2021-08-26 16:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 16:03 Patrick McGehearty
2021-08-12 16:19 ` Joseph Myers
2021-08-12 16:40   ` Patrick McGehearty
2021-08-12 16:47     ` Joseph Myers
2021-08-12 20:53       ` Segher Boessenkool
2021-08-12 22:17       ` Patrick McGehearty
2021-08-13 17:12         ` Joseph Myers
2021-08-26 15:51           ` Patrick McGehearty
2021-08-26 16:34             ` Joseph Myers [this message]
2021-08-26 16:57             ` Segher Boessenkool
2021-08-26 17:04           ` Segher Boessenkool
2021-08-12 20:55 ` Segher Boessenkool
2021-08-12 22:36 ` Andreas Schwab
2021-08-13 17:22   ` Joseph Myers
2021-08-27  2:10     ` Michael Meissner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.22.394.2108261625110.64888@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=patrick.mcgehearty@oracle.com \
    --cc=segher@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).