public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107569] [13 Regression] Failure to optimize std::isfinite since r13-3596 Date: Thu, 10 Nov 2022 19:29:53 +0000 [thread overview] Message-ID: <bug-107569-4-u63UQ11GoO@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107569-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107569 --- Comment #34 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Aldy Hernandez from comment #33) > (In reply to Jakub Jelinek from comment #31) > > Created attachment 53873 [details] > > gcc13-pr107569-div.patch > > > > This is what I meant by complete nightmare - division. > > We can take this to gcc-patches when you're done, but just a few thoughts... > > + // If +-0.0 is in both ranges, it is a maybe NAN. > + if (real_compare (LE_EXPR, &lh_lb, &dconst0) > + && real_compare (GE_EXPR, &lh_ub, &dconst0) > + && real_compare (LE_EXPR, &rh_lb, &dconst0) > + && real_compare (GE_EXPR, &rh_ub, &dconst0)) > > Perhaps we could provide frange::contains_zero_p ()? Well, contains_p in irange is a method on the value range, while here we don't have a frange, but just naked REAL_VALUE_TYPEs. It is twice contains_zero_p... > > + // +-0.0 / +-0.0 or +-INF / +-INF is a known NAN. > + if ((real_iszero (&lh_lb) > + && real_iszero (&lh_ub) > + && real_iszero (&rh_lb) > + && real_iszero (&rh_ub)) > > This looks like frange::contains_zerp_p () as well. No, this is twice zero_p. Due to signed zeros it isn't a singleton + contains_zero_p, just both boundaries are zero. > + || (real_isinf (&lh_lb) > + && real_isinf (&lh_ub, real_isneg (&lh_lb)) > + && real_isinf (&rh_lb) > + && real_isinf (&rh_ub, real_isneg (&rh_lb)))) > > Note that, real_isinf with only one argument checks for +-INF. I know. I'm intentionally using one and 2 argument ones to verify that lh is either [INF,INF] or [-INF,-INF], but not [-INF,INF]. > But I think > what you're looking for is frange::maybe_isinf. Again, that works on frange, which I don't have here. > > Could your patch be simplified with some of these? > > // fpclassify like API > bool known_isfinite () const; > bool known_isnan () const; > bool known_isinf () const; > bool maybe_isnan () const; > bool maybe_isnan (bool sign) const; > bool maybe_isinf () const; > bool signbit_p (bool &signbit) const; > bool nan_signbit_p (bool &signbit) const; > > We should ultimately avoid peeking at the end points unnecessarily in order > to prepare ourselves for next release when we (hopefully) have sub-ranges. No, see above (at least for now). The peeking at the end points is needed because those end points behave weirdly.
next prev parent reply other threads:[~2022-11-10 19:29 UTC|newest] Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-08 12:09 [Bug tree-optimization/107569] New: " jakub at gcc dot gnu.org 2022-11-08 12:09 ` [Bug tree-optimization/107569] " jakub at gcc dot gnu.org 2022-11-08 12:59 ` pilarlatiesa at gmail dot com 2022-11-08 13:30 ` rguenth at gcc dot gnu.org 2022-11-08 13:34 ` jakub at gcc dot gnu.org 2022-11-08 14:46 ` amacleod at redhat dot com 2022-11-08 14:53 ` jakub at gcc dot gnu.org 2022-11-08 15:14 ` amacleod at redhat dot com 2022-11-08 15:34 ` jakub at gcc dot gnu.org 2022-11-08 15:53 ` amacleod at redhat dot com 2022-11-08 15:55 ` jakub at gcc dot gnu.org 2022-11-08 16:00 ` jakub at gcc dot gnu.org 2022-11-08 17:25 ` jakub at gcc dot gnu.org 2022-11-09 14:20 ` aldyh at gcc dot gnu.org 2022-11-09 14:27 ` aldyh at gcc dot gnu.org 2022-11-09 14:30 ` aldyh at gcc dot gnu.org 2022-11-09 15:01 ` pilarlatiesa at gmail dot com 2022-11-09 15:10 ` jakub at gcc dot gnu.org 2022-11-09 15:38 ` jakub at gcc dot gnu.org 2022-11-09 17:21 ` cvs-commit at gcc dot gnu.org 2022-11-09 18:21 ` jakub at gcc dot gnu.org 2022-11-10 9:32 ` aldyh at gcc dot gnu.org 2022-11-10 9:36 ` jakub at gcc dot gnu.org 2022-11-10 10:22 ` jakub at gcc dot gnu.org 2022-11-10 10:29 ` jakub at gcc dot gnu.org 2022-11-10 10:40 ` jakub at gcc dot gnu.org 2022-11-10 11:34 ` aldyh at gcc dot gnu.org 2022-11-10 11:34 ` aldyh at gcc dot gnu.org 2022-11-10 12:22 ` jakub at gcc dot gnu.org 2022-11-10 12:47 ` aldyh at gcc dot gnu.org 2022-11-10 12:54 ` jakub at gcc dot gnu.org 2022-11-10 13:19 ` aldyh at gcc dot gnu.org 2022-11-10 13:35 ` aldyh at gcc dot gnu.org 2022-11-10 16:12 ` jakub at gcc dot gnu.org 2022-11-10 17:50 ` aldyh at gcc dot gnu.org 2022-11-10 19:14 ` aldyh at gcc dot gnu.org 2022-11-10 19:29 ` jakub at gcc dot gnu.org [this message] 2022-11-11 7:15 ` aldyh at gcc dot gnu.org 2022-11-12 8:42 ` cvs-commit at gcc dot gnu.org 2022-11-12 8:42 ` cvs-commit at gcc dot gnu.org 2022-11-12 8:43 ` cvs-commit at gcc dot gnu.org 2022-11-30 1:43 ` romain.geissler at amadeus dot com 2022-12-08 16:24 ` jakub at gcc dot gnu.org 2022-12-08 16:32 ` jakub at gcc dot gnu.org 2022-12-08 16:37 ` jakub at gcc dot gnu.org 2022-12-09 15:34 ` amacleod at redhat dot com 2023-02-27 10:07 ` rguenth at gcc dot gnu.org 2023-03-22 15:26 ` jakub at gcc dot gnu.org 2023-03-22 16:07 ` jakub at gcc dot gnu.org 2023-03-23 8:38 ` jakub at gcc dot gnu.org 2023-03-23 13:47 ` rguenth at gcc dot gnu.org 2023-03-23 14:30 ` jakub at gcc dot gnu.org 2023-03-23 16:22 ` cvs-commit at gcc dot gnu.org 2023-03-23 16:22 ` rguenth at gcc dot gnu.org
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=bug-107569-4-u63UQ11GoO@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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).