public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/53100] Optimize __int128 with range information
Date: Fri, 06 Aug 2021 00:33:27 +0000	[thread overview]
Message-ID: <bug-53100-4-N5T4gkf5bl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53100-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53100

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |tree-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-08-06
           Keywords|                            |missed-optimization
     Ever confirmed|0                           |1

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So in the #if 0 case we get:
  x_13 = (long int) a_12(D);
  y_15 = (long int) b_14(D);
  z_17 = (long int) c_16(D);
  t_19 = (long int) d_18(D);
  u_21 = (long int) e_20(D);
  v_23 = (long int) f_22(D);
  _1 = z_17 - x_13;
  _3 = v_23 - y_15;
  _5 = _1 w* _3;

Notice the w*

While with the original case we get:
  x_9 = (__int128) a_8(D);
  y_11 = (__int128) b_10(D);
  z_13 = (__int128) c_12(D);
  t_15 = (__int128) d_14(D);
  u_17 = (__int128) e_16(D);
  v_19 = (__int128) f_18(D);
  _1 = z_13 - x_9;
  _2 = v_19 - y_11;
  _3 = _1 * _2;

If we had simplified/shortened: ((__int128) c_12(D)) - ((__int128) a_8(D))
to
(__int128)(long)((unsigned long) c_12(D)) - ((unsigned long) a_8(D))
We might have optimized this.
There might be another bug about having some PLUS_EXPR which has WRAPPING
effects rather than undefined OVERFLOW which will help the casting issue.

  parent reply	other threads:[~2021-08-06  0:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-24  7:08 [Bug middle-end/53100] New: " marc.glisse at normalesup dot org
2012-04-29  8:06 ` [Bug middle-end/53100] " marc.glisse at normalesup dot org
2012-04-29  8:43 ` marc.glisse at normalesup dot org
2012-05-01 12:47 ` marc.glisse at normalesup dot org
2021-08-06  0:33 ` pinskia at gcc dot gnu.org [this message]
2023-07-21 23:32 ` [Bug tree-optimization/53100] " pinskia 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-53100-4-N5T4gkf5bl@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: link
Be 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).