public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] math: x86: Use prefix for FP_INIT_ROUNDMODE
Date: Thu, 1 Sep 2022 09:49:41 -0700	[thread overview]
Message-ID: <CAMe9rOpAw5N4xPXiW72cYRVPsP+FEPEZ-1FiZCc64FRT45p4Qw@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOrie1t3ZGEDVTK49P-QW6nqZ90tF12bOLFU-A7VAq3Thg@mail.gmail.com>

On Thu, Sep 1, 2022 at 9:42 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Sep 1, 2022 at 6:03 AM Adhemerval Zanella via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
> >
> > Not all compilers support the inline asm prefix '%v' to emit the avx
> > instruction if AVX is enable.  Use a prefix instead.
> >
> > Checked on x86_64-linux-gnu and i686-linux-gnu.
> > ---
> >  sysdeps/x86/fpu/sfp-machine.h | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/sysdeps/x86/fpu/sfp-machine.h b/sysdeps/x86/fpu/sfp-machine.h
> > index 5892f4f5fe..006eebe257 100644
> > --- a/sysdeps/x86/fpu/sfp-machine.h
> > +++ b/sysdeps/x86/fpu/sfp-machine.h
> > @@ -39,9 +39,15 @@ typedef unsigned int UTItype __attribute__ ((mode (TI)));
> >
> >  # define FP_RND_MASK           0x6000
> >
> > +# ifdef __AVX__
> > +#  define AVX_INSN_PREFIX      "v"
> > +# else
> > +#  define AVX_INSN_PREFIX      ""
> > +# endif
> > +
> >  # define FP_INIT_ROUNDMODE                                     \
> >    do {                                                         \
> > -    __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (_fcw));      \
> > +    __asm__ __volatile__ (AVX_INSN_PREFIX "stmxcsr\t%0" : "=m" (_fcw)); \
> >    } while (0)
> >  #else
> >  # define _FP_W_TYPE_SIZE       32
> > --
> > 2.34.1
> >
>
> Should we use __builtin_ia32_stmxcsr instead?
>

__builtin_ia32_stmxcsr requires extra instructions.

-- 
H.J.

  reply	other threads:[~2022-09-01 16:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01 13:02 Adhemerval Zanella
2022-09-01 16:42 ` H.J. Lu
2022-09-01 16:49   ` H.J. Lu [this message]
2022-09-01 17:29     ` Adhemerval Zanella Netto
2022-09-03  2:00 ` H.J. Lu

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=CAMe9rOpAw5N4xPXiW72cYRVPsP+FEPEZ-1FiZCc64FRT45p4Qw@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.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).