From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 9AF863858C74 for ; Mon, 7 Nov 2022 14:38:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9AF863858C74 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1667831913; bh=s+PmJ9oqt9R63wxuI+Pw1CJsmNQqhsg8kCqQf4uCrqc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Hp4oh6PEAVUSfC2B9704C/U8tfQDs8OiyQIkkkGiHe8U9kVNyaPAvwGXpK+xnm7l7 SqSTKta+HcN+VQvjXC8JqVgjHhDwwBkKm5BUQZn+AJ2PcUdgariLi3ZET4wW+EhQSN p8PVJRXLcYShJYp0u1fn4IJEpS44LFrtuj9Ot7ZA= Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 3CEF6668F0; Mon, 7 Nov 2022 09:38:31 -0500 (EST) Message-ID: Subject: Re: [PATCH v2 01/10] LoongArch: Hard Float Support for functions {ll/l/ }rint{f/ }. From: Xi Ruoyao To: Xiaolin Tang , adhemerval.zanella@linaro.org, libc-alpha@sourceware.org, i.swmail@xen0n.name Cc: caiyinyu@loongson.cn, xuchenghua@loongson.cn, chenglulu@loongson.cn Date: Mon, 07 Nov 2022 22:38:29 +0800 In-Reply-To: <20221107140523.896735-2-tangxiaolin@loongson.cn> References: <20221107140523.896735-1-tangxiaolin@loongson.cn> <20221107140523.896735-2-tangxiaolin@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD,LIKELY_SPAM_FROM,PDS_OTHER_BAD_TLD,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, 2022-11-07 at 22:05 +0800, Xiaolin Tang wrote: > +long long int > +__llrint (double x) > +{ > +=C2=A0 asm volatile ("frint.d \t%0, %1" : "=3Df" (x) : "f" (x)); > +=C2=A0 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.