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 9D1383858D1E for ; Tue, 29 Nov 2022 14:20:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9D1383858D1E 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=1669731600; bh=f/bEwsLrBw0EwO40jsM5j3mQcWx5uvOahHaYkeBa+sc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=QPbujZvS4Tmy8FxwiNmbqOUZaxx4uuFom/mHvh4FKzoPHA7xuVdmn4Cgfx++xUMqA eoqKBobSVzJBKb9G/Lb7qT3TdOlUAXRh7pWAZW0oE9WQup48jOabD85jMGx8SwT/P3 pgnAlmo+H9vBTkcODj20Pjv1XyliPEELjNeBSv9k= Received: from [IPv6:240e:358:112c:8300:dc73:854d:832e:3] (unknown [IPv6:240e:358:112c:8300:dc73:854d:832e:3]) (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 7992865B9B; Tue, 29 Nov 2022 09:19:56 -0500 (EST) Message-ID: Subject: Re: Implement a build-in function with floating point exceptions. From: Xi Ruoyao To: =?gb2312?Q?=B3=C2_=D0=A1=C1=FA?= , "gcc-patches@gcc.gnu.org" Cc: "i@xen0n.name" , "xuchenghua@loongson.cn" , "chenglulu@loongson.cn" Date: Tue, 29 Nov 2022 22:19:45 +0800 In-Reply-To: References: 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=2.5 required=5.0 tests=BAYES_00,DKIM_INVALID,DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,KAM_DMARC_STATUS,LIKELY_SPAM_FROM,NO_DNS_FOR_FROM,TXREP,T_PDS_OTHER_BAD_TLD,T_SPF_HELO_TEMPERROR,T_SPF_TEMPERROR autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, 2022-11-29 at 09:52 +0000, =E9=99=88 =E5=B0=8F=E9=BE=99 wrote: > +(define_insn "2" > + [(set (match_operand:ANYF 0 "register_operand" "=3Df") > + (unspec:ANYF[(match_operand:ANYF 1 "register_operand" "f")] > + FLOAT))] > + "TARGET_HARD_FLOAT&&(flag_fp_int_builtin_inexact || > !flag_trapping_math)" > + =20 > "ftint..\t%0,%1\n\tffint..\t%0,%0 It's wrong. For example, consider ceil(0x1.0p+100). 0x1.0p+100 cannot be represented by any 64-bit integer, so ftintrp.l.d will raise an overflow exception and provide "some value" as the output. Then ffint can't produce the correct result. Nacked-by: Xi Ruoyao I'd suggest to add frint.{w,l}.{s,d}.{rm,rp,rz} etc. (BTW, also the variants without raising inexact exceptions) into a future LoongArch ISA version for this. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University