From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Xi Ruoyao <xry111@xry111.site>,
Xiaolin Tang <tangxiaolin@loongson.cn>,
libc-alpha@sourceware.org, i.swmail@xen0n.name
Cc: caiyinyu@loongson.cn, xuchenghua@loongson.cn, chenglulu@loongson.cn
Subject: Re: [PATCH v2 01/10] LoongArch: Hard Float Support for functions {ll/l/ }rint{f/ }.
Date: Mon, 7 Nov 2022 13:36:40 -0300 [thread overview]
Message-ID: <34dc6369-cdd4-fce9-3a40-55583f84c4a6@linaro.org> (raw)
In-Reply-To: <a19e64a5599bc0cf3f01f453490baf2060a22d31.camel@xry111.site>
On 07/11/22 11:38, Xi Ruoyao wrote:
> On Mon, 2022-11-07 at 22:05 +0800, Xiaolin Tang wrote:
>
>> +long long int
>> +__llrint (double x)
>> +{
>> + asm volatile ("frint.d \t%0, %1" : "=f" (x) : "f" (x));
>> + return x;
>> +}
>
> GCC trunk generates:
>
> __llrint:
> frint.d $f0, $f0
> ftintrz.l.d $f0,$f0
> movfr2gr.d $r4,$f0
> jr $r1
>
> It's not optimal. The optimal way is:
>
> __llrint:
> ftint.l.d $f0, $f0
> movfr2gr.d $r4,$f0
> jr $r1
>
> I have a GCC patch to expand __builtin_llrint to ftint.l.d and
> movgr2fr.d (with -fno-math-errno, which is enabled by Glibc building
> system).
>
> But I need some time to test my patch correctly: unfortunately I'm now
> hitting some "random crashes" running Expect on LoongArch so I can't
> complete GCC regression test.
A compiler builtin would indeed more desirable, since it would allows to
move it on generic code and use a math-use-builtins-llrint.h instead of
arch-specific code.
next prev parent reply other threads:[~2022-11-07 16:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-07 14:05 [PATCH v2 00/10] LoongArch: Hard Float Support Of Math Functions Xiaolin Tang
2022-11-07 14:05 ` [PATCH v2 01/10] LoongArch: Hard Float Support for functions {ll/l/ }rint{f/ } Xiaolin Tang
2022-11-07 14:38 ` Xi Ruoyao
2022-11-07 16:36 ` Adhemerval Zanella Netto [this message]
2022-11-07 14:05 ` [PATCH v2 02/10] LoongArch: Use __builtin_{fma, fmaf} to implement function {fma, fmaf} Xiaolin Tang
2022-11-07 14:05 ` [PATCH v2 03/10] LoongArch: Hard Float Support for float-point classification functions Xiaolin Tang
2022-11-07 14:05 ` [PATCH v2 04/10] LoongArch: Hard Float Support for functions logb{f/ }, __ieee754_ilogb{f/ } Xiaolin Tang
2022-11-07 14:05 ` [PATCH v2 05/10] LoongArch: Hard Float Support for functions scalb{f/ }, scalbn{f/ } Xiaolin Tang
2022-11-08 3:46 ` Xi Ruoyao
2022-11-07 14:05 ` [PATCH v2 06/10] LoongArch: Hard Float Support for fmaximum{f/ }, fminimum{f/ } Xiaolin Tang
2022-11-11 4:02 ` [PATCH v2 00/10] LoongArch: Hard Float Support Of Math Functions 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=34dc6369-cdd4-fce9-3a40-55583f84c4a6@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=caiyinyu@loongson.cn \
--cc=chenglulu@loongson.cn \
--cc=i.swmail@xen0n.name \
--cc=libc-alpha@sourceware.org \
--cc=tangxiaolin@loongson.cn \
--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).