public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Peter Bergner <bergner@linux.ibm.com>
To: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
	Manjunath Matti <mmatti@linux.ibm.com>,
	libc-alpha@sourceware.org
Cc: rajis@linux.ibm.com, Carl Love <cel@linux.ibm.com>
Subject: Re: [PATCH] [powerpc] fegetenv_and_set_rn now uses the builtins provided by GCC.
Date: Wed, 18 Oct 2023 20:25:26 -0500	[thread overview]
Message-ID: <c9aab207-a703-4fd4-860a-598cc82547ee@linux.ibm.com> (raw)
In-Reply-To: <866d7459-b031-883b-f356-b05fa2e5ad71@linux.vnet.ibm.com>

On 9/20/23 6:28 AM, Manjunath S Matti wrote:
>>> GCC version 14 onwards supports builtins as __builtin_set_fpscr_rn
>>> which now returns the FPSCR fields in a double. This feature is
>>> available on Power9 when the __SET_FPSCR_RN_RETURNS_FPSCR__ macro
>>> is defined along with __builtin_set_fpscr_rn enabled.
>>> GCC commit ef3bbc69d15707e4db6e2f198c621effb636cc26 adds
>>> this feature.
[snip]
> I was under the impression that the redefine of fegetenv_and_set_rn and __fesetround_inline
> 
> was needed for architectures below POWE9, i.e POWER8, 7, etc.
> 
> Please correct me if I am wrong.

The __builtin_set_fpscr_rn(rn) built-in was changed so that it now
always returns the FPSCR as a return value.  It is cpu agnostic, so
that means it works on all Power cpus, including Power8 and earlier.
The only difference you'll see on Power9/Power10 versus the earlier cpus,
is that we'll use the new to Power9 mffscrn and mffscrni instructions
which automatically return the updated FPSCR value.  On the older cpus,
we'll emit some extra code to copy the FPSCR value as the return value.
The optimizer will eliminate that if you don't want/need the return value.  

The __SET_FPSCR_RN_RETURNS_FPSCR__ macro allows you to tell whether you're
compiling the old built-in with a void return value, or the new one which
has a double return value.  It doesn't care which cpu you use it on.

So short answer is, Adhemerval's suggested change looks correct to me.

Peter




  parent reply	other threads:[~2023-10-19  1:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12  8:27 Manjunath Matti
2023-09-12 13:27 ` Adhemerval Zanella Netto
2023-09-20 11:28   ` Manjunath S Matti
2023-09-20 13:33     ` Adhemerval Zanella Netto
2023-10-19  1:25     ` Peter Bergner [this message]
2023-09-23 15:49 Manjunath Matti
2023-09-27 16:56 ` Adhemerval Zanella Netto
2023-10-19  1:47 ` Peter Bergner

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=c9aab207-a703-4fd4-860a-598cc82547ee@linux.ibm.com \
    --to=bergner@linux.ibm.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=cel@linux.ibm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=mmatti@linux.ibm.com \
    --cc=rajis@linux.ibm.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).