public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: caiyinyu <caiyinyu@loongson.cn>
To: Joseph Myers <josmyers@redhat.com>
Cc: libc-alpha@sourceware.org, adhemerval.zanella@linaro.org,
	xry111@xry111.site, xuchenghua@loongson.cn
Subject: Re: [PATCH] LoongArch: Add soft floating-point fe* function implementations.
Date: Wed, 27 Mar 2024 16:42:24 +0800	[thread overview]
Message-ID: <2193d4f3-6f55-1812-5923-2845226b3011@loongson.cn> (raw)
In-Reply-To: <cb65a988-d564-f783-5eea-3a8fb0d31e58@redhat.com>


在 2024/3/27 上午1:34, Joseph Myers 写道:
> On Tue, 26 Mar 2024, caiyinyu wrote:
>
>> This patch accomplishes the following:
>> 1. Implements soft floating-point functions to enhance compatibility and
>>    flexibility in environments without hardware floating-point support.
> Does this actually do anything useful for users, i.e. make the software
> floating-point rounding mode and exceptions state affect both user
> arithmetic and functions within libc/libm?  As far as I can see, while
> you're building copies of some software floating-point libgcc functions
> for libc, you're not doing anything to make them use the software
> floating-point environment state, and not exporting them for use by users.

Yes, this patch does make sense in both libc and libm and it can be 
proved by the following glibc tests:
stdlib/tst-strtod-underflow
stdio-common/tst-printf-round
math/test-fenv
math/test-femode{, -traps}
...


Actually, without this patch, you will get the warning info something 
like the following when make check and the related tsts would failed or 
not be tested correctly.
"test-fenv.c:229:(.text+0x48): warning: feclearexcept is not implemented 
and will always fail"

Even more, the warning information appears in glibc's check logs of all 
the following architectures (tested with build-many-glibcs.py).
csky-linux-gnuabiv2-soft
m68k-linux-gnu-coldfire-soft
or1k-linux-gnu-soft
powerpc-linux-gnu-soft
riscv64-linux-gnu-rv64imac-lp64
sh4-linux-gnu-soft
...
I think all these related tsts were not tested correctly on these 
architectures.


>
> For software floating-point rounding modes and exceptions to be useful to
> users, you need to follow powerpc/nofpu and export the functions from
> libc.

All the functions Implemented in this patch are exported from libm.so 
the same as powerpc nofpu.


> You then need to arrange for libgcc *not* to provide the functions
> when libc does (see how libgcc/configure.ac sets ppc_fp_compat depending
> on glibc version, for example).  And there's also the matter of providing
> libc (as opposed to libm) interfaces for cases where compiler-generated
> code may need to manipulate floating-point environment state without
> calling libm functions (see how powerpc-nofpu provides
> __atomic_feholdexcept __atomic_feclearexcept __atomic_feupdateenv
> __flt_rounds and rs6000_atomic_assign_expand_fenv in the GCC back end can
> generate calls to the first three of those functions - the fourth is
> future-proofing for if GCC gets proper support for making FLT_ROUNDS
> depend on the rounding mode in future).

I've reviewed your previous commits in glibc and gcc about
__atomic_feholdexcept __atomic_feclearexcept __atomic_feupdateenv and 
__flt_rounds
and I wil make other patches to implement these functions in glibc and gcc.


In summary, I believe this patch is fine except for the _atomic* and 
__flt_rounds functions.


>


  reply	other threads:[~2024-03-27  8:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 12:46 caiyinyu
2024-03-26 17:34 ` Joseph Myers
2024-03-27  8:42   ` caiyinyu [this message]
2024-03-27 17:10     ` Joseph Myers
2024-03-31 10:14       ` caiyinyu
2024-04-01 13:19         ` Florian Weimer
2024-04-02  3:40           ` caiyinyu
2024-04-02 10:40             ` Xi Ruoyao
2024-04-02 11:45               ` Florian Weimer
2024-04-02 12:02                 ` Xi Ruoyao
2024-04-02 12:34                   ` Florian Weimer
2024-04-02 12:12               ` Andreas Schwab
2024-04-02 21:18             ` Joseph Myers
2024-03-31 10:31       ` caiyinyu
2024-04-02 21:10         ` Joseph Myers
2024-04-02 14:46 caiyinyu

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=2193d4f3-6f55-1812-5923-2845226b3011@loongson.cn \
    --to=caiyinyu@loongson.cn \
    --cc=adhemerval.zanella@linaro.org \
    --cc=josmyers@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=xry111@xry111.site \
    --cc=xuchenghua@loongson.cn \
    /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).