public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/107052] New: Range of __builtin_popcount can be improved with nonzerobits
@ 2022-09-27 15:18 pinskia at gcc dot gnu.org
  2022-09-27 15:18 ` [Bug tree-optimization/107052] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-09-27 15:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107052
           Summary: Range of __builtin_popcount can be improved with
                    nonzerobits
           Product: gcc
           Version: 12.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:
```
void link_failure();
void f(int a)
{
    a &= 0x300;
    int b =  __builtin_popcount(a);
    if (b > 3)
        link_failure();
}

```
The if statement should be optimized away as the only values for popcount here
is 0-3.

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

end of thread, other threads:[~2022-10-05 12:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-27 15:18 [Bug tree-optimization/107052] New: Range of __builtin_popcount can be improved with nonzerobits pinskia at gcc dot gnu.org
2022-09-27 15:18 ` [Bug tree-optimization/107052] " pinskia at gcc dot gnu.org
2022-09-27 15:24 ` pinskia at gcc dot gnu.org
2022-09-27 15:33 ` aldyh at gcc dot gnu.org
2022-09-27 15:36 ` pinskia at gcc dot gnu.org
2022-09-27 15:54 ` aldyh at gcc dot gnu.org
2022-09-27 16:22 ` aldyh at gcc dot gnu.org
2022-10-05 12:22 ` cvs-commit at gcc dot gnu.org
2022-10-05 12:22 ` cvs-commit at gcc dot gnu.org
2022-10-05 12:23 ` aldyh 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).