public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114670] New: `(a ^ 1) <= 3` can be optimized to `a <= 3`
@ 2024-04-09 23:03 pinskia at gcc dot gnu.org
0 siblings, 0 replies; only message in thread
From: pinskia at gcc dot gnu.org @ 2024-04-09 23:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114670
Bug ID: 114670
Summary: `(a ^ 1) <= 3` can be optimized to `a <= 3`
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: ---
While looking into PR 114666, I noticed this:
```
int f(unsigned a)
{
return (a^1) <= 3;
}
int fa(unsigned a)
{
return (a) <= 3;
}
```
These 2 are the same functions should produce the same code.
Basically if we have `(a ^ CST1) <= MASK` where MASK is a (lower) mask which
contain the bits of CST1.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-04-09 23:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09 23:03 [Bug tree-optimization/114670] New: `(a ^ 1) <= 3` can be optimized to `a <= 3` 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).