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 964F43858D1E for ; Wed, 9 Nov 2022 08:14:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 964F43858D1E 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=1667981679; bh=e6MXbgnSr+M71JeJq7O4GS7fpHHNkEdW4oAcHPHzhfc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=hYBDqqvKrb0NWooAnPo8PXQbTLea0C3Z4oA+NTjl9ZfoB+ZuV7sAREBYqcxr13FHR dg8e6VYZO3feRf8fLvzm6HDgUSo56t27Y3goCmmRA/ItMbPrxUmvwQqseGopqMdyu/ UA2FUss2jK+CQ9KCme/iYPeLOojrI57vHeCULpu8= 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)) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 75B9265EC8; Wed, 9 Nov 2022 03:14:38 -0500 (EST) Message-ID: <1c8436863493d9a3abfbda035f75ff35272a5358.camel@xry111.site> Subject: Re: [PATCH 2/4] LoongArch: Add ftint{,rm,rp}.{w,l}.{s,d} instructions From: Xi Ruoyao To: Lulu Cheng , gcc-patches@gcc.gnu.org Cc: Wang Xuerui , Chenghua Xu , Xiaolin Tang Date: Wed, 09 Nov 2022 16:14:37 +0800 In-Reply-To: <4c43dfab-7562-8d7a-5186-e2c1b7f181a9@loongson.cn> References: <20221109072147.789090-1-xry111@xry111.site> <20221109072147.789090-3-xry111@xry111.site> <4c43dfab-7562-8d7a-5186-e2c1b7f181a9@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=1.0 required=5.0 tests=BAYES_00,BODY_8BITS,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-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, 2022-11-09 at 15:46 +0800, Lulu Cheng wrote: > There is a paragraph in the explanation information for the compile=20 > parameter '-fno-fp-int-builtin-inexact' in the gcc.pdf document: >=20 > =C2=A0=C2=A0=C2=A0=C2=A0 "Do not allow the built-in functions ceil, floor= , round and > trunc,=20 > and their=E3=80=80float and long double variants, >=20 > =C2=A0=C2=A0=C2=A0=C2=A0 to generate code that raises the =E2=80=9Cinexac= t=E2=80=9D=E3=80=80floating-point > exception=20 > for noninteger arguments. >=20 > =C2=A0=C2=A0=C2=A0=C2=A0 ISO C99 and C11 allow=E3=80=80these functions to= raise the =E2=80=9Cinexact=E2=80=9D=20 > exception, but ISO/IEC TS 18661-1:2014, >=20 > =C2=A0=C2=A0=C2=A0=C2=A0 the C bindings to IEEE 754-2008, as integrated i= nto ISO C2X, does > not allow=E3=80=80these functions to do so." >=20 > So I think the implementation of these functions needs to be confirmed > again. >=20 > Or am I misinterpreting this description?:-[ You are correct, I'm wrong :(. This patch breaks: long x(double d) { return __builtin_ceil(d); } The compiler then folds it into __builtin_lceil and produce ftintrp.l.d $f0,$f0, even if -fno-fp-int-builtin-inexact is used. I'll revise this patch to limit lceil and lfloor for -ffp-int-builtin- inexact only. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University