[PATCH] LoongArch: Add soft floating-point fe* function implementations.

Joseph Myers josmyers@redhat.com
Tue Mar 26 17:34:48 GMT 2024


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.

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.  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).

-- 
Joseph S. Myers
josmyers@redhat.com



More information about the Libc-alpha mailing list