public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "andre.schackier at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/105135] New: [11/12 Regression] Optimization regression for handrolled branchless assignment Date: Sat, 02 Apr 2022 08:53:11 +0000 [thread overview] Message-ID: <bug-105135-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105135 Bug ID: 105135 Summary: [11/12 Regression] Optimization regression for handrolled branchless assignment Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: andre.schackier at gmail dot com Target Milestone: --- Given the following source code [godbolt](https://godbolt.org/z/rrP3bqGW7): ```cpp char to_lower_1(const char c) { return c + ((c >= 'A' && c <= 'Z') * 32); } char to_lower_2(const char c) { return c + (((c >= 'A') & (c <= 'Z')) * 32); } char to_lower_3(const char c) { if (c >= 'A' && c <= 'Z') { return c + 32; } return c; } ``` compiling with `-O3` produces the following assembly ```asm to_lower_1(char): lea eax, [rdi-65] cmp al, 25 setbe al sal eax, 5 add eax, edi ret to_lower_2(char): lea eax, [rdi-65] cmp al, 25 setbe al sal eax, 5 add eax, edi ret to_lower_3(char): lea edx, [rdi-65] lea eax, [rdi+32] cmp dl, 26 cmovnb eax, edi ret ``` Note that gcc-10.3 did produce the same assembly for all 3 functions while gcc-11 and trunk do not.
next reply other threads:[~2022-04-02 8:53 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-02 8:53 andre.schackier at gmail dot com [this message] 2022-04-04 7:17 ` [Bug middle-end/105135] " rguenth at gcc dot gnu.org 2022-04-04 9:47 ` [Bug middle-end/105135] [11/12 Regression] Optimization regression for handrolled branchless assignment since r11-4717-g3e190757fa332d32 marxin at gcc dot gnu.org 2022-04-04 11:49 ` jakub at gcc dot gnu.org 2022-04-21 7:51 ` rguenth at gcc dot gnu.org 2022-07-26 12:37 ` [Bug target/105135] [11/12/13 " rguenth at gcc dot gnu.org 2022-07-26 13:36 ` amonakov at gcc dot gnu.org 2023-03-11 5:29 ` pinskia at gcc dot gnu.org 2023-03-11 5:32 ` [Bug tree-optimization/105135] " pinskia at gcc dot gnu.org 2023-05-29 10:06 ` [Bug tree-optimization/105135] [11/12/13/14 " jakub 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-105135-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).