unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: tangxiaolin <tangxiaolin@loongson.cn>
To: Xi Ruoyao <xry111@xry111.site>, libc-alpha@sourceware.org
Cc: Lulu Cheng <chenglulu@loongson.cn>, Wang Xuerui <i@xen0n.name>,
	Chenghua Xu <xuchenghua@loongson.cn>,
	caiyinyu@loongson.cn
Subject: Re: [PATCH v2 0/4] LoongArch: Add some floating-point operations
Date: Wed, 16 Nov 2022 17:17:33 +0800	[thread overview]
Message-ID: <ef7331ee-70f3-276f-5c6d-8840cd3726ba@loongson.cn> (raw)
In-Reply-To: <3520c6e178315f94e38ce334e66432e4b0ccab2a.camel@xry111.site>

Thanks a lot. These patches look very good,  honestly I have nothing to add.

For lrint and llrint, If you ask my suggestion, I would say adding  
USE_LRINTL_BUILTIN and USE_LRINTF128_BUILTIN (with zero value) is better 
for consistency with other functions like ceil.

I did an experiment, 'scalbn' is indeed not easy to deal with, and I don't have a better idea so far.I tend to add inline assembler for this function instead of builtin if you don't have a better idea.

What do you think?

在 2022/11/14 下午4:05, Xi Ruoyao 写道:
> On Mon, 2022-11-14 at 10:41 +0800, tangxiaolin wrote:
>> How about I do this work on Glibc?
> [Moving the discussion to libc-alpha.]
>
> Go for it.  I'm attaching my draft patches and you can use them as a
> starting point.
>
> rint change is trivial.  for lrint and llrint I'm not sure if we should
> add USE_LRINTL_BUILTIN and USE_LRINTF128_BUILTIN (with zero value) as
> well.  Likewise for logb.
>
> scalbn is a little complicated: I'd prefer to expand M_SCALBN to
> __builtin_scalbn directly instead of calling __scalbn (to avoid the
> overhead calling a function with only two instructions) but it seems not
> easy: some files calling M_SCALBN are compiled with -fmath-errno, with
> which the compiler will refuse to expand __builtin_scalbn.
>
>> 在 2022/11/12 下午3:08, Xi Ruoyao 写道:
>>> On Wed, 2022-11-09 at 21:53 +0800, Xi Ruoyao wrote:
>>>> These patches allow to expand the following builtins to floating
>>>> point
>>>> instructions for LoongArch:
>>>>
>>>> - __builtin_rint{,f}
>>>> - __builtin_{l,ll}rint{,f}
>>>> - __builtin_{l,ll}floor{,f}
>>>> - __builtin_{l,ll}ceil{,f}
>>>> - __builtin_scalb{n,ln}{,f}
>>>> - __builtin_logb{,f}
>>>>
>>>> Bootstrapped and regtested on loongarch64-linux-gnu.  And a
>>>> modified
>>>> Glibc using the builtins for rint{,f}, {l,ll}rint{,f}, and
>>>> logb{,f}
>>>> also survived Glibc test suite.
>>>>
>>>> Please review ASAP because GCC 13 stage 1 will end on Nov. 13th.
>>>>
>>>> v1 -> v2: Only use ftint{rm,rp} instructions if floor and ceil are
>>>> allowed to raise inexact exception.
>>>>
>>>> Xi Ruoyao (4):
>>>>     LoongArch: Rename frint_<fmt> to rint<mode>2
>>>>     LoongArch: Add ftint{,rm,rp}.{w,l}.{s,d} instructions
>>>>     LoongArch: Add fscaleb.{s,d} instructions as ldexp{sf,df}3
>>>>     LoongArch: Add flogb.{s,d} instructions and expand logb{sf,df}2
>>>>
>>>>    gcc/config/loongarch/loongarch.md             | 95
>>>> ++++++++++++++++++-
>>>>    gcc/testsuite/gcc.target/loongarch/flogb.c    | 18 ++++
>>>>    gcc/testsuite/gcc.target/loongarch/frint.c    | 16 ++++
>>>>    gcc/testsuite/gcc.target/loongarch/fscaleb.c  | 48 ++++++++++
>>>>    .../gcc.target/loongarch/ftint-no-inexact.c   | 44 +++++++++
>>>>    gcc/testsuite/gcc.target/loongarch/ftint.c    | 44 +++++++++
>>>>    6 files changed, 261 insertions(+), 4 deletions(-)
>>>>    create mode 100644 gcc/testsuite/gcc.target/loongarch/flogb.c
>>>>    create mode 100644 gcc/testsuite/gcc.target/loongarch/frint.c
>>>>    create mode 100644 gcc/testsuite/gcc.target/loongarch/fscaleb.c
>>>>    create mode 100644 gcc/testsuite/gcc.target/loongarch/ftint-no-
>>>> inexact.c
>>>>    create mode 100644 gcc/testsuite/gcc.target/loongarch/ftint.c
>>>>
>>> Pushed r13-3922.
>>>
>>> I'll be busy in the following week.  Will do the work on Glibc side
>>> after Nov. 20.
>>>


  reply	other threads:[~2022-11-16  9:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221109135329.952128-1-xry111@xry111.site>
     [not found] ` <1a465d2a0bea2a47aadaa727c0689ac48d5982c5.camel@xry111.site>
     [not found]   ` <235d9f8e-040c-2917-8444-654b33aa124e@loongson.cn>
2022-11-14  8:05     ` [PATCH v2 0/4] LoongArch: Add some floating-point operations Xi Ruoyao via Libc-alpha
2022-11-16  9:17       ` tangxiaolin [this message]
2022-11-16 13:00       ` tangxiaolin
2022-11-16 14:39         ` Xi Ruoyao via Libc-alpha

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

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef7331ee-70f3-276f-5c6d-8840cd3726ba@loongson.cn \
    --to=tangxiaolin@loongson.cn \
    --cc=caiyinyu@loongson.cn \
    --cc=chenglulu@loongson.cn \
    --cc=i@xen0n.name \
    --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).