public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/105034] New: [10/11/12 regression]Suboptimal codegen for min/max with -Os Date: Wed, 23 Mar 2022 06:50:02 +0000 [thread overview] Message-ID: <bug-105034-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105034 Bug ID: 105034 Summary: [10/11/12 regression]Suboptimal codegen for min/max with -Os Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: crazylht at gmail dot com Target Milestone: --- #define max(a,b) (((a) > (b))? (a) : (b)) #define min(a,b) (((a) < (b))? (a) : (b)) int foo(int x) { return max(x,0); } int bar(int x) { return min(x,0); } unsigned int baz(unsigned int x) { return min(x,1); } gcc10/11/12 -Os -msse4.1 foo(int): movd xmm0, edi xorps xmm1, xmm1 pmaxsd xmm0, xmm1 movd eax, xmm0 ret bar(int): movd xmm0, edi xorps xmm1, xmm1 pminsd xmm0, xmm1 movd eax, xmm0 ret baz(unsigned int): xor eax, eax test edi, edi setne al ret gcc9.4 -Os -msse4.1 foo(int): test edi, edi mov eax, 0 cmovns eax, edi ret bar(int): test edi, edi mov eax, 0 cmovle eax, edi ret baz(unsigned int): xor eax, eax test edi, edi setne al ret Os size text data bss dec hex filename 178 0 0 178 b2 Os.o O2 size text data bss dec hex filename 176 0 0 176 b0 O2.o https://godbolt.org/z/1sYxdTcKz
next reply other threads:[~2022-03-23 6:50 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-23 6:50 crazylht at gmail dot com [this message] 2022-03-23 11:01 ` [Bug target/105034] " rguenth at gcc dot gnu.org 2022-03-28 2:49 ` wwwhhhyyy333 at gmail dot com 2022-04-14 8:38 ` roger at nextmovesoftware dot com 2022-04-14 9:00 ` rguenth at gcc dot gnu.org 2022-04-14 9:20 ` roger at nextmovesoftware dot com 2022-06-28 10:48 ` [Bug target/105034] [10/11/12/13 " jakub at gcc dot gnu.org 2023-07-07 10:42 ` [Bug target/105034] [11/12/13/14 " rguenth at gcc dot gnu.org 2023-11-01 3:54 ` crazylht at gmail dot com
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-105034-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).