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 DAA993858039 for ; Wed, 9 Nov 2022 13:49:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DAA993858039 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=1668001778; bh=q3T5U61DHWQPDtsGaUGE0O2vOtpJhcFZgQ4ZKcNkGMU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=iDxN8+wUuUuIV9ZpbnwfGkO6z8m0MAZuAp2XUIcSP7vIDBguJpaG/EYLKRtrdaetV iFXTz68daQuhjN8jN3ALtf40VFOY5xVs9S/qYbBha/5qX6VDNKbpIx95lr7vwi4TKr +kNzSQjGVu+UzONp0r9Y/EpoGnav47pWm0FWJ36s= 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 DBBF166883; Wed, 9 Nov 2022 08:49:37 -0500 (EST) Message-ID: <8b9f17ccf291b5391ff5a872748b64d94682c8fb.camel@xry111.site> Subject: Re: [COMMITTED] [range-op-float] Implement MINUS_EXPR. From: Xi Ruoyao To: Aldy Hernandez , GCC patches Cc: Jakub Jelinek , Andrew MacLeod Date: Wed, 09 Nov 2022 21:49:35 +0800 In-Reply-To: <20221109070758.1030615-2-aldyh@redhat.com> References: <20221109070758.1030615-1-aldyh@redhat.com> <20221109070758.1030615-2-aldyh@redhat.com> Content-Type: multipart/mixed; boundary="=-bknH9MKUphjlvYu9hq/Y" User-Agent: Evolution 3.46.0 MIME-Version: 1.0 X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD,GIT_PATCH_0,LIKELY_SPAM_FROM,PDS_OTHER_BAD_TLD,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --=-bknH9MKUphjlvYu9hq/Y Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Aldy, This commit breaks the attached test case at -O2 on x86_64-linux-gnu and loongarch64-linux-gnu :(. The code is simplified from Glibc: the breakage causes two Glibc test failures on loongarch64-linux-gnu. Reverting the commit can fix the breakage. On Wed, 2022-11-09 at 08:07 +0100, Aldy Hernandez via Gcc-patches wrote: > Now that the generic parts of the binary operators have been > abstracted, implementing MINUS_EXPR is a cinch. >=20 > The op[12]_range entries will be submitted as a follow-up. >=20 > gcc/ChangeLog: >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* range-op-float.cc (clas= s foperator_minus): New. > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0(floating_op_table::float= ing_op_table): Add MINUS_EXPR entry. > --- > =C2=A0gcc/range-op-float.cc | 24 ++++++++++++++++++++++++ > =C2=A01 file changed, 24 insertions(+) >=20 > diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc > index 7075c25442a..d52e971f84e 100644 > --- a/gcc/range-op-float.cc > +++ b/gcc/range-op-float.cc > @@ -1884,6 +1884,29 @@ class foperator_plus : public > range_operator_float > =C2=A0} fop_plus; > =C2=A0 > =C2=A0 > +class foperator_minus : public range_operator_float > +{ > +=C2=A0 void rv_fold (REAL_VALUE_TYPE &lb, REAL_VALUE_TYPE &ub, bool > &maybe_nan, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0tree type, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0const REAL_VALUE_TYPE &lh_lb, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0const REAL_VALUE_TYPE &lh_ub, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0const REAL_VALUE_TYPE &rh_lb, > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0const REAL_VALUE_TYPE &rh_ub) const final override > +=C2=A0 { > +=C2=A0=C2=A0=C2=A0 frange_arithmetic (MINUS_EXPR, type, lb, lh_lb, rh_ub= , > dconstninf); > +=C2=A0=C2=A0=C2=A0 frange_arithmetic (MINUS_EXPR, type, ub, lh_ub, rh_lb= , > dconstinf); > + > +=C2=A0=C2=A0=C2=A0 // [+INF] - [+INF] =3D NAN > +=C2=A0=C2=A0=C2=A0 if (real_isinf (&lh_ub, false) && real_isinf (&rh_ub,= false)) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 maybe_nan =3D true; > +=C2=A0=C2=A0=C2=A0 // [-INF] - [-INF] =3D NAN > +=C2=A0=C2=A0=C2=A0 else if (real_isinf (&lh_lb, true) && real_isinf (&rh= _lb, true)) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 maybe_nan =3D true; > +=C2=A0=C2=A0=C2=A0 else > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 maybe_nan =3D false; > +=C2=A0 } > +} fop_minus; > + > =C2=A0// Instantiate a range_op_table for floating point operations. > =C2=A0static floating_op_table global_floating_table; > =C2=A0 > @@ -1917,6 +1940,7 @@ floating_op_table::floating_op_table () > =C2=A0=C2=A0 set (ABS_EXPR, fop_abs); > =C2=A0=C2=A0 set (NEGATE_EXPR, fop_negate); > =C2=A0=C2=A0 set (PLUS_EXPR, fop_plus); > +=C2=A0 set (MINUS_EXPR, fop_minus); > =C2=A0} > =C2=A0 > =C2=A0// Return a pointer to the range_operator_float instance, if there = is --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University --=-bknH9MKUphjlvYu9hq/Y Content-Disposition: attachment; filename="test1.c" Content-Type: text/x-csrc; name="test1.c"; charset="UTF-8" Content-Transfer-Encoding: base64 X19hdHRyaWJ1dGVfXygobm9pcGEsbm9pbmxpbmUpKQppbnQgdChkb3VibGUgYSwgZG91YmxlIGIp CnsKCWRvdWJsZSBjID0gYSAtIGI7CglpZiAoIV9fYnVpbHRpbl9pc2Zpbml0ZShjKSkgewoJCWlm IChfX2J1aWx0aW5faXNuYW4oYykpIHsKCQkJaWYgKCFfX2J1aWx0aW5faXNuYW4oYSkgJiYgIV9f YnVpbHRpbl9pc25hbihiKSkKCQkJCXJldHVybiAxOwoJCX0gZWxzZSBpZiAoX19idWlsdGluX2lz ZmluaXRlKGEpICYmIF9fYnVpbHRpbl9pc2Zpbml0ZShiKSkKCQkJcmV0dXJuIDI7Cgl9IGVsc2Ug aWYgKGMgPT0gMCAmJiBhICE9IGIpCgkJcmV0dXJuIDM7CglyZXR1cm4gNDsKfQoKaW50IG1haW4o KQp7Cglkb3VibGUgYSA9IF9fYnVpbHRpbl9pbmYoKTsKCWlmICh0KGEsIGEpICE9IDEpCgkJX19i dWlsdGluX2Fib3J0KCk7Cn0K --=-bknH9MKUphjlvYu9hq/Y--