From: Richard Biener <richard.guenther@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: liuhongt <hongtao.liu@intel.com>,
gcc-patches@gcc.gnu.org, crazylht@gmail.com,
hjl.tools@gmail.com, ubizjak@gmail.com
Subject: Re: [PATCH] [x86] x86: Don't add crtfastmath.o for -shared and add a new option -mdaz-ftz to enable FTZ and DAZ flags in MXCSR.
Date: Wed, 14 Dec 2022 09:23:18 +0100 [thread overview]
Message-ID: <CAFiYyc2WQGNjg0ZzO8X0f9UifwDQ1ABkeBL2yh7x_W5AC9n5_w@mail.gmail.com> (raw)
In-Reply-To: <Y5mGQWUNVM6PtwVc@tucnak>
On Wed, Dec 14, 2022 at 9:16 AM Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Wed, Dec 14, 2022 at 09:08:02AM +0100, Richard Biener via Gcc-patches wrote:
> > On Wed, Dec 14, 2022 at 3:21 AM liuhongt via Gcc-patches
> > <gcc-patches@gcc.gnu.org> wrote:
> > >
> > > Don't add crtfastmath.o for -shared to avoid changing the MXCSR
> > > register when loading a shared library. crtfastmath.o will be used
> > > only when building executables.
> > >
> > > Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
> > > Ok for trunk?
> >
> > You reject negative -mdaz-ftz but wouldn't that be useful with
> > -Ofast -mno-daz-ftz since there's otherwise no way to avoid that?
>
> Agreed.
> I even wonder if the best wouldn't be to make the option effectively
> three state, default, no and yes, where if the option isn't specified
> at all, then crtfastmath.o* is linked as is now except for -shared,
> if it is -mno-daz-ftz, then it is never linked in regardless of other
> options and if it is -mdaz-ftz, then it is linked even for -shared.
Possibly. I'd also suggest to split the changed -shared handling to
a separate patch since people may want to backport this and it
should be applicable to all other targets with similar handling.
> > > --- a/gcc/config/i386/i386.opt
> > > +++ b/gcc/config/i386/i386.opt
> > > @@ -420,6 +420,10 @@ mpc80
> > > Target RejectNegative
> > > Set 80387 floating-point precision to 80-bit.
> > >
> > > +mdaz-ftz
> > > +Target RejectNegative
> > > +Set the FTZ and DAZ Flags.
>
> As the option is only used in the driver, shouldn't it be marked Driver
> and not Target? It doesn't need to be saved/restored on every cfun switch
> etc.
>
> > > +@item -mdaz-ftz
> > > +@opindex mdaz-ftz
> > > +
> > > +the flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register
>
> Shouldn't description start with capital letter?
>
> > > +are used to control floating-point calculations.SSE and AVX instructions
> > > +including scalar and vector instructions could benefit from enabling the FTZ
> > > +and DAZ flags when @option{-mdaz-ftz} is specified.
> >
> > Maybe say that the MXCSR register is set at program start to achieve
> > this when the
> > flag is specified at _link_ time and say this switch is ignored when
> > -shared is specified?
>
> Jakub
>
next prev parent reply other threads:[~2022-12-14 8:23 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-14 2:18 liuhongt
2022-12-14 8:08 ` Richard Biener
2022-12-14 8:16 ` Jakub Jelinek
2022-12-14 8:23 ` Richard Biener [this message]
2022-12-14 8:34 ` Liu, Hongtao
2022-12-14 8:52 ` Richard Biener
2022-12-14 9:07 ` Uros Bizjak
2022-12-15 6:21 ` [PATCH V2 1/2] x86: Don't add crtfastmath.o for -shared liuhongt
2022-12-15 6:21 ` [PATCH V2 2/2] [x86] x86: Add a new option -mdaz-ftz to enable FTZ and DAZ flags in MXCSR liuhongt
2022-12-15 7:39 ` Jakub Jelinek
2022-12-15 7:45 ` Hongtao Liu
2022-12-20 4:51 ` Hongtao Liu
2022-12-21 20:20 ` H.J. Lu
2022-12-21 22:35 ` Jakub Jelinek
2022-12-21 22:43 ` H.J. Lu
2022-12-21 22:46 ` Jakub Jelinek
2022-12-22 4:40 ` Hongtao Liu
2022-12-22 8:04 ` Uros Bizjak
2023-05-04 5:35 ` Hongtao Liu
2023-05-04 5:36 ` Hongtao Liu
2023-05-04 9:49 ` Richard Biener
2023-05-10 1:41 ` Hongtao Liu
2023-05-10 6:41 ` Richard Biener
2023-05-10 9:07 ` [PATCH] " liuhongt
2023-05-12 5:43 ` Hongtao Liu
2023-05-15 1:16 ` Hongtao Liu
2022-12-16 9:50 ` [PATCH V2 1/2] x86: Don't add crtfastmath.o for -shared Uros Bizjak
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=CAFiYyc2WQGNjg0ZzO8X0f9UifwDQ1ABkeBL2yh7x_W5AC9n5_w@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=crazylht@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=hongtao.liu@intel.com \
--cc=jakub@redhat.com \
--cc=ubizjak@gmail.com \
/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).