public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109960] New: [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` Date: Thu, 25 May 2023 00:40:12 +0000 [thread overview] Message-ID: <bug-109960-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109960 Bug ID: 109960 Summary: [10/11/12/13/14 Regression] missing combining of `(a&1) != 0 || (a&2)!=0` into `(a&3)!=0` 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: --- Take the following C++ code (reduced from stmt_can_terminate_bb_p): ``` static inline bool f1(unsigned *a) { return (*a&1); } static inline bool f2(unsigned *a) { return (*a&2); } bool f(int c, unsigned *a) { if (c) return 0; return f2(a) || f1(a) ; } ``` At -O1 we can produce: ``` movl $0, %eax testl %edi, %edi jne .L1 testb $3, (%rsi) setne %al .L1: ret ``` But at -O2 we get: xorl %eax, %eax testl %edi, %edi jne .L1 movl (%rsi), %edx movl %edx, %eax andl $1, %eax andl $2, %edx movl $1, %edx cmovne %edx, %eax .L1: ret Which is just so much worse. This started in GCC 9.
next reply other threads:[~2023-05-25 0:40 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-25 0:40 pinskia at gcc dot gnu.org [this message] 2023-05-25 0:41 ` [Bug tree-optimization/109960] " pinskia at gcc dot gnu.org 2023-05-25 0:45 ` pinskia at gcc dot gnu.org 2023-05-25 0:58 ` pinskia at gcc dot gnu.org 2023-05-25 2:29 ` pinskia at gcc dot gnu.org 2023-05-25 2:51 ` pinskia at gcc dot gnu.org 2023-05-25 7:59 ` rguenth at gcc dot gnu.org 2023-07-07 10:45 ` [Bug tree-optimization/109960] [11/12/13/14 " rguenth at gcc dot gnu.org 2023-09-16 22:55 ` pinskia at gcc dot gnu.org 2023-09-16 23:04 ` pinskia at gcc dot gnu.org 2023-09-17 1:27 ` pinskia at gcc dot gnu.org 2024-01-12 13:53 ` rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-109960-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).