public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111439] New: some boolean related transformation to `~(a&b)`
@ 2023-09-17  6:11 pinskia at gcc dot gnu.org
  2023-09-17  6:11 ` [Bug tree-optimization/111439] " pinskia at gcc dot gnu.org
  2023-11-14 23:40 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-17  6:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111439
           Summary: some boolean related transformation to `~(a&b)`
           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
```
bool foo0(bool a, bool b)
{
    return (a <= b) ^ a;
}
bool foo1(bool a, bool b)
{
    return (!a | b) ^ a;
}
bool foo2(bool b, int x, int y)
{
    bool a = x == y;
    return (!a | b) ^ a;
}
```

These all should be optimized to `~(a&b)`.
Right now foo1 is optimized at -O2 but not -O1 due to PR 111149 (canonical form
of a ^ b or a != b for booleans).
foo2 can be handled at -O2 if we use bitwise_inverted_equal_p instead of
bitwise_equal_p (with bit_not).

foo0 will just need a new pattern really. we do need to make a decision on the
canonical form, is it `~a | b` or `a <= b` but both show currently too.

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

* [Bug tree-optimization/111439] some boolean related transformation to `~(a&b)`
  2023-09-17  6:11 [Bug tree-optimization/111439] New: some boolean related transformation to `~(a&b)` pinskia at gcc dot gnu.org
@ 2023-09-17  6:11 ` pinskia at gcc dot gnu.org
  2023-11-14 23:40 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-17  6:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

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

* [Bug tree-optimization/111439] some boolean related transformation to `~(a&b)`
  2023-09-17  6:11 [Bug tree-optimization/111439] New: some boolean related transformation to `~(a&b)` pinskia at gcc dot gnu.org
  2023-09-17  6:11 ` [Bug tree-optimization/111439] " pinskia at gcc dot gnu.org
@ 2023-11-14 23:40 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-14 23:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
   Last reconfirmed|                            |2023-11-14

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Mine.

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

end of thread, other threads:[~2023-11-14 23:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-17  6:11 [Bug tree-optimization/111439] New: some boolean related transformation to `~(a&b)` pinskia at gcc dot gnu.org
2023-09-17  6:11 ` [Bug tree-optimization/111439] " pinskia at gcc dot gnu.org
2023-11-14 23:40 ` 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).