public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "652023330028 at smail dot nju.edu.cn" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/115011] New: [14/15 Regression] Missed optimization: (bool) (f ? 1: t) ==> 1 when bool t = (0 >= f) + x; Date: Thu, 09 May 2024 12:59:09 +0000 [thread overview] Message-ID: <bug-115011-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115011 Bug ID: 115011 Summary: [14/15 Regression] Missed optimization: (bool) (f ? 1: t) ==> 1 when bool t = (0 >= f) + x; Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: 652023330028 at smail dot nju.edu.cn Target Milestone: --- Hello, we noticed that the code below can be optimized as stated in the title, but gcc -O3 seems to have missed it. Reduced code: https://godbolt.org/z/xE6GEEn7j bool x; bool fn3(unsigned long long int f) { bool t = (0 >= f) + x; return f ? 1: t; } GCC -O3: fn3(unsigned long long): movzx eax, BYTE PTR x[rip] cmp rdi, 1 adc eax, 0 test eax, eax setne al test rdi, rdi setne dl or eax, edx ret Expected code (GCC-13.2): fn3(unsigned long long): mov eax, 1 ret Thank you very much for your time and effort! We look forward to hearing from you.
next reply other threads:[~2024-05-09 12:59 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-05-09 12:59 652023330028 at smail dot nju.edu.cn [this message] 2024-05-09 14:27 ` [Bug tree-optimization/115011] " hjl.tools at gmail dot com 2024-05-09 14:28 ` pinskia at gcc dot gnu.org 2024-05-09 14:50 ` pinskia at gcc dot gnu.org 2024-05-09 14:50 ` pinskia at gcc dot gnu.org 2024-05-10 12:27 ` 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-115011-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).