public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/100609] New: bool - 1 is not simplified to -a
@ 2021-05-15  4:03 pinskia at gcc dot gnu.org
  2021-05-15  4:19 ` [Bug tree-optimization/100609] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-05-15  4:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100609
           Summary: bool - 1 is not simplified to -a
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
            Blocks: 25290
  Target Milestone: ---

Take:
int f(_Bool a)
{
  int t = a;
  return t - 1;
}

int g(_Bool a)
{
  int t = a;
  return -t;
}
---- CUT ----
Both of these are the same and should produce the same code gen.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25290
[Bug 25290] PHI-OPT could be rewritten so that is uses match

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug tree-optimization/100609] bool - 1 is not simplified to -a
  2021-05-15  4:03 [Bug tree-optimization/100609] New: bool - 1 is not simplified to -a pinskia at gcc dot gnu.org
@ 2021-05-15  4:19 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-05-15  4:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Wait, I did this wrong.
a - 1 is - (~a).
Never mind.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-15  4:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15  4:03 [Bug tree-optimization/100609] New: bool - 1 is not simplified to -a pinskia at gcc dot gnu.org
2021-05-15  4:19 ` [Bug tree-optimization/100609] " pinskia at gcc dot gnu.org

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).