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/103660] Sub-optimal code with relational operators
Date: Sun, 12 Dec 2021 23:58:31 +0000	[thread overview]
Message-ID: <bug-103660-4-44dLdBFQ3a@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103660-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-12-12
                 CC|                            |pinskia at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
           Severity|normal                      |enhancement
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For min3/min4:
  _3 = a_7(D) < b_8(D) ? a_7(D) : 0;
  _6 = a_7(D) >= b_8(D) ? b_8(D) : 0;
  _9 = _3 | _6;


A pattern like:
(for op (add bit_ior)
 (simplify
  (op:c
   (cond (lt @0 @1) @0 integer_zero_p@2)
   (cond (ge @0 @1) @0 @2))
  (min @0 @1)))

And make one for the others too.

min5/6 is more complex:
min5:
  _1 = a_5(D) < b_6(D);
  c_7 = (const int) _1;
  _2 = a_5(D) * c_7;
  _3 = 1 - c_7;
  _4 = _3 * b_6(D);
  _8 = _2 + _4;

min6:
  _5 = a_1(D) < b_2(D);
  _6 = (int) _5;
  _7 = a_1(D) * _6;
  _8 = a_1(D) >= b_2(D);
  _9 = (int) _8;
  _10 = b_2(D) * _9;
  _11 = _7 + _10;

I think I have a patch which helps these, I have to finish it up and then it
goes back to min3/min4 issue.

  reply	other threads:[~2021-12-12 23:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-11 13:14 [Bug c/103660] New: " david at westcontrol dot com
2021-12-12 23:58 ` pinskia at gcc dot gnu.org [this message]
2023-08-23  3:45 ` [Bug tree-optimization/103660] " pinskia at gcc dot gnu.org
2023-08-23  4:45 ` pinskia at gcc dot gnu.org
2023-08-23  4:49 ` 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-103660-4-44dLdBFQ3a@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).