public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul E Murphy <murphyp@linux.ibm.com>
To: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
	libc-alpha@sourceware.org
Cc: Manjunath S Matti <mmatti@linux.vnet.ibm.com>,
	Peter Bergner <bergner@linux.ibm.com>
Subject: Re: [PATCH] powerpc: Fix __fesetround_inline_nocheck on POWER9+ (BZ 31682)
Date: Tue, 30 Apr 2024 16:58:44 -0500	[thread overview]
Message-ID: <4daa27e7-159f-4bf2-a682-5fd6bd00ad47@linux.ibm.com> (raw)
In-Reply-To: <17f748c4-399e-4f8a-9a62-a9b86f7a0aae@linaro.org>



On 4/30/24 1:34 PM, Adhemerval Zanella Netto wrote:
> 
> 
> On 30/04/24 15:13, Paul E Murphy wrote:
>>
>>
>> On 4/30/24 7:40 AM, Adhemerval Zanella wrote:
>>> The e68b1151f7460d5fa88c3a567c13f66052da79a7 commit changed the
>>> __fesetround_inline_nocheck implementation to use mffscrni
>>> (through __fe_mffscrn) instead of mtfsfi.  For generic powerpc
>>> ceil/floor/trunc, the function is supposed to not change the
>>> Floating-Point Inexact Exception Enable bit, however mffscrni
>>> clear bits 56:63 (VE, OE, UE, ZE, XE, NI, RN), different than mtfsfi.
>>
>> I don't think that explanation is correct. mffscrni should not alter the exception enable bits. It copies them into FRT, but does not clear them.
> 
> Yeah, I forgot to add that mffscrni in this context clears because
> there is no easy way to mask out the current bits 56:63 since only
> the rounding bit is provided.  So maybe:
> 
>    The e68b1151f7460d5fa88c3a567c13f66052da79a7 commit changed the
>    __fesetround_inline_nocheck implementation to use mffscrni
>    (through __fe_mffscrn) instead of mtfsfi.  For generic powerpc
>    ceil/floor/trunc, the function is supposed to not change the
>    Floating-Point Inexact Exception Enable bit, however mffscrni
>    usage always clear the the bits 56:63 (VE, OE, UE, ZE, XE, NI, RN),
>    since only the rounding mode is provided.

I think the comment has mtfsfi and mffscrni swapped.  The usage of 
mtfsfi clears bits 60 (XE) and 61 (NI) of the fpscr.  mffscrni does not 
alter any fpscr bits besides RN.

Should __fesetround_inline_nocheck be removed in favor of using 
__fesetround_inline?  The description of __fesetround_inline_nocheck is 
confusing. It fails to mention that XE and NI are cleared, as implied by 
the usage of mtfsfi.

  reply	other threads:[~2024-04-30 21:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 12:40 Adhemerval Zanella
2024-04-30 18:13 ` Paul E Murphy
2024-04-30 18:34   ` Adhemerval Zanella Netto
2024-04-30 21:58     ` Paul E Murphy [this message]
2024-05-01 14:01       ` Adhemerval Zanella Netto
2024-05-03 18:30         ` Paul E Murphy
2024-05-06 17:08           ` Adhemerval Zanella Netto

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=4daa27e7-159f-4bf2-a682-5fd6bd00ad47@linux.ibm.com \
    --to=murphyp@linux.ibm.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=bergner@linux.ibm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=mmatti@linux.vnet.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).