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/71336] Suboptimal code generated for "(a & 1) ? (CST1 + CST2) : CST1"
Date: Tue, 20 Jul 2021 00:19:53 +0000	[thread overview]
Message-ID: <bug-71336-4-DzEzVs7PyH@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-71336-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #6)
> Sorry this one is more correct
> Something like (very much pesdu code):
> (simplify
>  (cond (eq (bit_and@0 @1 int_pow2p@2) integer_zerop) INTEGET_CST@3
> INTEGER_CST@4)
>  (switch
>   (if (@3 u> @4 && exact_pow2(@3 - @4))
>    (convert (plus (mult (rshift @0:typeu @2) (minus @3:typeu @4:typeu))
> @4:typeu)))
>   (if (@4 u> @3 && exact_pow2(@4 - @3))
>    (convert (minus (mult (rshift @0:typeu @2) (minus @4:typeu @3:typeu))
> @3:typeu))
>  ))
> 
> The mult could be changed to lshift to be more correct.

I should note, the above is now only possible because of the recent changes I
did to phi-opt.  You no longer need to open code anything in phi-opt for things
like this bug, just add them to match.pd and be done with it :).

  parent reply	other threads:[~2021-07-20  0:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-71336-4@http.gcc.gnu.org/bugzilla/>
2021-07-20  0:03 ` [Bug rtl-optimization/71336] Suboptimal x86 " pinskia at gcc dot gnu.org
2021-07-20  0:06 ` pinskia at gcc dot gnu.org
2021-07-20  0:17 ` [Bug tree-optimization/71336] " pinskia at gcc dot gnu.org
2021-07-20  0:18 ` [Bug tree-optimization/71336] Suboptimal " pinskia at gcc dot gnu.org
2021-07-20  0:19 ` pinskia at gcc dot gnu.org [this message]
2023-04-09 23:14 ` pinskia at gcc dot gnu.org
2023-05-06 21:44 ` pinskia at gcc dot gnu.org
2023-08-23  1:58 ` 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-71336-4-DzEzVs7PyH@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).