public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/102486] New: __builtin_popcount(y&-y) is not optimized to 1
@ 2021-09-26 8:26 pinskia at gcc dot gnu.org
2021-09-26 11:12 ` [Bug tree-optimization/102486] " luc.vanoostenryck at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-26 8:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102486
Bug ID: 102486
Summary: __builtin_popcount(y&-y) is not optimized to 1
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
Target Milestone: ---
Take:
int f(unsigned y)
{
return __builtin_popcount(y&-y);
}
This should be optimized to just 1.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/102486] __builtin_popcount(y&-y) is not optimized to 1
2021-09-26 8:26 [Bug tree-optimization/102486] New: __builtin_popcount(y&-y) is not optimized to 1 pinskia at gcc dot gnu.org
@ 2021-09-26 11:12 ` luc.vanoostenryck at gmail dot com
2021-09-26 11:17 ` [Bug tree-optimization/102486] __builtin_popcount(y&-y) is not optimized to y!=0 pinskia at gcc dot gnu.org
2023-10-26 4:19 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: luc.vanoostenryck at gmail dot com @ 2021-09-26 11:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102486
Luc Van Oostenryck <luc.vanoostenryck at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |luc.vanoostenryck at gmail dot com
--- Comment #1 from Luc Van Oostenryck <luc.vanoostenryck at gmail dot com> ---
when y != 0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/102486] __builtin_popcount(y&-y) is not optimized to y!=0
2021-09-26 8:26 [Bug tree-optimization/102486] New: __builtin_popcount(y&-y) is not optimized to 1 pinskia at gcc dot gnu.org
2021-09-26 11:12 ` [Bug tree-optimization/102486] " luc.vanoostenryck at gmail dot com
@ 2021-09-26 11:17 ` pinskia at gcc dot gnu.org
2023-10-26 4:19 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-26 11:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102486
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Luc Van Oostenryck from comment #1)
> when y != 0
Right. So it should be optimize to y!=0 then.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/102486] __builtin_popcount(y&-y) is not optimized to y!=0
2021-09-26 8:26 [Bug tree-optimization/102486] New: __builtin_popcount(y&-y) is not optimized to 1 pinskia at gcc dot gnu.org
2021-09-26 11:12 ` [Bug tree-optimization/102486] " luc.vanoostenryck at gmail dot com
2021-09-26 11:17 ` [Bug tree-optimization/102486] __builtin_popcount(y&-y) is not optimized to y!=0 pinskia at gcc dot gnu.org
@ 2023-10-26 4:19 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-26 4:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102486
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Rather:
```
int f2(unsigned y)
{
return (y&-y) != 0;
}
```
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-26 4:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26 8:26 [Bug tree-optimization/102486] New: __builtin_popcount(y&-y) is not optimized to 1 pinskia at gcc dot gnu.org
2021-09-26 11:12 ` [Bug tree-optimization/102486] " luc.vanoostenryck at gmail dot com
2021-09-26 11:17 ` [Bug tree-optimization/102486] __builtin_popcount(y&-y) is not optimized to y!=0 pinskia at gcc dot gnu.org
2023-10-26 4:19 ` 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).