public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114331] New: Missed optimization: indicate knownbits from dominating condition switch(trunc(a))
@ 2024-03-14  5:50 xxs_chy at outlook dot com
  2024-03-14  8:36 ` [Bug tree-optimization/114331] " rguenth at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: xxs_chy at outlook dot com @ 2024-03-14  5:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114331
           Summary: Missed optimization: indicate knownbits from
                    dominating condition switch(trunc(a))
           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 link: https://godbolt.org/z/dso53ndTo
For code like:

int src(int num) {
    switch((short)num){
        case 111:
          return num & 0xfffe;
        case 267:
        case 204:
        case 263:
          return 0;
        default:
          dummy();
          return 0;
    }
}

"num & 0xfffe" can be folded to "110". But both LLVM and GCC fail to fold it.

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

end of thread, other threads:[~2024-03-15  8:06 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-14  5:50 [Bug tree-optimization/114331] New: Missed optimization: indicate knownbits from dominating condition switch(trunc(a)) xxs_chy at outlook dot com
2024-03-14  8:36 ` [Bug tree-optimization/114331] " rguenth at gcc dot gnu.org
2024-03-14  8:44 ` jakub at gcc dot gnu.org
2024-03-14 12:45 ` amacleod at redhat dot com
2024-03-14 13:21 ` jakub at gcc dot gnu.org
2024-03-14 16:33 ` amacleod at redhat dot com
2024-03-14 16:57 ` aldyh at gcc dot gnu.org
2024-03-14 17:08 ` jakub at gcc dot gnu.org
2024-03-14 17:28 ` amacleod at redhat dot com
2024-03-14 17:39 ` pinskia at gcc dot gnu.org
2024-03-14 17:58 ` jakub at gcc dot gnu.org
2024-03-14 18:29 ` amacleod at redhat dot com
2024-03-14 18:41 ` jakub at gcc dot gnu.org
2024-03-15  7:51 ` aldyh at gcc dot gnu.org
2024-03-15  8:01 ` jakub at gcc dot gnu.org
2024-03-15  8:05 ` jakub 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).