public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110949] New: ((cast)cmp) - 1 should be tranformed into (cast)cmp` where cmp` is the inverse of cmp
@ 2023-08-08 18:25 pinskia at gcc dot gnu.org
  2023-08-21 20:39 ` [Bug tree-optimization/110949] ((cast)cmp) - 1 should be tranformed into -(cast)cmp` " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-08 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110949
           Summary: ((cast)cmp) - 1 should be tranformed into (cast)cmp`
                    where cmp` is the inverse of cmp
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
int f1(int a, int t)
{
  auto _6 = a == 115;
  auto _7 = (signed int) _6;
  return _6 - 1;
}
```
This should be the same as:
```
int f2(int a, int t)
{
  auto _6 = a != 115;
  auto _7 = (signed int) _6;
  return -_6;
}
```

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

* [Bug tree-optimization/110949] ((cast)cmp) - 1 should be tranformed into -(cast)cmp` where cmp` is the inverse of cmp
  2023-08-08 18:25 [Bug tree-optimization/110949] New: ((cast)cmp) - 1 should be tranformed into (cast)cmp` where cmp` is the inverse of cmp pinskia at gcc dot gnu.org
@ 2023-08-21 20:39 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-21 20:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-08-21
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the RTL level does this optimization:
Trying 8 -> 9:
    8: r99:SI=cc:CC==0
      REG_DEAD cc:CC
    9: r97:SI=r99:SI-0x1
      REG_DEAD r99:SI
Successfully matched this instruction:
(set (reg:SI 97 [ _8D.4420 ])
    (neg:SI (ne:SI (reg:CC 66 cc)
            (const_int 0 [0]))))

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

end of thread, other threads:[~2023-08-21 20:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08 18:25 [Bug tree-optimization/110949] New: ((cast)cmp) - 1 should be tranformed into (cast)cmp` where cmp` is the inverse of cmp pinskia at gcc dot gnu.org
2023-08-21 20:39 ` [Bug tree-optimization/110949] ((cast)cmp) - 1 should be tranformed into -(cast)cmp` " 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).