public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113487] New: Missed optimization:simplify demanded bits on multi-use instructions like select
@ 2024-01-18 17:34 xxs_chy at outlook dot com
  2024-01-18 17:35 ` [Bug tree-optimization/113487] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: xxs_chy at outlook dot com @ 2024-01-18 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113487
           Summary: Missed optimization:simplify demanded bits on
                    multi-use instructions like select
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xxs_chy at outlook dot com
  Target Milestone: ---

Godbolt example: https://godbolt.org/z/EfKrTbK77

Based on common demanded bits from s&8 and s&16,
```
void src(bool c, unsigned a, unsigned b) {
    unsigned s = c ? a & 24 : b & 25;
    use(s & 8);
    use(s & 16);
}
```

can be folded to:

```
void tgt(bool c, unsigned a, unsigned b) {
    unsigned s = c ? a : b ;
    use(s & 8);
    use(s & 16);
}
```

Both LLVM and GCC missed this optimization opportunity.

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

end of thread, other threads:[~2024-01-19  7:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-18 17:34 [Bug tree-optimization/113487] New: Missed optimization:simplify demanded bits on multi-use instructions like select xxs_chy at outlook dot com
2024-01-18 17:35 ` [Bug tree-optimization/113487] " pinskia at gcc dot gnu.org
2024-01-18 17:38 ` pinskia at gcc dot gnu.org
2024-01-18 17:41 ` xxs_chy at outlook dot com
2024-01-19  7:14 ` rguenth 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).