On Tue, 2023-08-08 at 10:24 +0800, Xi Ruoyao wrote:

And I think this way to implement these functions (using libgcc calls)
is not the best.

On 64-bit LoongArch a __float128 is stored in a pair of GPR, so
operations like copysignq and absq can be implemented much more
efficiently by expanding them using bstrins and bstrpick instructions in
the compiler.  For example:

__float128 
absq (__float128 val)
{
  return __builtin_absq (val);
}

should be compiled to:

bstrins.d $a1, $zero, 63, 63
jr $ra

Instead of

b __fabstf2

(perhaps, unless -Os).

> > +__float128 nanq        (const char * str)

Using "nanq" as the symbol name is unacceptable as well.  Use "__nanq"
or something.  "nanq" is not reserved for implementation, so it may
cause a conflict in the future if "nanq" finally become a standard
function or the users defines their own "nanq" function.
> 

-- 
Xi Ruoyao <xry...@xry111.site>
School of Aerospace Science and Technology, Xidian University

Reply via email to