public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114214] New: `(x&~M)|((x&M)&~(y&M))` -> `x&~(y&M)` is not done
@ 2024-03-03 2:50 pinskia at gcc dot gnu.org
2024-03-03 5:47 ` [Bug tree-optimization/114214] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-03 2:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114214
Bug ID: 114214
Summary: `(x&~M)|((x&M)&~(y&M))` -> `x&~(y&M)` is not done
Product: gcc
Version: 14.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
Target Milestone: ---
GCC should be able to optimize f to f1:
```
int f(int x, int y, int M)
{
return (x&~M)|((x&M)&~(y&M));
}
int f1(int x, int y, int M)
{
return x&~(y&M);
}
```
Note it should be also done for a constant M and when M is a comparison too.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug tree-optimization/114214] `(x&~M)|((x&M)&~(y&M))` -> `x&~(y&M)` is not done
2024-03-03 2:50 [Bug tree-optimization/114214] New: `(x&~M)|((x&M)&~(y&M))` -> `x&~(y&M)` is not done pinskia at gcc dot gnu.org
@ 2024-03-03 5:47 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-03 5:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114214
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-03-03
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(simplify
(bit_ior:c
(bit_and:c @0 @c1)
(bit_and:c
(bit_not@n (bit_and:c @2 @1))
(bit_and:c @0 @1)
)
)
(if (gimple_bitwise_inverted_equal_p (@1, @c1, wascmp)
&& (!wascmp || element_precision (type) == 1))
(bit_and @0 @n)))
(simplify
(bit_ior:c
(bit_and:c @0 @c1)
(bit_and:c
(bit_ior:c@n @2 @c1)
(bit_and:c @0 @1)
)
)
(if (gimple_bitwise_inverted_equal_p (@1, @c1, wascmp)
&& (!wascmp || element_precision (type) == 1))
(bit_and @0 @n)))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-03 5:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-03 2:50 [Bug tree-optimization/114214] New: `(x&~M)|((x&M)&~(y&M))` -> `x&~(y&M)` is not done pinskia at gcc dot gnu.org
2024-03-03 5:47 ` [Bug tree-optimization/114214] " 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).